core / com.acmerobotics.roadrunner.profile / MotionProfileGenerator


object MotionProfileGenerator (source)

Motion profile generator with arbitrary start and end motion states and either dynamic constraints or jerk limiting.



Generates a motion profile with dynamic maximum velocity and acceleration. Uses the algorithm described in section 3.2 of Sprunk2008.pdf. Warning: Profiles may be generated incorrectly if the endpoint velocity/acceleration values preclude the obedience of the motion constraints. To protect against this, verify the continuity of the generated profile or keep the start and goal velocities at 0.

fun generateMotionProfile(start: MotionState, goal: MotionState, velocityConstraint: VelocityConstraint, accelerationConstraint: AccelerationConstraint, resolution: Double = 0.25): MotionProfile


Generates a simple motion profile with constant maxVel, maxAccel, and maxJerk. If maxJerk is zero, an acceleration-limited profile will be generated instead of a jerk-limited one. If constraints can't be obeyed, there are two possible fallbacks: If overshoot is true, then two profiles will be concatenated (the first one overshoots the goal and the second one reverses back to reach the goal). Otherwise, the highest order constraint (e.g., max jerk for jerk-limited profiles) is repeatedly violated until the goal is achieved.

fun generateSimpleMotionProfile(start: MotionState, goal: MotionState, maxVel: Double, maxAccel: Double, maxJerk: Double = 0.0, overshoot: Boolean = false): MotionProfile