-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/main/java/org/frc5687/powerup/robot/commands/TestCarriage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/org/frc5687/powerup/robot/commands/TestCarriageMotor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
|