diff --git a/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/FactoryButton.java b/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/FactoryButton.java index 206256a3..f4a57778 100644 --- a/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/FactoryButton.java +++ b/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/FactoryButton.java @@ -6,6 +6,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.usfirst.frc.team449.robot.components.MappedJoystick; +import org.usfirst.frc.team449.robot.components.MappedSmoothedThrottle; +import org.usfirst.frc.team449.robot.components.MappedThrottle; /** * A factory for constructing a button.. @@ -42,7 +44,7 @@ public static FactoryButton constructButton(@NotNull @JsonProperty(required = tr @Nullable Double triggerAt, @Nullable Integer angle) { if (triggerAxis != null) { - return new TriggerButton(joystick, triggerAxis, triggerAt); + return new TriggerButton(new MappedThrottle(joystick, triggerAxis, false), triggerAt); } else if (angle != null) { return new dPadButton(joystick, angle); } else { diff --git a/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/FactoryJoystickButton.java b/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/FactoryJoystickButton.java index 2a798a46..45e07bd9 100644 --- a/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/FactoryJoystickButton.java +++ b/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/FactoryJoystickButton.java @@ -23,19 +23,19 @@ public class FactoryJoystickButton extends FactoryButton { /** * The port of the button on the joystick. */ - private final int buttonNum; + private final int buttonNumber; /** * Default constructor. * * @param joystick The joystick the button is on. - * @param buttonNum The port of the button. Note that button numbers begin at 1, not 0. + * @param buttonNumber The port of the button. Note that button numbers begin at 1, not 0. */ @JsonCreator public FactoryJoystickButton(@NotNull @JsonProperty(required = true) MappedJoystick joystick, - @JsonProperty(required = true) int buttonNum) { + @JsonProperty(required = true) int buttonNumber) { this.joystick = joystick; - this.buttonNum = buttonNum; + this.buttonNumber = buttonNumber; } /** @@ -45,6 +45,6 @@ public FactoryJoystickButton(@NotNull @JsonProperty(required = true) MappedJoyst */ @Override public boolean get() { - return joystick.getRawButton(buttonNum); + return joystick.getRawButton(buttonNumber); } } diff --git a/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/TriggerButton.java b/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/TriggerButton.java index 84e5741c..69557074 100644 --- a/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/TriggerButton.java +++ b/RoboRIO/src/main/java/org/usfirst/frc/team449/robot/oi/buttons/TriggerButton.java @@ -1,11 +1,10 @@ package org.usfirst.frc.team449.robot.oi.buttons; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.ObjectIdGenerators; import org.jetbrains.annotations.NotNull; -import org.usfirst.frc.team449.robot.components.MappedJoystick; -import org.usfirst.frc.team449.robot.components.MappedSmoothedThrottle; import org.usfirst.frc.team449.robot.components.MappedThrottle; /** @@ -28,14 +27,13 @@ public class TriggerButton extends FactoryButton { /** * Argument-based constructor. * - * @param joystick The the joystick containing the throttle. - * @param axis The axis of the throttle. + * @param throttle The relevant throttle. * @param triggerAt The percentage pressed to trigger at, from (0, 1] */ - public TriggerButton(@NotNull @JsonProperty(required = true) MappedJoystick joystick, - @JsonProperty(required = true) int axis, + @JsonCreator + public TriggerButton(@NotNull @JsonProperty(required = true) MappedThrottle throttle, @JsonProperty(required = true) double triggerAt) { - throttle = new MappedSmoothedThrottle(joystick, axis, 0, 0, false); + this.throttle = throttle; this.triggerAt = triggerAt; } diff --git a/RoboRIO/src/main/resources/calcifer_map.yml b/RoboRIO/src/main/resources/calcifer_map.yml index 82bab412..1e10d4bf 100644 --- a/RoboRIO/src/main/resources/calcifer_map.yml +++ b/RoboRIO/src/main/resources/calcifer_map.yml @@ -419,7 +419,7 @@ nonMPAutoCommand: drive buttons: - button: - org.usfirst.frc.team449.robot.oi.buttons.dPadButton: + org.usfirst.frc.team449.robot.oi.buttons.dPadButton: '@id': switchToLowButton joystick: '@id': gunnerGamepad @@ -433,7 +433,7 @@ buttons: drive action: WHEN_PRESSED - button: - org.usfirst.frc.team449.robot.oi.buttons.dPadButton: + org.usfirst.frc.team449.robot.oi.buttons.dPadButton: '@id': switchToHighButton joystick: gunnerGamepad @@ -446,7 +446,7 @@ buttons: drive action: WHEN_PRESSED - button: - org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: + org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: '@id': overrideNavXButton joystick: gunnerGamepad @@ -460,7 +460,7 @@ buttons: drive action: WHEN_PRESSED - button: - org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: + org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: overrideNavXButton command: org.usfirst.frc.team449.robot.interfaces.subsystem.NavX.commands.OverrideNavX: @@ -471,7 +471,7 @@ buttons: drive action: WHEN_RELEASED - button: - org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: + org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: '@id': jiggleRobotButton joystick: gunnerGamepad @@ -491,11 +491,14 @@ buttons: drive action: WHEN_PRESSED - button: - org.usfirst.frc.team449.robot.oi.buttons.TriggerButton: + org.usfirst.frc.team449.robot.oi.buttons.TriggerButton: '@id': climbButton - joystick: - driverGamepad - triggerAxis: 2 + throttle: + org.usfirst.frc.team449.robot.components.MappedThrottle: + '@id': climbButtonThrottle + stick: + driverGamepad + axis: 2 triggerAt: 0.9 command: org.usfirst.frc.team449.robot.mechanism.climber.commands.RunMotorWhileConditonMet: @@ -505,7 +508,7 @@ buttons: climber action: WHEN_PRESSED - button: - org.usfirst.frc.team449.robot.oi.buttons.TriggerButton: + org.usfirst.frc.team449.robot.oi.buttons.TriggerButton: climbButton command: org.usfirst.frc.team449.robot.interfaces.subsystem.binaryMotor.commands.TurnMotorOffWithRequires: @@ -515,7 +518,7 @@ buttons: climber action: WHEN_RELEASED - button: - org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: + org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: '@id': manualClimbButton joystick: gunnerGamepad @@ -528,14 +531,14 @@ buttons: climber action: WHEN_PRESSED - button: - org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: + org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: manualClimbButton command: org.usfirst.frc.team449.robot.interfaces.subsystem.binaryMotor.commands.TurnMotorOffWithRequires: stopClimbCommand action: WHEN_RELEASED - button: - org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: + org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: '@id': switchCameraButton joystick: gunnerGamepad @@ -548,11 +551,14 @@ buttons: cameras action: WHEN_PRESSED - button: - org.usfirst.frc.team449.robot.oi.buttons.TriggerButton: + org.usfirst.frc.team449.robot.oi.buttons.TriggerButton: '@id': pushGearButton - joystick: - driverGamepad - triggerAxis: 3 + throttle: + org.usfirst.frc.team449.robot.components.MappedThrottle: + '@id': pushGearThrottle + stick: + driverGamepad + axis: 3 triggerAt: 0.9 command: org.usfirst.frc.team449.robot.interfaces.subsystem.solenoid.commands.SolenoidReverse: @@ -560,7 +566,7 @@ buttons: '@id': openGearHandlerCommand action: WHEN_PRESSED - button: - org.usfirst.frc.team449.robot.oi.buttons.TriggerButton: + org.usfirst.frc.team449.robot.oi.buttons.TriggerButton: pushGearButton command: org.usfirst.frc.team449.robot.interfaces.subsystem.solenoid.commands.SolenoidForward: @@ -570,7 +576,7 @@ buttons: gearHandler action: WHEN_RELEASED # - button: -# org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: +# org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: # '@id': fireShooterButton # joystick: # gunnerGamepad @@ -583,11 +589,14 @@ buttons: # shooter # action: WHEN_PRESSED # - button: -# org.usfirstfirst.frc.team449.robot.oi.buttons.TriggerButton: +# org.usfirstfirst.frc.team449.robot.oi.buttons.TriggerButton: # '@id': rackShooterButton -# joystick: -# gunnerGamepad -# triggerAxis: 3 +# throttle: +# '@id': rackShooterThrottle +# org.usfirst.frc.team449.robot.components.MappedThrottle: +# stick: +# gunnerGamepad +# axis: 3 # triggerAt: 0.9 # command: # org.usfirst.frc.team449.robot.mechanism.topcommands.shooter.RackShooter: @@ -597,7 +606,7 @@ buttons: # shooter # action: WHEN_PRESSED # - button: -# org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: +# org.usfirst.frc.team449.robot.oi.buttons.FactoryJoystickButton: # '@id': resetShooterButton # joystick: # gunnerGamepad