libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::hal::platform::Platform Class Reference

Hardware-health entry point. Implemented per platform bundle. More...

#include <Platform.hpp>

Static Public Member Functions

static ProbeResult probe (const ProbeOptions &options={})
static void requireHealthy (const ProbeOptions &options={})
static void setMockProbeFailure (Component component, bool fail)
static void clearMockProbeFailures ()
 Reset all forced failures set by setMockProbeFailure.
static std::shared_ptr< libstp::odometry::IOdometry > createOdometry (std::shared_ptr< libstp::kinematics::IKinematics > kinematics)
static bool commandChassisVelocity (float vx, float vy, float wz)

Detailed Description

Hardware-health entry point. Implemented per platform bundle.

Definition at line 96 of file Platform.hpp.

Member Function Documentation

◆ clearMockProbeFailures()

void libstp::hal::platform::Platform::clearMockProbeFailures ( )
static

Reset all forced failures set by setMockProbeFailure.

◆ commandChassisVelocity()

bool libstp::hal::platform::Platform::commandChassisVelocity ( float vx,
float vy,
float wz )
static

Command a body-frame chassis velocity [vx (m/s), vy (m/s), wz (rad/s)] to the coprocessor's on-board chassis velocity loop (MOT_MODE_CHASSIS): the wombat bundle forwards it to the STM32, which maps it to per-wheel setpoints via forward kinematics and runs the per-motor PID. Requires kinematics to have been pushed already (createOdometry sends it). High-rate, best-effort.

Returns
true if the platform has an on-board chassis loop and accepted the command (wombat); false if there is none (mock) — in which case the caller should fall back to host-side IK + control.

◆ createOdometry()

std::shared_ptr< libstp::odometry::IOdometry > libstp::hal::platform::Platform::createOdometry ( std::shared_ptr< libstp::kinematics::IKinematics > kinematics)
static

Construct the platform-canonical odometry implementation.

Each platform bundle owns one odometry implementation that is the single source of truth for pose. The wombat bundle returns an implementation that reads STM32-computed dead-reckoning over LCM; the mock bundle returns an in-process implementation suitable for tests. Higher layers should not select between odometry types — they take whatever the platform provides.

kinematics is forwarded so the implementation can push the pre-baked kinematics matrix to the coprocessor where applicable.

◆ probe()

ProbeResult libstp::hal::platform::Platform::probe ( const ProbeOptions & options = {})
static

Run the platform health-check synchronously. Safe to call multiple times; callers typically invoke it once at the start of run().

◆ requireHealthy()

void libstp::hal::platform::Platform::requireHealthy ( const ProbeOptions & options = {})
static

Convenience that calls probe() and throws ProbeFailedError when a required component fails. Used by GenericRobot._run_missions to refuse to start on a broken robot.

◆ setMockProbeFailure()

void libstp::hal::platform::Platform::setMockProbeFailure ( Component component,
bool fail )
static

Test hook (mock platform only). Forces the named component to report a failure on the next probe() call. No-op on wombat so production callers are immune to misuse.


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