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

Commit cc0d6d5

Browse files
committed
Make turning and moving without MoveTo track position, and fixed a
parenthesis.
1 parent 34a6e0e commit cc0d6d5

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class AutoMoveTo extends CommandGroup {
1616
public AutoMoveTo(String[] args) {
1717
//requires(Drivetrain);
1818
double rotation;
19-
double[] point;
19+
double[] point = new double[2];
2020
String parentheseless;
2121
String[] pointparts;
2222
for (String arg : args) {

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.ArrayList;
44

55
import org.usfirst.frc.team199.Robot2018.Robot;
6+
import org.usfirst.frc.team199.Robot2018.autonomous.AutoUtils;
67
import org.usfirst.frc.team199.Robot2018.autonomous.PIDSourceAverage;
78

89
import edu.wpi.first.wpilibj.command.CommandGroup;
@@ -21,15 +22,30 @@ public RunScript(String scriptName) {
2122
String cmdName = cmd[0];
2223
String cmdArgs = cmd[1];
2324

25+
double[] point = new double[2];
26+
double rotation = 0;
27+
String parentheseless;
28+
String[] pointparts;
29+
if (AutoUtils.isDouble(cmdArgs)) {
30+
rotation = Double.valueOf(cmdArgs);
31+
} else if (AutoUtils.isPoint(cmdArgs)) {
32+
parentheseless = cmdArgs.substring(1, cmdArgs.length() - 1);
33+
pointparts = parentheseless.split(",");
34+
point[0] = Double.parseDouble(pointparts[0]);
35+
}
36+
2437
switch (cmdName) {
2538
case "moveto":
2639
addSequential(new AutoMoveTo(cmdArgs.split(" ")));
2740
break;
2841
case "turn":
2942
addSequential(new PIDTurn(Double.parseDouble(cmdArgs), Robot.dt, Robot.dt.getGyro()));
43+
AutoUtils.setRot(rotation);
3044
break;
3145
case "move":
32-
addSequential(new PIDMove(Double.parseDouble(cmdArgs), Robot.dt, new PIDSourceAverage(null, null))));
46+
addSequential(new PIDMove(Double.parseDouble(cmdArgs), Robot.dt, new PIDSourceAverage(null, null)));
47+
AutoUtils.setX(point[0]);
48+
AutoUtils.setY(point[1]);
3349
break;
3450
case "switch":
3551
addSequential(new EjectToSwitch());

0 commit comments

Comments
 (0)