|
libstp
Robotics library for Botball
|
#include <linear_motion.hpp>
Public Member Functions | |
| LinearMotion (MotionContext ctx, LinearMotionConfig config) | |
| void | start () override |
| void | update (double dt) override |
| bool | isFinished () const override |
| void | startWarm (double position_offset_m, double initial_velocity_mps) |
| void | setSuppressHardStopOnComplete (bool suppress) |
| bool | hasReachedDistance () const |
| double | getFilteredVelocity () const |
| const std::vector< LinearMotionTelemetry > & | getTelemetry () const |
| void | setOmegaOverride (double omega) |
| void | clearOmegaOverride () |
| Public Member Functions inherited from libstp::motion::Motion | |
| Motion (MotionContext ctx) | |
| virtual | ~Motion ()=default |
Additional Inherited Members | |
| Protected Member Functions inherited from libstp::motion::Motion | |
| drive::Drive & | drive () |
| const drive::Drive & | drive () const |
| odometry::IOdometry & | odometry () |
| const odometry::IOdometry & | odometry () const |
| Protected Attributes inherited from libstp::motion::Motion | |
| MotionContext | ctx_ |
| bool | started_ {false} |
Closed-loop straight-line controller for forward/backward or lateral motion.
The controller follows a trapezoidal profile on the selected primary axis while correcting heading error and cross-track drift.
Definition at line 89 of file linear_motion.hpp.
| libstp::motion::LinearMotion::LinearMotion | ( | MotionContext | ctx, |
| LinearMotionConfig | config ) |
|
inline |
Definition at line 125 of file linear_motion.hpp.
|
inlinenodiscard |
Current filtered velocity along the primary axis (m/s).
Definition at line 117 of file linear_motion.hpp.
|
inlinenodiscard |
Telemetry samples appended on each update cycle.
Definition at line 120 of file linear_motion.hpp.
|
nodiscard |
Check if target distance is reached, ignoring velocity settling.
|
nodiscardoverridevirtual |
Return true once the primitive has met its completion criteria.
Implements libstp::motion::Motion.
|
inline |
Override the internal heading PID with an external omega value. Set each cycle before calling update(). Persists until cleared.
Definition at line 124 of file linear_motion.hpp.
|
inline |
When true, complete() sets finished_ without calling hardStop().
Definition at line 111 of file linear_motion.hpp.
|
overridevirtual |
Capture initial state and prepare controller internals.
Implements libstp::motion::Motion.
| void libstp::motion::LinearMotion::startWarm | ( | double | position_offset_m, |
| double | initial_velocity_mps ) |
Begin motion from current state without resetting odometry.
Used by smooth_path() to carry velocity across segment boundaries. The profiled PID starts at position 0 with the given initial velocity, and odometry reads are offset so the segment measures from its start point.
| position_offset_m | Current primary-axis odometry position (subtracted from reads) |
| initial_velocity_mps | Current velocity to seed the profile with |
|
overridevirtual |
Advance the controller by one iteration using the loop delta in seconds.
Implements libstp::motion::Motion.