robot.heading_drift_watchdog

Heading-drift watchdog: warn when the chassis rotates while nothing drives.

Between motion steps (servo-only phases, grabs) no controller ticks the drive, so external forces — an arm pushing off a game piece, a collision — can rotate the chassis on low-friction mecanum wheels without anything noticing. Later motion steps then inherit the heading error, which shows up as “cursed” snap corrections that are expensive to trace back.

This watchdog runs on its OWN daemon thread (never on the asyncio motion loop, mirroring ContinuousLocalizationFusion): it polls the firmware IMU heading and, while the "drive" resource is NOT held by any step, accumulates the rotation since the drive was released. Crossing the threshold logs a WARNING with the drifted angle, then re-arms so continued rotation warns again.

Purely diagnostic — it never commands anything.

Attributes

DRIFT_WARN_RAD

POLL_PERIOD_S

Classes

HeadingDriftWatchdog

Functions

start_heading_drift_watchdog(→ HeadingDriftWatchdog | None)

Start the watchdog, or return None when no IMU is available.

Module Contents

robot.heading_drift_watchdog.DRIFT_WARN_RAD: float = 0.052
robot.heading_drift_watchdog.POLL_PERIOD_S: float = 0.05
class robot.heading_drift_watchdog.HeadingDriftWatchdog(robot: raccoon.robot.api.GenericRobot, imu, threshold_rad: float = DRIFT_WARN_RAD)
start() None
stop() None
robot.heading_drift_watchdog.start_heading_drift_watchdog(robot: raccoon.robot.api.GenericRobot) HeadingDriftWatchdog | None

Start the watchdog, or return None when no IMU is available.