TrapezoidProfile

A trapezoidal motion profile generator.

A trapezoidal motion profile is a velocity profile that accelerates at a constant rate, maintains a constant velocity, then decelerates at a constant rate. This creates a trapezoid shape when velocity is plotted over time.

The profile handles truncated motion profiles (with nonzero initial or final velocity) and profiles that never reach maximum velocity (triangular profiles).

Parameters

constraints

The TrapezoidProfileConstraints that define the maximum velocity and acceleration for the profile.

Constructors

Link copied to clipboard
constructor(constraints: TrapezoidProfileConstraints<U>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The total time required to complete the motion profile.

Functions

Link copied to clipboard
fun calculate(timestamp: ComparableTimeMark = TimeSource.Monotonic.markNow(), current: MotionState<U>, goal: MotionState<U>): MotionState<U>

Calculates the state of the profile at a given timestamp.

fun calculate(t: Duration, current: MotionState<U>, goal: MotionState<U>): MotionState<U>

Calculates the state of the profile at a given time.

Link copied to clipboard

Checks if the profile has finished at the given time.

Checks if the profile has finished at the given timestamp.

Link copied to clipboard
fun reset()

Resets the profile, clearing the start timestamp.

Link copied to clipboard

Calculates the time remaining until the profile reaches a target position.