mirror of
https://github.com/Team4388/2022NoWayHome.git
synced 2026-06-09 00:38:05 -06:00
change
This commit is contained in:
@@ -270,6 +270,13 @@ public class Robot extends TimedRobot {
|
||||
*/
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
boolean robotManual = m_robotContainer.manual;
|
||||
|
||||
if (robotManual) {
|
||||
m_robotContainer.configureManualButtonBindings();
|
||||
} else {
|
||||
m_robotContainer.configureAutomaticButtonBindings();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -132,6 +132,9 @@ public class RobotContainer {
|
||||
// Function that removes the ".path" from the end of a string.
|
||||
private static final Function<CharSequence, String> PATH_EXTENSION_REMOVER = ((Function<CharSequence, Matcher>) Pattern
|
||||
.compile(".path")::matcher).andThen(m -> m.replaceFirst(""));
|
||||
|
||||
|
||||
public boolean manual = false;
|
||||
|
||||
/**
|
||||
* The container for the robot. Contains subsystems, OI devices, and commands.
|
||||
@@ -292,17 +295,13 @@ public class RobotContainer {
|
||||
// new JoystickButton(getOperatorController(), XboxController.Button.kB.value)
|
||||
// .whenPressed(new TrackTarget(m_robotTurret, m_robotBoomBoom, m_robotHood, m_robotSwerveDrive, m_robotVisionOdometry));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Button Box Buttons */
|
||||
new JoystickButton(getButtonFox(), ButtonBox.Button.kLeftSwitch.value)
|
||||
.whenPressed(new InstantCommand(() -> configureManualButtonBindings()))
|
||||
.whenReleased(new InstantCommand(() -> configureButtonBindings()));
|
||||
.whenPressed(new RunCommand(() -> setManual(true)))
|
||||
.whenReleased(new RunCommand(() -> setManual(false)));
|
||||
|
||||
new JoystickButton(getButtonFox(), ButtonBox.Button.kMiddleSwitch.value)
|
||||
.whileHeld(new RunCommand(() -> System.out.println("MiddleSwitch")));
|
||||
// new JoystickButton(getButtonFox(), ButtonBox.Button.kMiddleSwitch.value)
|
||||
// .whileHeld(new RunCommand(() -> System.out.println("MiddleSwitch")));
|
||||
|
||||
new JoystickButton(getButtonFox(), ButtonBox.Button.kRightSwitch.value)
|
||||
.whileHeld(new RunCommand(() -> System.out.println("RightSwitch")));
|
||||
@@ -314,13 +313,18 @@ public class RobotContainer {
|
||||
.whileHeld(new RunCommand(() -> System.out.println("RightButton")));
|
||||
}
|
||||
|
||||
public void configureManualButtonBindings()
|
||||
{
|
||||
public void configureManualButtonBindings() {
|
||||
|
||||
new JoystickButton(getButtonFox(), ButtonBox.Button.kMiddleSwitch.value)
|
||||
.whileHeld(new RunCommand(() -> System.out.println("Deez Nuts")));
|
||||
|
||||
new JoystickButton(getButtonFox(), ButtonBox.Button.kRightSwitch.value)
|
||||
.whileHeld(new RunCommand(() -> System.out.println("Inna mouth")));
|
||||
.whileHeld(new RunCommand(() -> System.out.println("MANUAL")));
|
||||
|
||||
}
|
||||
|
||||
public void configureAutomaticButtonBindings() {
|
||||
|
||||
new JoystickButton(getButtonFox(), ButtonBox.Button.kMiddleSwitch.value)
|
||||
.whileHeld(new RunCommand(() -> System.out.println("AUTOMATIC")));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -363,6 +367,10 @@ public class RobotContainer {
|
||||
return m_buttonFox;
|
||||
}
|
||||
|
||||
public void setManual(boolean set) {
|
||||
this.manual = set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get odometry.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user