From 88320ba6778c42fdc6053cb5d546ccfbfff53760 Mon Sep 17 00:00:00 2001 From: Debajit Ghosh Date: Sun, 17 Mar 2024 22:15:09 -0700 Subject: [PATCH 1/3] separate debugoi controls for left and right climber. move shooter and intake to allow top rotary dials to control climber. --- .../java/com/team766/robot/reva/DebugOI.java | 57 +++++++++++++------ .../robot/reva/constants/InputConstants.java | 12 ++-- 2 files changed, 47 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/team766/robot/reva/DebugOI.java b/src/main/java/com/team766/robot/reva/DebugOI.java index b32107a95..dc0099e5d 100644 --- a/src/main/java/com/team766/robot/reva/DebugOI.java +++ b/src/main/java/com/team766/robot/reva/DebugOI.java @@ -27,10 +27,12 @@ * └───┴───┴───┴───┘ * * 1 + 8/12 = Control Shoulder + Nudge Up/Down - * 2 + 8/12 = Control Climber + Nudge Up/Down - * 4 + 8/12 = Control Shooter + Nudge Up/Down - * 3 = Intake In - * 7 = Intake Out + * 2 + 8/12 = Control Shooter + Nudge Up/Down + * 3 + 8/12 = Control Left Climber + Nudge Up/Down (BYPASSES SOFT LIMITS) + * 4 + 8/12 = Control Right Climber + Nudge Up/Down (BYPASSES SOFT LIMITS) + * 5 = Intake In + * 6 = Intake Out + * 16 = Resets climber relative encoders to 0. */ public class DebugOI extends OIFragment { private final JoystickReader macropad; @@ -40,7 +42,8 @@ public class DebugOI extends OIFragment { private final Intake intake; private final Shooter shooter; private final OICondition controlShoulder; - private final OICondition controlClimber; + private final OICondition controlLeftClimber; + private final OICondition controlRightClimber; private final OICondition controlShooter; private final OICondition intakeIn; private final OICondition intakeOut; @@ -59,8 +62,11 @@ public DebugOI( controlShoulder = new OICondition(() -> macropad.getButton(InputConstants.CONTROL_SHOULDER)); - controlClimber = new OICondition(() -> macropad.getButton(InputConstants.CONTROL_CLIMBER)); controlShooter = new OICondition(() -> macropad.getButton(InputConstants.CONTROL_SHOOTER)); + controlLeftClimber = + new OICondition(() -> macropad.getButton(InputConstants.CONTROL_LEFT_CLIMBER)); + controlRightClimber = + new OICondition(() -> macropad.getButton(InputConstants.CONTROL_RIGHT_CLIMBER)); intakeIn = new OICondition(() -> macropad.getButton(InputConstants.INTAKE_IN)); intakeOut = new OICondition(() -> macropad.getButton(InputConstants.INTAKE_OUT)); } @@ -79,8 +85,6 @@ protected void handleOI(Context context) { shoulder.nudgeUp(); } else if (macropad.getButtonPressed(InputConstants.NUDGE_DOWN)) { shoulder.nudgeDown(); - } else if (macropad.getButtonPressed(InputConstants.MACROPAD_RESET_SHOULDER)) { - shoulder.reset(); } } else if (controlShoulder.isFinishedTriggering()) { context.releaseOwnership(shoulder); @@ -88,28 +92,49 @@ protected void handleOI(Context context) { // fine-grained control of the climber // used for testing and tuning - // press down the climber control button and nudge the climber up and down - if (controlClimber.isTriggering()) { - if (controlClimber.isNewlyTriggering()) { + // press down the climber control buttons and nudge the climber up and down + // NOTE: this bypasses the soft limits - use with care + if (controlLeftClimber.isTriggering()) { + if (controlLeftClimber.isNewlyTriggering()) { context.takeOwnership(climber); climber.enableSoftLimits(false); } if (macropad.getButtonPressed(InputConstants.NUDGE_UP)) { climber.setLeftPower(0.25); - climber.setRightPower(0.25); } else if (macropad.getButtonPressed(InputConstants.NUDGE_DOWN)) { climber.setLeftPower(-0.25); - climber.setRightPower(-0.25); + } else if (macropad.getButtonReleased(InputConstants.NUDGE_UP) + || macropad.getButtonReleased(InputConstants.NUDGE_DOWN)) { + climber.stopLeft(); + } + } else if (controlLeftClimber.isFinishedTriggering()) { + climber.stopLeft(); + climber.enableSoftLimits(true); + context.releaseOwnership(climber); + } + + if (controlRightClimber.isTriggering()) { + if (controlRightClimber.isNewlyTriggering()) { + context.takeOwnership(climber); + climber.enableSoftLimits(false); } - } else if (controlClimber.isFinishedTriggering()) { - climber.stop(); + if (macropad.getButtonPressed(InputConstants.NUDGE_UP)) { + climber.setRightPower(0.25); + } else if (macropad.getButtonPressed(InputConstants.NUDGE_DOWN)) { + climber.setRightPower(-0.25); + } else if (macropad.getButtonReleased(InputConstants.NUDGE_UP) + || macropad.getButtonReleased(InputConstants.NUDGE_DOWN)) { + climber.stopRight(); + } + } else if (controlRightClimber.isFinishedTriggering()) { + climber.stopRight(); climber.enableSoftLimits(true); context.releaseOwnership(climber); } - if (macropad.getButtonPressed(16)) { + if (macropad.getButtonPressed(InputConstants.RESET_CLIMBER_ENCODERS)) { climber.resetLeftPosition(); climber.resetRightPosition(); } diff --git a/src/main/java/com/team766/robot/reva/constants/InputConstants.java b/src/main/java/com/team766/robot/reva/constants/InputConstants.java index dda790753..16a97a11b 100644 --- a/src/main/java/com/team766/robot/reva/constants/InputConstants.java +++ b/src/main/java/com/team766/robot/reva/constants/InputConstants.java @@ -14,17 +14,17 @@ public final class InputConstants { // Macropad buttons public static final int CONTROL_SHOULDER = 1; - public static final int CONTROL_CLIMBER = 2; - public static final int INTAKE_IN = 3; - public static final int CONTROL_SHOOTER = 4; - public static final int INTAKE_OUT = 7; + public static final int CONTROL_SHOOTER = 2; + public static final int CONTROL_LEFT_CLIMBER = 3; + public static final int CONTROL_RIGHT_CLIMBER = 4; + public static final int INTAKE_IN = 5; + public static final int INTAKE_OUT = 6; public static final int NUDGE_UP = 8; - public static final int MACROPAD_RESET_SHOULDER = 9; public static final int NUDGE_DOWN = 12; public static final int MACROPAD_PRESET_1 = 13; public static final int MACROPAD_PRESET_2 = 14; public static final int MACROPAD_PRESET_3 = 15; - public static final int MACROPAD_PRESET_4 = 16; + public static final int RESET_CLIMBER_ENCODERS = 16; // Xbox buttons // TODO: change From 54d470f94630627bc89bf2b95c3b6a608b32f1bf Mon Sep 17 00:00:00 2001 From: Debajit Ghosh Date: Sun, 17 Mar 2024 22:28:15 -0700 Subject: [PATCH 2/3] update OI docs --- docs/OperatorInterface.md | 40 ++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/docs/OperatorInterface.md b/docs/OperatorInterface.md index 7ffadfaef..9ee2bea55 100644 --- a/docs/OperatorInterface.md +++ b/docs/OperatorInterface.md @@ -35,12 +35,16 @@ TODO: consider this customization. Y-axis:Rotate counterclockwise/clockwise - Button 9: Reset gyro + Button 1 (Trigger): Target lock (hold to auto-aim at speaker, release to stop) Button 1 (Trigger): Fine driving
(slow down to 25%) Button 15: Reset position (odometry) - Button 3: Cross wheels + Button 3: Shoot note + + + Button 9: Reset gyro + NOTE: X-axis is up/down, Y-axis is sideways @@ -87,12 +91,10 @@ We use a wired Xbox Controller (the Logitech gamepad in Xbox mode also works for DPAD DOWN Nudge shoulder down. - RT Hold to spin shooter - LB Hold to run intake (in) @@ -100,6 +102,14 @@ We use a wired Xbox Controller (the Logitech gamepad in Xbox mode also works for RB Hold to run intake (out) + + + Left Stick + Control left climber (within soft limits) + + + Right Stick + Control right climber (within soft limits) @@ -124,36 +134,36 @@ TODO: put together page with instructions on how to flash the firmware. 1 Hold to control shoulder (with up/down or dials) - + 2 - Hold to control climber (with up/down or dials)
Work in progress. + Hold to run shooter. Can speed up and slow down (with up/down or dials). 3 - Hold to run intake (in) + Hold to control left climber (with up/down or dials). 4 - Hold to run shooter. Can speed up and slow down (with up/down or dials). + Hold to control right climber (with up/down or dials). - 7 + 5 + Hold to run intake (in) + + + 6 Hold to run intake (out). - 8 Moves mechanism being controlled (via another button) up. - 12 Moves mechanism being controlled (via another button) down. - - 9 - Reset relative encoders on shoulder. + 16 + Reset relative encoders on climber. - From 526794fcf595bd58f22f06a2913e0df3cb54fbed Mon Sep 17 00:00:00 2001 From: Debajit Ghosh Date: Sun, 17 Mar 2024 22:30:01 -0700 Subject: [PATCH 3/3] update docs. --- docs/OperatorInterface.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/OperatorInterface.md b/docs/OperatorInterface.md index 9ee2bea55..28048f414 100644 --- a/docs/OperatorInterface.md +++ b/docs/OperatorInterface.md @@ -140,11 +140,11 @@ TODO: put together page with instructions on how to flash the firmware. 3 - Hold to control left climber (with up/down or dials). + Hold to control left climber (with up/down or dials). Bypasses soft limits. 4 - Hold to control right climber (with up/down or dials). + Hold to control right climber (with up/down or dials). Bypasses soft limits. 5