mirror of
https://github.com/Team4388/2022NoWayHome.git
synced 2026-06-09 00:38:05 -06:00
Button Box Broken
This commit is contained in:
@@ -96,6 +96,9 @@
|
|||||||
{
|
{
|
||||||
"guid": "78696e70757401000000000000000000",
|
"guid": "78696e70757401000000000000000000",
|
||||||
"useGamepad": true
|
"useGamepad": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"guid": "03000000c01600008704000000000000"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
"/FMSInfo": "FMSInfo",
|
"/FMSInfo": "FMSInfo",
|
||||||
"/LiveWindow/BoomBoom": "Subsystem",
|
"/LiveWindow/BoomBoom": "Subsystem",
|
||||||
"/LiveWindow/Climber": "Subsystem",
|
"/LiveWindow/Climber": "Subsystem",
|
||||||
|
"/LiveWindow/Extender": "Subsystem",
|
||||||
"/LiveWindow/Hood": "Subsystem",
|
"/LiveWindow/Hood": "Subsystem",
|
||||||
"/LiveWindow/Intake": "Subsystem",
|
"/LiveWindow/Intake": "Subsystem",
|
||||||
"/LiveWindow/LED": "Subsystem",
|
"/LiveWindow/LED": "Subsystem",
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ public final class Constants {
|
|||||||
public static final class OIConstants {
|
public static final class OIConstants {
|
||||||
public static final int XBOX_DRIVER_ID = 0;
|
public static final int XBOX_DRIVER_ID = 0;
|
||||||
public static final int XBOX_OPERATOR_ID = 1;
|
public static final int XBOX_OPERATOR_ID = 1;
|
||||||
|
public static final int BUTTON_FOX_ID = 2;
|
||||||
public static final double LEFT_AXIS_DEADBAND = 0.1;
|
public static final double LEFT_AXIS_DEADBAND = 0.1;
|
||||||
public static final double RIGHT_AXIS_DEADBAND = 0.6;
|
public static final double RIGHT_AXIS_DEADBAND = 0.6;
|
||||||
public static final boolean SKEW_STICKS = true;
|
public static final boolean SKEW_STICKS = true;
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ import frc4388.utility.ListeningSendableChooser;
|
|||||||
import frc4388.utility.PathPlannerUtil;
|
import frc4388.utility.PathPlannerUtil;
|
||||||
import frc4388.utility.Vector2D;
|
import frc4388.utility.Vector2D;
|
||||||
import frc4388.utility.PathPlannerUtil.Path.Waypoint;
|
import frc4388.utility.PathPlannerUtil.Path.Waypoint;
|
||||||
|
import frc4388.utility.controller.ButtonBox;
|
||||||
import frc4388.utility.controller.DeadbandedXboxController;
|
import frc4388.utility.controller.DeadbandedXboxController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,6 +116,7 @@ public class RobotContainer {
|
|||||||
/* Controllers */
|
/* Controllers */
|
||||||
private final XboxController m_driverXbox = new DeadbandedXboxController(OIConstants.XBOX_DRIVER_ID);
|
private final XboxController m_driverXbox = new DeadbandedXboxController(OIConstants.XBOX_DRIVER_ID);
|
||||||
private final XboxController m_operatorXbox = new DeadbandedXboxController(OIConstants.XBOX_OPERATOR_ID);
|
private final XboxController m_operatorXbox = new DeadbandedXboxController(OIConstants.XBOX_OPERATOR_ID);
|
||||||
|
private final ButtonBox m_buttonFox = new ButtonBox(OIConstants.BUTTON_FOX_ID);
|
||||||
|
|
||||||
/* Autonomous */
|
/* Autonomous */
|
||||||
private PathPlannerTrajectory loadedPathTrajectory = null;
|
private PathPlannerTrajectory loadedPathTrajectory = null;
|
||||||
@@ -221,6 +223,11 @@ public class RobotContainer {
|
|||||||
// .whenPressed(() -> m_robotMap.leftBack.reset())
|
// .whenPressed(() -> m_robotMap.leftBack.reset())
|
||||||
// .whenPressed(() -> m_robotMap.rightBack.reset());
|
// .whenPressed(() -> m_robotMap.rightBack.reset());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Operator Buttons */
|
/* Operator Buttons */
|
||||||
|
|
||||||
// X > Extend Intake
|
// X > Extend Intake
|
||||||
@@ -263,6 +270,7 @@ public class RobotContainer {
|
|||||||
new JoystickButton(getOperatorController(), XboxController.Button.kA.value)
|
new JoystickButton(getOperatorController(), XboxController.Button.kA.value)
|
||||||
.whileHeld(new RunCommand(() -> m_robotExtender.runExtender(1.0), m_robotExtender))
|
.whileHeld(new RunCommand(() -> m_robotExtender.runExtender(1.0), m_robotExtender))
|
||||||
.whenReleased(new RunCommand(() -> m_robotExtender.runExtender(0.0), m_robotExtender));
|
.whenReleased(new RunCommand(() -> m_robotExtender.runExtender(0.0), m_robotExtender));
|
||||||
|
|
||||||
new JoystickButton(getOperatorController(), XboxController.Button.kB.value)
|
new JoystickButton(getOperatorController(), XboxController.Button.kB.value)
|
||||||
.whileHeld(new RunCommand(() -> m_robotExtender.runExtender(-1.0), m_robotExtender))
|
.whileHeld(new RunCommand(() -> m_robotExtender.runExtender(-1.0), m_robotExtender))
|
||||||
.whenReleased(new RunCommand(() -> m_robotExtender.runExtender(0.0), m_robotExtender));
|
.whenReleased(new RunCommand(() -> m_robotExtender.runExtender(0.0), m_robotExtender));
|
||||||
@@ -283,6 +291,36 @@ public class RobotContainer {
|
|||||||
//B > Shoot with Lime
|
//B > Shoot with Lime
|
||||||
// new JoystickButton(getOperatorController(), XboxController.Button.kB.value)
|
// new JoystickButton(getOperatorController(), XboxController.Button.kB.value)
|
||||||
// .whenPressed(new TrackTarget(m_robotTurret, m_robotBoomBoom, m_robotHood, m_robotSwerveDrive, m_robotVisionOdometry));
|
// .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()));
|
||||||
|
|
||||||
|
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")));
|
||||||
|
|
||||||
|
new JoystickButton(getButtonFox(), ButtonBox.Button.kLeftButton.value)
|
||||||
|
.whileHeld(new RunCommand(() -> System.out.println("LeftButton")));
|
||||||
|
|
||||||
|
new JoystickButton(getButtonFox(), ButtonBox.Button.kRightButton.value)
|
||||||
|
.whileHeld(new RunCommand(() -> System.out.println("RightButton")));
|
||||||
|
}
|
||||||
|
|
||||||
|
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")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -317,6 +355,14 @@ public class RobotContainer {
|
|||||||
return m_driverXbox;
|
return m_driverXbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XboxController getOperatorController() {
|
||||||
|
return m_operatorXbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ButtonBox getButtonFox() {
|
||||||
|
return m_buttonFox;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get odometry.
|
* Get odometry.
|
||||||
*
|
*
|
||||||
@@ -335,10 +381,6 @@ public class RobotContainer {
|
|||||||
m_robotSwerveDrive.resetOdometry(pose);
|
m_robotSwerveDrive.resetOdometry(pose);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XboxController getOperatorController() {
|
|
||||||
return m_operatorXbox;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a WatchKey for the path planner directory and registers it with the
|
* Creates a WatchKey for the path planner directory and registers it with the
|
||||||
* WatchService.
|
* WatchService.
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ public class RobotMap {
|
|||||||
// // hood subsystem
|
// // hood subsystem
|
||||||
// angleAdjusterMotor.restoreFactoryDefaults();
|
// angleAdjusterMotor.restoreFactoryDefaults();
|
||||||
// angleAdjusterMotor.setIdleMode(IdleMode.kBrake);
|
// angleAdjusterMotor.setIdleMode(IdleMode.kBrake);
|
||||||
|
// angleAdjusterMotor.setInverted(true);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package frc4388.utility.controller;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.GenericHID;
|
||||||
|
|
||||||
|
public class ButtonBox extends GenericHID {
|
||||||
|
public ButtonBox(int port) {
|
||||||
|
super(port);
|
||||||
|
}
|
||||||
|
public enum Button {
|
||||||
|
kRightSwitch(1),
|
||||||
|
kMiddleSwitch(2),
|
||||||
|
kLeftSwitch(3),
|
||||||
|
kRightButton(4),
|
||||||
|
kLeftButton(5);
|
||||||
|
|
||||||
|
@SuppressWarnings("MemberName")
|
||||||
|
public final int value;
|
||||||
|
|
||||||
|
Button(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user