diff --git a/TODOs.md b/TODOs.md index 98fe386..03efe72 100644 --- a/TODOs.md +++ b/TODOs.md @@ -10,19 +10,19 @@ These are the jobs to be completed first, to ensure we have minimal functionalit - Update launcher wheel to a Neo/SparkMax X - Define basic commands for manual fire mode - - Y/Top button: Deploy the intake (and run the rollers) (TO MAP) + - Y/Top button: Deploy the intake (and run the rollers) X - Could be a single command - Could be 2 commands in sequence - - B/Right button: Reverse the intake (TO MAP) + - B/Right button: Reverse the intake X - Unclear if this should touch the deploy motor. ATM suggest leaving the deploy motor alone - - A/Bottom button: Retract the intake (and stop the rollers) (TO MAP) + - A/Bottom button: Retract the intake (and stop the rollers) X - D-pad: Set deflector to pre-programmed angle - - Suggestion: Implement this once, and make the angle an member variable of the command (TO MAP) + - Suggestion: Implement this once, and make the angle an member variable of the command X - - Both Triggers: Spin up flywheel (if not already spun up) and then start the kicker. + - Both Triggers: Spin up flywheel (if not already spun up) and then start the kicker. X - Re: Sensing flywheel speed - Could be a time offset (i.e. wait for N seconds for the motor to spin up) - Ideally, check the encoder speed (will need the encoders for auto launch) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index fb49fa5..2174bde 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -83,6 +83,11 @@ public final class Constants { public static final Angle LIMIT_ELEVATION_NEG = edu.wpi.first.units.Units.Degrees.of(0); public static final double HOMING_SPEED = .35; public static final double TURRET_GEAR_RATIO = 1; + + public static final Angle DEFLECTOR_STORED_ANGLE = edu.wpi.first.units.Units.Degrees.of(0); + public static final Angle DEFLECTOR_SET_ANGLE1 = edu.wpi.first.units.Units.Degrees.of(20); + public static final Angle DEFLECTOR_SET_ANGLE2 = edu.wpi.first.units.Units.Degrees.of(40); + public static final Angle DEFLECTOR_SET_ANGLE3 = edu.wpi.first.units.Units.Degrees.of(60); } public static class HopperConstants { diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index bee31bf..42d7e0a 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -4,12 +4,17 @@ package frc.robot; +import edu.wpi.first.units.Unit; +import edu.wpi.first.units.Units; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.button.Trigger; import frc.robot.Constants.OperatorConstants; import frc.robot.commands.Autos; import frc.robot.commands.ExampleCommand; +import frc.robot.commands.ManualHopperCommand; +import frc.robot.commands.ManualShootCommand; +import frc.robot.commands.SetDeflectorCommand; import frc.robot.subsystems.DriveSubsystem; import frc.robot.subsystems.ExampleSubsystem; import frc.robot.subsystems.HopperSubsystem; @@ -57,13 +62,17 @@ public class RobotContainer { * joysticks}. */ private void configureBindings() { - // Schedule `ExampleCommand` when `exampleCondition` changes to `true` - new Trigger(m_exampleSubsystem::exampleCondition) - .onTrue(new ExampleCommand(m_exampleSubsystem)); + turretSubsystem.setDefaultCommand(new ManualShootCommand(turretSubsystem, m_driverController.getHID())); + hopperSubsystem.setDefaultCommand(new ManualHopperCommand(hopperSubsystem, m_driverController.getHID())); - // Schedule `exampleMethodCommand` when the Xbox controller's B button is pressed, - // cancelling on release. - // m_driverController.b().whileTrue(m_exampleSubsystem.exampleMethodCommand()); + m_driverController.povDown().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_STORED_ANGLE)); + m_driverController.povLeft().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE1)); + m_driverController.povRight().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE3)); + m_driverController.povUp().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE2)); + + m_driverController.y().onTrue(intakeSubsystem.deployCommand()); + m_driverController.a().onTrue(intakeSubsystem.retractCommand()); + m_driverController.b().onTrue(intakeSubsystem.reverseCommand()); } /**