libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::autotune::DriveCharacterizer Class Reference

Characterizes a robot's physical drive limits at raw motor power. More...

#include <characterize_drive.hpp>

Public Member Functions

 DriveCharacterizer (drive::Drive &drive, odometry::IOdometry &odometry)
AxisResult characterizeAxis (const std::string &axis, const CharacterizeConfig &cfg) const
 Characterize a single axis.
std::map< std::string, AxisResult > characterize (const std::vector< std::string > &axes, const CharacterizeConfig &cfg) const
 Characterize multiple axes in sequence.

Detailed Description

Characterizes a robot's physical drive limits at raw motor power.

Bypasses all velocity control (library PID and firmware BEMF PID) by commanding raw PWM via Drive::applyPowerCommand(). For each axis the characterizer runs multiple accel + decel trials and takes the median of each metric across trials.

Sampling is performed at up to 500 Hz in a tight C++ sleep loop, which allows significantly higher resolution than the Python asyncio-based implementation (formerly ~100 Hz).

Note
DriveCharacterizer holds non-owning references to Drive and IOdometry. The caller must ensure both objects outlive the DriveCharacterizer instance.

Definition at line 29 of file characterize_drive.hpp.

Constructor & Destructor Documentation

◆ DriveCharacterizer()

libstp::autotune::DriveCharacterizer::DriveCharacterizer ( drive::Drive & drive,
odometry::IOdometry & odometry )
Parameters
driveChassis drive controller (reference, not owned).
odometryOdometry source (reference, not owned).

Member Function Documentation

◆ characterize()

std::map< std::string, AxisResult > libstp::autotune::DriveCharacterizer::characterize ( const std::vector< std::string > & axes,
const CharacterizeConfig & cfg ) const
nodiscard

Characterize multiple axes in sequence.

Parameters
axesAxis names to measure (e.g. {"forward", "angular"}).
cfgMeasurement configuration shared across all axes.
Returns
Map from axis name to AxisResult.

◆ characterizeAxis()

AxisResult libstp::autotune::DriveCharacterizer::characterizeAxis ( const std::string & axis,
const CharacterizeConfig & cfg ) const
nodiscard

Characterize a single axis.

Parameters
axisOne of "forward", "lateral", or "angular".
cfgMeasurement configuration.
Returns
AxisResult with median max_velocity, acceleration, and deceleration. Fields remain 0.0 if all trials fail.

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