Advertisement
Guest User

RampExtend Command

a guest
Feb 18th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. package frc.robot.commands;
  2.  
  3. import edu.wpi.first.wpilibj.command.Command;
  4. import frc.robot.Robot;
  5.  
  6. public class RampExtend extends Command {
  7.  
  8.   private boolean finished = false;
  9.  
  10.   public RampExtend() {
  11.     // Use requires() here to declare subsystem dependencies
  12.     // eg. requires(chassis);
  13.     requires(Robot.m_rampmotor);
  14.   }
  15.  
  16.   // Called just before this Command runs the first time
  17.   @Override
  18.   protected void initialize() {
  19.     Robot.m_rampmotor.rampOn(1.0);
  20.   }
  21.  
  22.   // Called repeatedly when this Command is scheduled to run
  23.   @Override
  24.   protected void execute() {
  25.     if (!Robot.m_rampmotor.extendedSwitch.get()) {
  26.       finished = true;
  27.     }
  28.   }
  29.  
  30.   // Make this return true when this Command no longer needs to run execute()
  31.   @Override
  32.   protected boolean isFinished() {
  33.     return finished;
  34.   }
  35.  
  36.   // Called once after isFinished returns true
  37.   @Override
  38.   protected void end() {
  39.     Robot.m_rampmotor.rampOff();
  40.   }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement