Other Calibration

Skipping calibration

Calibrating takes time. While you iterate on a mission you can skip it. Start the program with raccoon run --no-calibrate, or use a run configuration with no_calibrate: true (the builtin dev preset does).

With --no-calibrate:

  • collect_drive, collect_ir_set and calibration_gate do nothing. The stored distance scales are loaded at startup, and each IR sensor loads its stored thresholds when it is created.
  • calibrate_sensors and calibrate_analog_sensor apply the stored values instead of asking you.

Wrap setup steps that need you in run_unless_no_calibrate(...), so that the whole block is skipped:

run_unless_no_calibrate(
    seq([
        wait_for_button("Place the robot"),
        collect_drive(drive_forward(50)),
        calibration_gate(require_axes=[CalibrationAxis.FORWARD]),
    ])
)

Without calibration data on a new robot the stored values do not exist yet, so run once without the flag first.

When to calibrate again

  • After changing wheels, motors or the drivetrain
  • On a table with a different surface or different lighting
  • After moving or replacing an IR sensor
  • When distances or turns are visibly off

calibrate_sensors

Samples the IR sensors in its own step with the BotUI guiding you, instead of collecting them during a motion. Use it when you do not want to combine the IR calibration with a drive.

calibrate_sensors()
calibrate_sensors(calibration_time=8.0, calibration_sets=["default", "transparent"])
ParameterTypeDefaultDescription
calibration_timefloat5.0Seconds to sample each surface.
allow_use_existingboolTrueOffer to reuse the stored calibration instead of sampling.
calibration_setslist[str]["default"]The sets to calibrate in one run.

The thresholds are computed as described in Collect IR .

Motor calibration commands

The values in config/motors.yml come from commands you run on your laptop with a connected robot, not from setup steps:

CommandWhat it does
raccoon calibrate ticksMeasures the encoder ticks per revolution and writes ticks_to_rad for each motor.
raccoon calibrate autotuneRuns auto_tune() on the robot. Writes vel_lpf_alpha, bemf_offset, static_friction_pct and the per-motor pid values.
raccoon calibrate servosSets servo offsets, see Servo Offsets and Calibration .
raccoon calibrate step-responseRecords the step response of the motors as CSV and plot. Writes nothing automatically. Use the plot to set the motion_pid constraints in robot.yml .

Run ticks first, then autotune. The keys these commands write are described in Motor Config .

calibrate_deadzone(motor_ports=None, start_percent=1, max_percent=30, settle_time=0.3) is a setup step that finds the power a motor needs to start turning. It raises the power slowly and asks you to confirm when the wheel moves.

Single-sensor steps

StepWhat it does
calibrate_analog_sensor(sensor, set_name="default", sample_duration=3.0)Stores the reading of an analog or ET sensor at the current robot position. drive_to_analog_target() then drives to that reading, see Analog and ET Sensors .
calibrate_wait_for_light(sensor)Measures the start-lamp sensor with the lamp off and on, for wait_for_light_legacy. See Wait for Light .