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

Namespaces

namespace  control

Classes

struct  AutoTuneConfig
 Aggregated configuration for the full auto-tune pipeline. More...
struct  AutoTuneResult
 Aggregated results of the auto-tune pipeline. More...
class  AutoTuner
 Orchestrates the full auto-tune pipeline in a single C++ entry point so phase-to-phase state coherence is guaranteed. More...
struct  BemfVelocityConfig
 Configuration for BemfVelocityTuner. More...
struct  BemfVelocityPoint
 One measurement window at a single PWM level. More...
struct  BemfMotorFit
 Per-motor fit + linearity diagnostics across the speed sweep. More...
struct  BemfVelocityResult
 Full result of a BEMF→velocity calibration run. More...
class  BemfVelocityTuner
 Calibrate per-motor ticks_to_rad (BEMF→rad) against the external calibration board, fully automatically. More...
class  DriveCharacterizer
 Characterizes a robot's physical drive limits at raw motor power. More...
class  EncoderCalibrator
 Calibrate per-motor ticks_to_rad using the IMU heading as ground truth. More...
class  FirmwarePidTuner
 Tunes the per-motor firmware-side velocity PID (STM32 MAV mode). More...
class  MotionTuner
 Tunes motion PID gains (distance, lateral, heading) via Hooke-Jeeves coordinate descent. More...
struct  OdometrySnapshot
class  StaticFrictionMeasurer
 Per-motor static-friction (kS) measurement. More...
struct  AxisResult
 Measured physical limits for a single chassis axis. More...
struct  CharacterizeConfig
 Configuration for the DriveCharacterizer. More...
struct  StepResponseData
 Raw step-response recording for one velocity axis. More...
struct  PlantParams
 First-order-plus-dead-time (FOPDT) plant parameters extracted from a step-response recording. More...
struct  VelocityTuneResult
 Result of tuning a single velocity axis. More...
struct  VelocityTuneConfig
 Configuration for the VelocityTuner. More...
struct  MotionTuneResult
 Result of tuning a single motion PID parameter (distance, lateral, or heading). More...
struct  MotionTuneConfig
 Configuration for the MotionTuner (Hooke-Jeeves coordinate descent). More...
struct  FirmwarePidConfig
 Configuration for the FirmwarePidTuner. More...
struct  FirmwarePidResult
 Result of tuning a single motor's firmware-side velocity PID. More...
struct  StaticFrictionConfig
 Configuration for the StaticFrictionMeasurer. More...
struct  StaticFrictionSample
 One PWM-vs-BEMF sample taken during a static-friction sweep. More...
struct  StaticFrictionResult
 Per-motor static-friction measurement result (kS in PWM percent). More...
struct  VelLpfConfig
 Configuration for the VelLpfTuner (encoder-velocity LPF alpha). More...
struct  VelLpfSweepPoint
 One point of the alpha sweep: the score (and its parts) the candidate alpha achieved on the captured raw BEMF series. More...
struct  VelLpfResult
 Per-motor LPF-alpha tuning result. More...
struct  ToleranceConfig
 Configuration for deriveTolerances(). More...
struct  ToleranceResult
 Result of deriveTolerances(): the derived tolerances and flags indicating which UnifiedMotionPidConfig fields were updated. More...
struct  EncoderCalConfig
 Configuration for the EncoderCalibrator. More...
struct  EncoderCalResult
 Encoder calibration result. More...
class  VelLpfTuner
 Tunes the per-motor encoder-velocity LPF alpha (MotorCalibration::vel_lpf_alpha). More...
class  VelocityTuner
 Tunes per-axis velocity PID gains via step-response identification. More...

Functions

ToleranceResult deriveTolerances (const std::map< std::string, MotionTuneResult > &tune_results, const MotionTuneConfig &tune_config, motion::UnifiedMotionPidConfig &motion_config, const ToleranceConfig &cfg={})
 Derive realistic motion tolerances from MotionTuner results.

Function Documentation

◆ deriveTolerances()

ToleranceResult libstp::autotune::deriveTolerances ( const std::map< std::string, MotionTuneResult > & tune_results,
const MotionTuneConfig & tune_config,
motion::UnifiedMotionPidConfig & motion_config,
const ToleranceConfig & cfg = {} )

Derive realistic motion tolerances from MotionTuner results.

Pure computation — no hardware interaction. Takes the per-parameter tuning scores, recovers a representative error magnitude per parameter, scales by cfg.margin_factor, clamps into the configured limits, and writes the result back to motion_config.

The recovery is:

error_estimate = final_score / (score_error_weight + epsilon)

which inverts the dominant score_error_weight * error term that the MotionTuner uses when computing the composite score.

Parameters
tune_resultsMap of MotionTuner outputs keyed by param name. "distance" / "lateral" feed distance_tolerance_m; "heading" feeds angle_tolerance_rad.
tune_configThe MotionTuneConfig used to produce tune_results (needed for score_error_weight).
motion_configMotion PID config to update in place.
cfgTolerance derivation configuration.
Returns
The derived tolerances and which fields were actually updated.