Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit 748d4a0

Browse files
committed
modify RunScript to use absolute values
1 parent 237bde6 commit 748d4a0

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

  • Robot2018/src/org/usfirst/frc/team199/Robot2018/commands

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/RunScript.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ public RunScript(String scriptName) {
2525
addSequential(new AutoMoveTo(cmdArgs.split(" ")));
2626
break;
2727
case "turn":
28-
double rotation = Double.parseDouble(cmdArgs);
29-
addSequential(new PIDTurn(rotation, Robot.dt, Robot.sd, Robot.dt.getGyro()));
30-
AutoUtils.position.setRot(rotation);
28+
if (AutoUtils.isPoint(cmdArgs)) {
29+
double[] point = AutoUtils.parsePoint(cmdArgs);
30+
addSequential(new PIDTurn(point, Robot.dt, Robot.sd, Robot.dt.getGyro()));
31+
} else {
32+
double rotation = Double.parseDouble(cmdArgs);
33+
addSequential(new PIDTurn(rotation, Robot.dt, Robot.sd, Robot.dt.getGyro()));
34+
}
3135
break;
3236
case "move":
3337
double distance = Double.parseDouble(cmdArgs);
34-
3538
addSequential(new PIDMove(distance, Robot.dt, Robot.sd, Robot.dt.getDistEncAvg()));
36-
AutoUtils.position.setX(distance * Math.sin(Math.toRadians(AutoUtils.position.getRot())));
37-
AutoUtils.position.setY(distance * Math.cos(Math.toRadians(AutoUtils.position.getRot())));
3839
break;
3940
case "switch":
4041
addSequential(new EjectToSwitch());

0 commit comments

Comments
 (0)