Skip to content

Commit c5c74b3

Browse files
authored
Give AutoFactory.trajectoryCmd() an actual routine that runs (#1110)
1 parent 05a54b9 commit c5c74b3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

choreolib/src/main/java/choreo/auto/AutoFactory.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,10 @@ <ST extends TrajectorySample<ST>> AutoTrajectory trajectory(
277277
* @return A new {@link AutoTrajectory}.
278278
*/
279279
public Command trajectoryCmd(String trajectoryName) {
280-
return trajectory(trajectoryName, voidRoutine).cmd();
280+
AutoRoutine routine = newRoutine("Routine");
281+
AutoTrajectory trajectory = routine.trajectory(trajectoryName);
282+
routine.active().onTrue(trajectory.cmd());
283+
return routine.cmd().until(trajectory.done());
281284
}
282285

283286
/**
@@ -296,7 +299,10 @@ public Command trajectoryCmd(String trajectoryName) {
296299
* @return A new {@link AutoTrajectory}.
297300
*/
298301
public Command trajectoryCmd(String trajectoryName, final int splitIndex) {
299-
return trajectory(trajectoryName, splitIndex, voidRoutine).cmd();
302+
AutoRoutine routine = newRoutine("Routine");
303+
AutoTrajectory trajectory = routine.trajectory(trajectoryName, splitIndex);
304+
routine.active().onTrue(trajectory.cmd());
305+
return routine.cmd().until(trajectory.done());
300306
}
301307

302308
/**

0 commit comments

Comments
 (0)