|
libstp
Robotics library for Botball
|
#include <trapezoidal_profile.hpp>
Classes | |
| struct | Constraints |
| struct | State |
Public Member Functions | |
| TrapezoidalProfile (const State &initial, double target, const Constraints &constraints) | |
| State | getSetpoint (double elapsed_time) const |
| bool | isComplete (double elapsed_time) const |
| double | getTotalTime () const |
Static Public Member Functions | |
| static State | calculate (double dt, const State ¤t, const State &goal, const Constraints &constraints) |
Generates a trapezoidal velocity profile for smooth motion.
The profile has three phases:
For short distances, the profile may be triangular (no cruise phase). Supports asymmetric acceleration/deceleration rates.
Definition at line 20 of file trapezoidal_profile.hpp.
|
inline |
Initialize the profile.
| initial | Initial state (usually {0, 0}) |
| target | Target position |
| constraints | Velocity and acceleration limits |
Definition at line 61 of file trapezoidal_profile.hpp.
|
inlinestatic |
Compute the next setpoint along a trapezoidal trajectory from current toward goal.
Analytical approach (ported from FRC WPILib TrapezoidProfile::Calculate): each call recomputes the full trapezoidal profile from current state to goal, then evaluates it at exactly t=dt. This is analytically exact – no discretisation overshoot regardless of timestep.
Supports asymmetric acceleration/deceleration rates.
| dt | Time step (seconds) |
| current | Current profiled state (position, velocity) |
| goal | Desired goal state (position, velocity) |
| constraints | Velocity and acceleration limits |
Definition at line 139 of file trapezoidal_profile.hpp.
|
inline |
Get the setpoint at a given time.
| elapsed_time | Time since profile started (seconds) |
Definition at line 82 of file trapezoidal_profile.hpp.
|
inline |
Get the total time for the profile.
Definition at line 242 of file trapezoidal_profile.hpp.
|
inline |
Check if the profile is complete.
Definition at line 234 of file trapezoidal_profile.hpp.