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

Configuration for BemfVelocityTuner. More...

#include <bemf_velocity_tune.hpp>

Public Attributes

std::vector< int > pwm_levels {}
int pwm_min_percent {30}
int pwm_max_percent {90}
int pwm_steps {6}
int sweeps {1}
double pre_roll_distance_m {0.10}
double measure_distance_m {0.15}
 Ground-truth distance of the measurement window itself. Meters.
double segment_timeout_s {5.0}
 Safety cap on a single forward segment (pre-roll + window). Seconds.
int return_pwm_percent {35}
 PWM used to drive back toward the origin between segments (percent).
double return_tolerance_m {0.04}
 How close to the origin the return move tries to get. Meters.
double return_timeout_s {6.0}
int sample_hz {100}
double settle_s {0.5}
 Settle/brake dwell between segments. Seconds.
double min_window_distance_m {0.03}
double min_window_ticks {20.0}
 Reject a per-motor result whose accumulated |ticks| is below this.
bool require_calib_board {true}
bool apply {true}

Detailed Description

Configuration for BemfVelocityTuner.

The tuner drives the chassis straight forward at a sweep of open-loop PWM levels and, for each level, measures the ground-truth distance travelled (from the external calibration board) against the accumulated BEMF ticks per motor. From that it derives per-motor ticks_to_rad AND a linearity report (does a single scale hold across the speed range, or is the ADC-BEMF↔velocity relationship curved / offset?).

Back-and-forth motion: after each forward measurement segment the robot reverses back toward its starting pose, so the whole sweep stays within roughly one segment length of the origin.

Definition at line 27 of file bemf_velocity_tune.hpp.

Member Data Documentation

◆ apply

bool libstp::autotune::BemfVelocityConfig::apply {true}

Apply the derived ticks_to_rad to the live motors and republish the kinematics config (via odometry.reset()) at the end. The Python step additionally persists to YAML when the user opts in.

Definition at line 72 of file bemf_velocity_tune.hpp.

◆ measure_distance_m

double libstp::autotune::BemfVelocityConfig::measure_distance_m {0.15}

Ground-truth distance of the measurement window itself. Meters.

Definition at line 45 of file bemf_velocity_tune.hpp.

◆ min_window_distance_m

double libstp::autotune::BemfVelocityConfig::min_window_distance_m {0.03}

Reject a measurement window whose ground-truth distance is below this (motor stalled / static friction). Meters.

Definition at line 60 of file bemf_velocity_tune.hpp.

◆ min_window_ticks

double libstp::autotune::BemfVelocityConfig::min_window_ticks {20.0}

Reject a per-motor result whose accumulated |ticks| is below this.

Definition at line 62 of file bemf_velocity_tune.hpp.

◆ pre_roll_distance_m

double libstp::autotune::BemfVelocityConfig::pre_roll_distance_m {0.10}

Distance to roll (and discard) before each measurement window, so the chassis reaches steady-state speed at that PWM. Meters.

Definition at line 43 of file bemf_velocity_tune.hpp.

◆ pwm_levels

std::vector<int> libstp::autotune::BemfVelocityConfig::pwm_levels {}

Explicit PWM levels (percent, 1..100) to sweep. If empty, a linear ramp of pwm_steps points from pwm_min_percent to pwm_max_percent is generated.

Definition at line 32 of file bemf_velocity_tune.hpp.

◆ pwm_max_percent

int libstp::autotune::BemfVelocityConfig::pwm_max_percent {90}

Definition at line 34 of file bemf_velocity_tune.hpp.

◆ pwm_min_percent

int libstp::autotune::BemfVelocityConfig::pwm_min_percent {30}

Definition at line 33 of file bemf_velocity_tune.hpp.

◆ pwm_steps

int libstp::autotune::BemfVelocityConfig::pwm_steps {6}

Definition at line 35 of file bemf_velocity_tune.hpp.

◆ require_calib_board

bool libstp::autotune::BemfVelocityConfig::require_calib_board {true}

Fail outright unless the calibration board currently backs the odometry pose. The Python auto-tune step explicitly requests that source before entering the tune; internal odometry remains the default everywhere else.

Definition at line 68 of file bemf_velocity_tune.hpp.

◆ return_pwm_percent

int libstp::autotune::BemfVelocityConfig::return_pwm_percent {35}

PWM used to drive back toward the origin between segments (percent).

Definition at line 49 of file bemf_velocity_tune.hpp.

◆ return_timeout_s

double libstp::autotune::BemfVelocityConfig::return_timeout_s {6.0}

Definition at line 52 of file bemf_velocity_tune.hpp.

◆ return_tolerance_m

double libstp::autotune::BemfVelocityConfig::return_tolerance_m {0.04}

How close to the origin the return move tries to get. Meters.

Definition at line 51 of file bemf_velocity_tune.hpp.

◆ sample_hz

int libstp::autotune::BemfVelocityConfig::sample_hz {100}

Definition at line 54 of file bemf_velocity_tune.hpp.

◆ segment_timeout_s

double libstp::autotune::BemfVelocityConfig::segment_timeout_s {5.0}

Safety cap on a single forward segment (pre-roll + window). Seconds.

Definition at line 47 of file bemf_velocity_tune.hpp.

◆ settle_s

double libstp::autotune::BemfVelocityConfig::settle_s {0.5}

Settle/brake dwell between segments. Seconds.

Definition at line 56 of file bemf_velocity_tune.hpp.

◆ sweeps

int libstp::autotune::BemfVelocityConfig::sweeps {1}

Number of full sweeps. Points from all sweeps are pooled into one per-motor fit, which stabilises the extrapolated bemf_offset (the ω=0 intercept is sensitive to noise from a single sweep).

Definition at line 39 of file bemf_velocity_tune.hpp.


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