Update RobotContainer.java

This commit is contained in:
aarav18
2022-01-22 13:55:37 -07:00
parent a11b959b54
commit a6048afb5b
@@ -13,7 +13,7 @@ import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.button.JoystickButton; import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import frc4388.robot.Constants.*; import frc4388.robot.Constants.*;
import frc4388.robot.subsystems.Drive; import frc4388.robot.subsystems.FalconTester;
import frc4388.robot.subsystems.LED; import frc4388.robot.subsystems.LED;
import frc4388.utility.LEDPatterns; import frc4388.utility.LEDPatterns;
import frc4388.utility.controller.IHandController; import frc4388.utility.controller.IHandController;
@@ -31,11 +31,11 @@ public class RobotContainer {
private final RobotMap m_robotMap = new RobotMap(); private final RobotMap m_robotMap = new RobotMap();
/* Subsystems */ /* Subsystems */
private final Drive m_robotDrive = new Drive(m_robotMap.leftFrontMotor, m_robotMap.rightFrontMotor,
m_robotMap.leftBackMotor, m_robotMap.rightBackMotor, m_robotMap.driveTrain, m_robotMap.gyroDrive);
private final LED m_robotLED = new LED(m_robotMap.LEDController); private final LED m_robotLED = new LED(m_robotMap.LEDController);
private final FalconTester m_falconTester = new FalconTester(m_robotMap.falconTestMotor);
/* Controllers */ /* Controllers */
private final XboxController m_driverXbox = new XboxController(OIConstants.XBOX_DRIVER_ID); private final XboxController m_driverXbox = new XboxController(OIConstants.XBOX_DRIVER_ID);
private final XboxController m_operatorXbox = new XboxController(OIConstants.XBOX_OPERATOR_ID); private final XboxController m_operatorXbox = new XboxController(OIConstants.XBOX_OPERATOR_ID);
@@ -48,9 +48,9 @@ public class RobotContainer {
/* Default Commands */ /* Default Commands */
// drives the robot with a two-axis input from the driver controller // drives the robot with a two-axis input from the driver controller
m_robotDrive.setDefaultCommand( m_falconTester.setDefaultCommand(
new RunCommand(() -> m_robotDrive.driveWithInput(getDriverController().getLeftYAxis(), new RunCommand(() -> m_falconTester.setMotorSpeed(0.1d * getDriverController().getLeftYAxis()),
getDriverController().getRightXAxis()), m_robotDrive)); m_falconTester));
// continually sends updates to the Blinkin LED controller to keep the lights on // continually sends updates to the Blinkin LED controller to keep the lights on
m_robotLED.setDefaultCommand(new RunCommand(() -> m_robotLED.updateLED(), m_robotLED)); m_robotLED.setDefaultCommand(new RunCommand(() -> m_robotLED.updateLED(), m_robotLED));
} }
@@ -64,8 +64,8 @@ public class RobotContainer {
private void configureButtonBindings() { private void configureButtonBindings() {
/* Driver Buttons */ /* Driver Buttons */
// test command to spin the robot while pressing A on the driver controller // test command to spin the robot while pressing A on the driver controller
new JoystickButton(getDriverJoystick(), XboxController.A_BUTTON) // new JoystickButton(getDriverJoystick(), XboxController.A_BUTTON)
.whileHeld(() -> m_robotDrive.driveWithInput(0, 1)); // .whileHeld(() -> m_robotDrive.driveWithInput(0, 1));
/* Operator Buttons */ /* Operator Buttons */
// activates "Lit Mode" // activates "Lit Mode"