libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::foundation::ChassisControlContext Class Reference

#include <chassis_control_context.hpp>

Public Member Functions

void setSink (ChassisVelocitySink sink) noexcept
 Register the on-MCU chassis sink. Called once by the platform bundle.
bool hasSink () const noexcept
 True when an on-MCU chassis loop is registered.
bool command (double vx, double vy, double wz) const noexcept
 ChassisControlContext (const ChassisControlContext &)=delete
ChassisControlContext & operator= (const ChassisControlContext &)=delete
 ChassisControlContext (ChassisControlContext &&)=delete
ChassisControlContext & operator= (ChassisControlContext &&)=delete

Static Public Member Functions

static ChassisControlContext & instance ()
 Access the process-wide instance.

Detailed Description

Process-wide registry for the optional on-MCU chassis velocity loop.

The flag/sink lives in libstp-foundation (a single shared instance) so the drive layer (Drive::update) can forward the body-velocity command to the coprocessor WITHOUT taking a link-time dependency on any platform bundle — the platform bundle registers the sink at startup (e.g. wombat Platform::createOdometry → TransportWriter). Mirrors SpeedModeContext: instance() is defined out-of-line so the static lives in libfoundation.so and every module shares the same registry.

When a sink is registered (real hardware), the STM32 performs the inverse kinematics + per-motor velocity PID, so the Pi runs NO host-side IK or velocity control. With no sink (mock/sim), command() returns false and the Drive falls back to host-side control.

Definition at line 29 of file chassis_control_context.hpp.

Constructor & Destructor Documentation

◆ ChassisControlContext() [1/2]

libstp::foundation::ChassisControlContext::ChassisControlContext ( const ChassisControlContext & )
delete

◆ ChassisControlContext() [2/2]

libstp::foundation::ChassisControlContext::ChassisControlContext ( ChassisControlContext && )
delete

Member Function Documentation

◆ command()

bool libstp::foundation::ChassisControlContext::command ( double vx,
double vy,
double wz ) const
inlinenodiscardnoexcept

Forward a body-frame velocity command to the registered sink.

Returns
true if a sink handled it on-MCU; false if none is registered.

Definition at line 49 of file chassis_control_context.hpp.

◆ hasSink()

bool libstp::foundation::ChassisControlContext::hasSink ( ) const
inlinenodiscardnoexcept

True when an on-MCU chassis loop is registered.

Definition at line 42 of file chassis_control_context.hpp.

◆ instance()

ChassisControlContext & libstp::foundation::ChassisControlContext::instance ( )
static

Access the process-wide instance.

◆ operator=() [1/2]

ChassisControlContext & libstp::foundation::ChassisControlContext::operator= ( ChassisControlContext && )
delete

◆ operator=() [2/2]

ChassisControlContext & libstp::foundation::ChassisControlContext::operator= ( const ChassisControlContext & )
delete

◆ setSink()

void libstp::foundation::ChassisControlContext::setSink ( ChassisVelocitySink sink)
inlinenoexcept

Register the on-MCU chassis sink. Called once by the platform bundle.

Definition at line 36 of file chassis_control_context.hpp.


The documentation for this class was generated from the following file: