Trajectories
Now it's time to combine paths with the motion profiles from earlier. Road Runner calls this composition a trajectory. Trajectories take time values and output the corresponding field frame kinematic state (i.e., real positions, velocities, and acceleration). This state can be transformed to the robot frame and fed directly into the feedforward component of the controller.
Here's a sample for planning a Trajectory
from a Path
:
As indicated by their names, the constraints limit translational velocity, angular velocity, and profile acceleration. It's common to replace the translational velocity constraint with a stronger constraint that limits wheel velocities. These constraints are named according to the drive types (e.g., MecanumVelocityConstraint
).
There is also a TrajectoryBuilder
class that replicates the API of PathBuilder
with a few additions.
Once a trajectory is finally generated, one of the TrajectoryFollowers
can be used to generate the actual DriveSignals
that are sent to the Drive
class. The PIDVA followers are usually suitable, although RamseteFollower
has noticeably better performance for tank drives.
Following a trajectory is as simple as creating a follower, calling TrajectoryFollower.followTrajectory()
, and repeatedly querying TrajectoryFollower.update()
:
Last updated