A Deep Dive into WPILib Trajectories

WPILib has a new trajectory generator and followers, and lots of documentation on how to use them. Unfortunately, there aren’t any accessible resources on how everything works under the hood. My team and I used a similar trajectory solution last season (both are based on 254’s 2018 code) , so I thought I would take a whack at making a compelling, accessible introduction to this guts of this subject. This presentation goes in-depth enough to give you a high-level understanding of the important tradeoffs and inner workings of this trajectory generator, while still being at a level that is accessible to non-experts.

My animated slideshow, which runs a JavaScript port of the generator, can be found here.

A video of my presentation is embedded below (if you want to skip the history and context section, go to 6:26):

Not including questions at the end, the presentation is about 35 minutes.


I’m super excited about the upcoming changes to WPILib’s kinematic libraries, and look forward to testing this out this season! Is there a bit of documentation we can browse to understand how to use these new features? A lot of what is covered in the video above is very useful for understanding the ultimate behavior, but I’m not quite sure of where to get started.


There is documentation for the new kinematics, odometry, and trajectory generation classes. A complete tutorial for “zero to tracking trajectories” will be coming soon to the documentation website as well.

There is also a full example in the wpilib repository. That is available here: https://github.com/wpilibsuite/allwpilib/tree/master/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ramsetecommand


We recently got WPILib’s trajectory generator working with out 2019 robot, it’s been great! Thanks for throwing this together, we’ll definitely be using it to teach our programmers that it’s not just a magic black box.

1 Like

I’m working on “end-to-end” documentation for characterization-through-path-following - it’s next up on my plate right after I finish the new PIDController/motion profile/feedforward component docs (those are about 70% done). I’d say no more than two weeks until the PR is submitted to frc-docs; hopefully it doesn’t get held up in review for too long.


I, too, hope it will not :slight_smile:


I’ll give this thread a little pre-kickoff bump by linking a paper, Sprunk 2008, that goes over a lot of techniques used in the WPILib trajectory generator. If you like papers (and a little bit of math), this one gives some great context to the entire “trajectory generation” thing.


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