Calibration Gate

calibration_gate(...) finalizes everything the collectors recorded. Put it once in the setup mission, after the last collect_drive and collect_ir_set , and the robot is calibrated.

calibration_gate(
    require_axes=[CalibrationAxis.FORWARD],
    require_ir_sets=["default"],
)
ParameterTypeDefaultDescription
require_axeslist[CalibrationAxis]NoneDrive axes that must be finalized: CalibrationAxis.FORWARD, CalibrationAxis.LATERAL. None finalizes every axis that has a sample or was required by a collector.
require_ir_setslist[str]NoneIR set names that must be finalized. None finalizes every set collected so far.
fallback_cmfloatNoneDistance of the fallback drive for both axes. Replaces forward_fallback_cm and lateral_fallback_cm.
forward_fallback_cmfloat70Distance of the fallback drive when the forward axis has no sample.
lateral_fallback_cmfloat50Distance of the fallback strafe when the lateral axis has no sample.

What it does

For each drive axis:

  1. If there is no sample for the axis, the robot drives a measured fallback and you measure the distance. With a calibration board the board measures it.
  2. The median of the samples gives the scale. The BotUI shows the requested and the measured distance and asks you to confirm. You can also enter the measurement again or redo the drive.
  3. After you confirm, the scale is stored and applied to every following distance-based drive. It is stored in racoon.calibration.yml and loaded again at the next start.

The scale is set, not multiplied, so running calibration again does not make the error grow.

For each IR set: if the set has too few samples, a fallback drive collects them, then the thresholds are computed and shown for confirmation, see Collect IR .

Behavior

  • It runs once. After it has finalized, further calibration_gate calls return immediately until new samples arrive.
  • The lateral axis is skipped on drivetrains that cannot strafe.
  • It does nothing with --no-calibrate .
  • If you dismiss the screens, the axis stays untrimmed and distance-based drives keep warning that calibration is missing.