Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "org.rivierarobotics.frcgrantle" version "0.1.8"
id "org.rivierarobotics.frcgrantle" version "0.1.10"
}
grantle.with {
packageBase = 'org.rivierarobotics.robot'
Expand Down
41 changes: 41 additions & 0 deletions src/org/rivierarobotics/commands/DisableAllSubsystems.java
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();

Copy link
Copy Markdown
Member

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?


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;
}

}
2 changes: 2 additions & 0 deletions src/org/rivierarobotics/constants/ControlMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this tabbed? please remove

}
11 changes: 11 additions & 0 deletions src/org/rivierarobotics/constants/PresentationMode.java
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() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also tabbed

return Preferences.getInstance().getBoolean("presentation-mode", false);
}

}
13 changes: 12 additions & 1 deletion src/org/rivierarobotics/driverinterface/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -82,14 +87,20 @@ public Driver() {
shiftHigh.whenPressed(new ShiftGear(DriveTrain.DriveGear.GEAR_HIGH));
//autoCollectButton.whenPressed(new CollectGrabRaise(true));

// remove climb for adams school
/*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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);
}
}