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

Calibrate per-motor ticks_to_rad using the IMU heading as ground truth. More...

#include <encoder_calibrator.hpp>

Public Member Functions

 EncoderCalibrator (drive::Drive &drive, odometry::IOdometry &odometry)
EncoderCalResult calibrate (const EncoderCalConfig &cfg) const

Detailed Description

Calibrate per-motor ticks_to_rad using the IMU heading as ground truth.

The calibrator commands a slow in-place rotation, accumulates the IMU heading change vs. the odometry-integrated heading change, and rescales MotorCalibration::ticks_to_rad by imu_angle / odom_angle for every motor.

Because the same scale factor is applied to all motors, this only fixes the systematic component of the ticks_to_rad assumption (e.g. wrong gear-ratio constant). Individual per-motor variation requires a richer kinematics model and is out of scope here.

Note
The caller is responsible for re-publishing the kinematics config to the STM32 (TransportWriter::sendKinematicsConfig) after a successful calibration — the calibrator only mutates the in-process MotorCalibration instances.

Definition at line 28 of file encoder_calibrator.hpp.

Constructor & Destructor Documentation

◆ EncoderCalibrator()

libstp::autotune::EncoderCalibrator::EncoderCalibrator ( drive::Drive & drive,
odometry::IOdometry & odometry )

Member Function Documentation

◆ calibrate()

EncoderCalResult libstp::autotune::EncoderCalibrator::calibrate ( const EncoderCalConfig & cfg) const
nodiscard

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