Skip to content

Commit

Permalink
Merge branch 'Carriage/#201' into All/#305-SelfTestFramework
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMightyWarPig committed Apr 17, 2018
2 parents f917799 + b2ab3f9 commit 4140b1a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/org/frc5687/powerup/robot/commands/TestCarriage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.frc5687.powerup.robot.commands;

import edu.wpi.first.wpilibj.command.CommandGroup;
import org.frc5687.powerup.robot.Constants;
import org.frc5687.powerup.robot.Robot;
import org.frc5687.powerup.robot.commands.auto.AutoZeroCarriage;

public class TestCarriage extends CommandGroup {
public TestCarriage(Robot robot){
addSequential(new TestCarriageMotor(robot.getCarriage()));
addSequential(new AutoZeroCarriage(robot.getCarriage()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.frc5687.powerup.robot.commands;

import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.command.CommandGroup;
import org.frc5687.powerup.robot.subsystems.Carriage;


public class TestCarriageMotor extends Command {
private Carriage carriage;
private long upMillis;
public long downMillis;
public TestCarriageMotor(Carriage carriage) {
requires(carriage);
}

@Override
protected void initialize() {
upMillis = System.currentTimeMillis() + 250;
downMillis = System.currentTimeMillis() + 500;
}

@Override
protected void execute() {
if(System.currentTimeMillis() < upMillis){
carriage.drive(1);
}
else {
carriage.drive(-1);
}
}

@Override
protected boolean isFinished() {
return System.currentTimeMillis()> downMillis;
}
}

0 comments on commit 4140b1a

Please sign in to comment.