Trajectory Following in Command Based Programming

Our team finally figured out how to successfully implement trajectory following. Now we’re wondering if it’s easy to integrate into the command based programming structure.

We have a drive subsystem, but following the WPILIB tutorial resulted in much of the trajectory following code being added to the Robot Container file. We’re thinking that part of the coding goes into the subsystem, perhaps as an added drive method or collection of methods and the Ramsete Command goes into individual commands for each trajectory.

Have any of you implemented trajectory following in this manner?

Thanks in advance.

Essentially, you move the construction of the Trajectory, RamseteCommand, etc into a Command. For instance, you can see a simple one in our code from last year:

Not our prettiest code, but it does not have too much extra complication, so should be understandable. There are also some more complicated examples in there, including running two Trajectories, back to back (see e.g. NewEightBallSim)
1 Like

I am a pretty firm believer that all of the generic ramsete command creation should be done in the drive subsystem. Everything that is not specific to this command. Here is our implementation of the same thing.


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.