libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::motion::LinearMotion Class Referencefinal

#include <linear_motion.hpp>

Inheritance diagram for libstp::motion::LinearMotion:
[legend]
Collaboration diagram for libstp::motion::LinearMotion:
[legend]

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}

Detailed Description

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.

Constructor & Destructor Documentation

◆ LinearMotion()

libstp::motion::LinearMotion::LinearMotion ( MotionContext ctx,
LinearMotionConfig config )

Member Function Documentation

◆ clearOmegaOverride()

void libstp::motion::LinearMotion::clearOmegaOverride ( )
inline

Definition at line 125 of file linear_motion.hpp.

◆ getFilteredVelocity()

double libstp::motion::LinearMotion::getFilteredVelocity ( ) const
inlinenodiscard

Current filtered velocity along the primary axis (m/s).

Definition at line 117 of file linear_motion.hpp.

◆ getTelemetry()

const std::vector< LinearMotionTelemetry > & libstp::motion::LinearMotion::getTelemetry ( ) const
inlinenodiscard

Telemetry samples appended on each update cycle.

Definition at line 120 of file linear_motion.hpp.

◆ hasReachedDistance()

bool libstp::motion::LinearMotion::hasReachedDistance ( ) const
nodiscard

Check if target distance is reached, ignoring velocity settling.

◆ isFinished()

bool libstp::motion::LinearMotion::isFinished ( ) const
nodiscardoverridevirtual

Return true once the primitive has met its completion criteria.

Implements libstp::motion::Motion.

◆ setOmegaOverride()

void libstp::motion::LinearMotion::setOmegaOverride ( double omega)
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.

◆ setSuppressHardStopOnComplete()

void libstp::motion::LinearMotion::setSuppressHardStopOnComplete ( bool suppress)
inline

When true, complete() sets finished_ without calling hardStop().

Definition at line 111 of file linear_motion.hpp.

◆ start()

void libstp::motion::LinearMotion::start ( )
overridevirtual

Capture initial state and prepare controller internals.

Implements libstp::motion::Motion.

◆ startWarm()

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.

Parameters
position_offset_mCurrent primary-axis odometry position (subtracted from reads)
initial_velocity_mpsCurrent velocity to seed the profile with

◆ update()

void libstp::motion::LinearMotion::update ( double dt)
overridevirtual

Advance the controller by one iteration using the loop delta in seconds.

Implements libstp::motion::Motion.


The documentation for this class was generated from the following file:
  • /home/runner/work/raccoon-lib/raccoon-lib/modules/libstp-motion/include/motion/linear_motion.hpp