-
Notifications
You must be signed in to change notification settings - Fork 0
Presentation mode #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
b515ca1
cda5c9a
83e72b6
2261a8c
20a8b0c
6bbc97e
0a406d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package org.rivierarobotics.commands; | ||
|
|
||
| import org.rivierarobotics.robot.Robot; | ||
| import org.rivierarobotics.subsystems.Arm; | ||
| import org.rivierarobotics.subsystems.Clamp; | ||
| import org.rivierarobotics.subsystems.DriveTrain; | ||
| import org.rivierarobotics.subsystems.Floppies; | ||
|
|
||
| import edu.wpi.first.wpilibj.command.Command; | ||
|
|
||
| public class DisableAllSubsystems extends Command { | ||
|
|
||
| private final DriveTrain dt = Robot.runningRobot.driveTrain; | ||
| private final Arm arm = Robot.runningRobot.arm; | ||
| private final Clamp clamp = Robot.runningRobot.clamp; | ||
| private final Floppies floppies = Robot.runningRobot.floppies; | ||
| private final boolean open = clamp.isOpen(); | ||
|
|
||
| public DisableAllSubsystems() { | ||
| requires(dt); | ||
| requires(arm); | ||
| requires(clamp); | ||
| requires(floppies); | ||
| setInterruptible(false); | ||
| } | ||
|
|
||
| @Override | ||
| protected void execute() { | ||
| dt.setPowerLeftRight(0, 0); | ||
| arm.setPower(0); | ||
| clamp.setOpen(open); | ||
| clamp.setPuncher(false); | ||
| floppies.setPower(0, 0); | ||
| } | ||
|
|
||
| @Override | ||
| protected boolean isFinished() { | ||
| return false; | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,4 +55,6 @@ public class ControlMap { | |
| public static final int FORCE_COMPRESSOR_ON_BUTTON = 2; | ||
|
|
||
| public static final int AUTO_PUNCH_BUTTON = 2; | ||
|
|
||
| public static final int DEAD_MAN_BUTTON = 1; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this tabbed? please remove |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package org.rivierarobotics.constants; | ||
|
|
||
| import edu.wpi.first.wpilibj.Preferences; | ||
|
|
||
| public class PresentationMode { | ||
|
|
||
| public static boolean inPresentationMode() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also tabbed |
||
| return Preferences.getInstance().getBoolean("presentation-mode", false); | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| import org.rivierarobotics.commands.AutoThrow; | ||
| import org.rivierarobotics.commands.CollectGrabRaise; | ||
| import org.rivierarobotics.commands.CompressorControlCommand; | ||
| import org.rivierarobotics.commands.DisableAllSubsystems; | ||
| import org.rivierarobotics.commands.LeaveClimbCommand; | ||
| import org.rivierarobotics.commands.MagicSpin; | ||
| import org.rivierarobotics.commands.SetArmAngleGainScheduled; | ||
|
|
@@ -32,6 +33,8 @@ public class Driver { | |
| public Joystick JS_LEFT_BUTTONS; | ||
| public Joystick JS_RIGHT_BUTTONS; | ||
| public DriveCalculator DRIVE_CALC; | ||
|
|
||
| private DisableAllSubsystems robotStopper; | ||
|
|
||
| public Driver() { | ||
| // Instantiate Sticks | ||
|
|
@@ -65,6 +68,8 @@ public Driver() { | |
|
|
||
| JoystickButton autoCollectButton = new JoystickButton(JS_FLOPPIES, ControlMap.COLLECT_SEQUENCE_BUTTON); | ||
| JoystickButton autoPunch = new JoystickButton(JS_FLOPPIES, ControlMap.AUTO_PUNCH_BUTTON); | ||
|
|
||
| JoystickButton deadManButton = new JoystickButton(JS_RIGHT_BUTTONS, ControlMap.DEAD_MAN_BUTTON); | ||
|
|
||
|
|
||
| // Bind Commands | ||
|
|
@@ -82,14 +87,20 @@ public Driver() { | |
| shiftHigh.whenPressed(new ShiftGear(DriveTrain.DriveGear.GEAR_HIGH)); | ||
| //autoCollectButton.whenPressed(new CollectGrabRaise(true)); | ||
|
|
||
| // remove climb for adams school | ||
| /* | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why isn't this just in an if(PresentationMode.inPresentationMode)? that's why i made it |
||
| removeArmLimitButton.whenPressed(new RemoveArmLimit(JS_ARM));//engage PTO + disengage arm | ||
| startWinchingButton.whenPressed(new StartWinching(JS_ARM)); | ||
| reengageArmButton.whenPressed(new SetArmEngagedAndPTODisengaged(true));//reengage + lower arm, winching at same time | ||
| disengageArmButton.whenPressed(new SetArmEngagedAndPTODisengaged(false));//disengage arm when it hits bottom | ||
| lockWinchButton.whenPressed(new SetArmBrake(true));//lock robot in place after climb | ||
| unlockWinchButton.whenPressed(new SetArmBrake(false));//for the pits | ||
| leaveClimbButton.whenPressed(new LeaveClimbCommand());//for crisis mode | ||
|
|
||
| */ | ||
| autoPunch.whenPressed(new AutoPunch(-0.2)); | ||
|
|
||
| robotStopper = new DisableAllSubsystems(); | ||
| deadManButton.whenReleased(robotStopper); | ||
| deadManButton.cancelWhenPressed(robotStopper); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this the state at the start of the robot? why do you set it to this and not some specific state?