step.calibration.calibrate_analog_sensor¶
Analog sensor (ET/distance) position calibration step.
Captures a reference raw reading from any AnalogSensor at a user-defined
robot position so that drive_to_analog_target() can reproduce the same
sensor-distance during a mission.
Attributes¶
Classes¶
Reference reading captured during calibration. |
|
Capture a reference analog sensor reading at a target robot position. |
Functions¶
|
Return the CalibrationStore set key for sensor / set_name. |
Module Contents¶
- step.calibration.calibrate_analog_sensor.ANALOG_SENSOR_STORE_SECTION = 'analog-sensor'¶
- step.calibration.calibrate_analog_sensor.analog_sensor_store_key(sensor: raccoon.hal.AnalogSensor, set_name: str) str¶
Return the CalibrationStore set key for sensor / set_name.
- class step.calibration.calibrate_analog_sensor.AnalogSensorCalibration¶
Reference reading captured during calibration.
- class step.calibration.calibrate_analog_sensor.CalibrateAnalogSensor(sensor: raccoon.hal.AnalogSensor, set_name: str = 'default', sample_duration: float = 3.0)¶
Bases:
step.calibration.calibrate_step.CalibrateStep[AnalogSensorCalibration]Capture a reference analog sensor reading at a target robot position.
Guides the operator to position the robot at a reference location, then samples the analog sensor for a short period to derive a stable reference raw value. The result is persisted in
racoon.calibration.ymlunder theanalog-sensorsection and consumed at runtime bydrive_to_analog_target().Typical use: position the robot next to an object, run this step during setup, then use
drive_to_analog_target()in the mission to reliably drive to that sensor distance every run.Supports
--no-calibrate: loads the stored reference without running the interactive flow when the flag is active and data already exists.- Prerequisites:
The sensor must be passed directly. No auto-discovery from
robot.defsis performed.
- Parameters:
sensor – The analog sensor to calibrate (e.g. an
ETSensor).set_name – Label for this calibration point (default
"default"). Use different names for multiple reference distances on the same sensor port.sample_duration – How long to sample the sensor in seconds. Longer durations produce more stable averages.
- Returns:
A CalibrateAnalogSensor instance.
- Raises:
RuntimeError – If the sensor has no valid reading during sampling.
Example:
from raccoon.step.calibration import calibrate_analog_sensor # Calibrate ET sensor at the default target position calibrate_analog_sensor(robot.defs.et_sensor) # Two named positions on the same sensor calibrate_analog_sensor(robot.defs.et_sensor, set_name="near") calibrate_analog_sensor(robot.defs.et_sensor, set_name="far")