File tree Expand file tree Collapse file tree
Robot2019/src/main/java/frc/robot/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111import frc .robot .subsystems .Climber ;
1212import frc .robot .subsystems .Drivetrain ;
1313import edu .wpi .first .wpilibj .Joystick ;
14- import edu .wpi .first .wpilibj .Timer ;
1514
1615public class Climb extends Command {
1716 private Climber climber ;
1817 private Drivetrain dt ;
1918 private Joystick dtJoy ;
2019 private State state ;
21- private Timer timer ;
2220
2321 private final double backDrive = -0.5 ; // TODO: Set this to reasonable/tested value;
2422 private final double climbUp = 1 ;
2523 private final double climbDown = -1 ;
2624 private final double retract = -1 ;
2725 private final double overrideThreshold = 0.1 ; // TODO: Set this to reasonable/tested value;
2826 private final double retractGoal = 0 ; // TODO: Set this to reasonable/tested value;
29- private final double startTime = 2 ; // Time to lift off the floor. TODO: Set this to reasonable/tested value
27+ private final double offGroundHeight = 15 ; // TODO: Set this to reasonable/tested value;
3028
3129 public Climb (Climber climber , Drivetrain dt , Joystick joy ) {
3230 // Use requires() here to declare subsystem dependencies
3331 this .climber = climber ;
3432 this .dt = dt ;
35- timer = new Timer ();
3633 dtJoy = joy ;
3734 requires (climber );
3835 requires (dt );
@@ -107,7 +104,7 @@ protected void interrupted() {
107104 * overriding the climb
108105 */
109106 private boolean robotOnPlatform () {
110- return timer . get () > startTime && ( dt . isStalled () || Math .abs (dtJoy .getY ()) > overrideThreshold ) ;
107+ return ( dt . isStalled () && climber . getEncDistance () > offGroundHeight ) || Math .abs (dtJoy .getY ()) > overrideThreshold ;
111108 }
112109
113110 private enum State {
You can’t perform that action at this time.
0 commit comments