diff --git a/build.gradle b/build.gradle index c73a804..462fb1d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1" + id "edu.wpi.first.GradleRIO" version "2024.3.2" } java { diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index c50ba05..dcb80fd 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -15,5 +15,14 @@ public final class Constants { public static class OperatorConstants { public static final int kDriverControllerPort = 0; + public static final int kDriverMechPort = 1; + + public static final int leftFrontMotor = 0; + public static final int leftBackMotor = 1; + public static final int rightFrontMotor = 2; + public static final int rightBackMotor = 3; + + public static final int dustpanMotor = 4; + } } diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 96428cb..8e67207 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -6,9 +6,13 @@ import frc.robot.Constants.OperatorConstants; import frc.robot.subsystems.DriveSubsystem; +import frc.robot.subsystems.IntakeSubsystem; +import edu.wpi.first.wpilibj.XboxController; import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.InstantCommand; import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; +import edu.wpi.first.wpilibj2.command.button.JoystickButton; import edu.wpi.first.wpilibj2.command.button.Trigger; /** @@ -20,14 +24,23 @@ public class RobotContainer { // The robot's subsystems and commands are defined here... private final DriveSubsystem driveSubsystem; + private final IntakeSubsystem intakeSubsystem; + // Replace with CommandPS4Controller or CommandJoystick if needed private final CommandXboxController driverController = new CommandXboxController(OperatorConstants.kDriverControllerPort); + + + private final CommandXboxController mechController = + new CommandXboxController(OperatorConstants.kDriverMechPort); + + /** The container for the robot. Contains subsystems, OI devices, and commands. */ public RobotContainer() { driveSubsystem = new DriveSubsystem(); + intakeSubsystem = new IntakeSubsystem(); // Configure the trigger bindings configureBindings(); } @@ -46,6 +59,13 @@ private void configureBindings() { driveSubsystem.setDrivePowers(driverController.getLeftY(), driverController.getRightY()); }, driveSubsystem)); + intakeSubsystem.setDefaultCommand(new InstantCommand(()-> { + intakeSubsystem.SetIntakeSpeed(mechController.getLeftTriggerAxis()-mechController.getRightTriggerAxis()); + }, intakeSubsystem)); + + + + } /** diff --git a/src/main/java/frc/robot/subsystems/DriveSubsystem.java b/src/main/java/frc/robot/subsystems/DriveSubsystem.java index 4a9b73d..4fbfc1b 100644 --- a/src/main/java/frc/robot/subsystems/DriveSubsystem.java +++ b/src/main/java/frc/robot/subsystems/DriveSubsystem.java @@ -13,6 +13,7 @@ import com.ctre.phoenix6.hardware.TalonFX; import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.robot.Constants.OperatorConstants; public class DriveSubsystem extends SubsystemBase { @@ -21,10 +22,10 @@ public class DriveSubsystem extends SubsystemBase { private double leftPower, rightPower; public DriveSubsystem() { - leftFrontMotor = new WPI_TalonSRX(0); - leftBackMotor = new WPI_TalonSRX(1); - rightFrontMotor = new WPI_TalonSRX(2); - rightBackMotor = new WPI_TalonSRX(3); + leftFrontMotor = new WPI_TalonSRX(OperatorConstants.leftFrontMotor); + leftBackMotor = new WPI_TalonSRX(OperatorConstants.rightBackMotor); + rightFrontMotor = new WPI_TalonSRX(OperatorConstants.rightFrontMotor); + rightBackMotor = new WPI_TalonSRX(OperatorConstants.rightBackMotor); leftPower = 0; rightPower = 0; diff --git a/src/main/java/frc/robot/subsystems/IntakeSubsystem.java b/src/main/java/frc/robot/subsystems/IntakeSubsystem.java new file mode 100644 index 0000000..a87048b --- /dev/null +++ b/src/main/java/frc/robot/subsystems/IntakeSubsystem.java @@ -0,0 +1,34 @@ +package frc.robot.subsystems; +import com.revrobotics.CANSparkMax; +import com.revrobotics.CANSparkLowLevel.MotorType; +import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; + + + +import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.robot.Constants.OperatorConstants; + +public class IntakeSubsystem extends SubsystemBase{ + + // private final CANSparkMax intakeMotor; + private final WPI_TalonSRX dustpanMotor; + private double speed; + + + + public IntakeSubsystem() { + dustpanMotor = new WPI_TalonSRX(OperatorConstants.dustpanMotor); + + } + + public void SetIntakeSpeed(double speed){ + this.speed = speed; + } + + @Override + public void periodic() { + dustpanMotor.set(speed); + } + + +} \ No newline at end of file diff --git a/vendordeps/REVLib.json b/vendordeps/REVLib.json new file mode 100644 index 0000000..f85acd4 --- /dev/null +++ b/vendordeps/REVLib.json @@ -0,0 +1,74 @@ +{ + "fileName": "REVLib.json", + "name": "REVLib", + "version": "2024.2.4", + "frcYear": "2024", + "uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb", + "mavenUrls": [ + "https://maven.revrobotics.com/" + ], + "jsonUrl": "https://software-metadata.revrobotics.com/REVLib-2024.json", + "javaDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "REVLib-java", + "version": "2024.2.4" + } + ], + "jniDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "REVLib-driver", + "version": "2024.2.4", + "skipInvalidPlatforms": true, + "isJar": false, + "validPlatforms": [ + "windowsx86-64", + "windowsx86", + "linuxarm64", + "linuxx86-64", + "linuxathena", + "linuxarm32", + "osxuniversal" + ] + } + ], + "cppDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "REVLib-cpp", + "version": "2024.2.4", + "libName": "REVLib", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "windowsx86", + "linuxarm64", + "linuxx86-64", + "linuxathena", + "linuxarm32", + "osxuniversal" + ] + }, + { + "groupId": "com.revrobotics.frc", + "artifactId": "REVLib-driver", + "version": "2024.2.4", + "libName": "REVLibDriver", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "windowsx86", + "linuxarm64", + "linuxx86-64", + "linuxathena", + "linuxarm32", + "osxuniversal" + ] + } + ] +} \ No newline at end of file