99import edu .wpi .first .wpilibj .command .CommandGroup ;
1010
1111/**
12- *
12+ * The AutoMoveTo command, which makes the robot go through a set of movements and rotations.
1313 */
1414public class AutoMoveTo extends CommandGroup {
1515
@@ -29,33 +29,17 @@ public AutoMoveTo(String[] args) {
2929 pointparts = parentheseless .split ("," );
3030 point [0 ] = Double .parseDouble (pointparts [0 ]);
3131 point [1 ] = Double .parseDouble (pointparts [1 ]);
32- addSequential (new PIDTurn (Math .toDegrees (Math .atan ((point [0 ] - AutoUtils .getX ())/(point [1 ] - AutoUtils .getY ())) - AutoUtils .getRot ()), Robot .dt , Robot .dt .getGyro ()));
33- addSequential (new PIDMove (Math .sqrt (((point [0 ] - AutoUtils .getX ()) * (point [0 ] - AutoUtils .getX ()) + ((point [1 ] - AutoUtils .getY ()) * (point [1 ] - AutoUtils .getY ())))), Robot .dt , new PIDSourceAverage (null , null )));
32+ addSequential (new PIDTurn (Math .toDegrees (Math .atan ((point [0 ] - AutoUtils .getX ())/(point [1 ] - AutoUtils .getY ())) - AutoUtils .getRot ()),
33+ Robot .dt , Robot .dt .getGyro ()));
34+ addSequential (new PIDMove (Math .sqrt (((point [0 ] - AutoUtils .getX ()) * (point [0 ] - AutoUtils .getX ()) +
35+ ((point [1 ] - AutoUtils .getY ()) * (point [1 ] - AutoUtils .getY ())))),
36+ Robot .dt , new PIDSourceAverage (null , null )));
3437 AutoUtils .setX (point [0 ]);
3538 AutoUtils .setY (point [1 ]);
3639 AutoUtils .setRot (Math .toDegrees (Math .atan ((point [0 ] - AutoUtils .getX ())/(point [1 ] - AutoUtils .getY ()))));
3740 } else {
3841 throw new IllegalArgumentException ();
3942 }
4043 }
41-
42-
43-
44- // Add Commands here:
45- // e.g. addSequential(new Command1());
46- // addSequential(new Command2());
47- // these will run in order.
48-
49- // To run multiple commands at the same time,
50- // use addParallel()
51- // e.g. addParallel(new Command1());
52- // addSequential(new Command2());
53- // Command1 and Command2 will run in parallel.
54-
55- // A command group will require all of the subsystems that each member
56- // would require.
57- // e.g. if Command1 requires chassis, and Command2 requires arm,
58- // a CommandGroup containing them would require both the chassis and the
59- // arm.
6044 }
6145}
0 commit comments