step.motion.at_distance¶
Wait until the robot has driven a certain distance from origin.
Designed to run inside a parallel() branch alongside a drive step:
- parallel(
drive_forward(50), seq([wait_until_distance(30), servo_open()]),
)
Multiple distance-triggered actions:
- parallel(
drive_forward(50), seq([wait_until_distance(20), arm_lower()]), seq([wait_until_distance(30), servo_open()]), seq([wait_until_distance(45), servo_close()]),
)
Polls odometry at 100Hz. Motion steps no longer reset odometry on start (the world pose lives in the continuously-accumulating localization frame), so the distance is measured as the displacement from where THIS step began rather than from the odometry origin.
Classes¶
Wait until the robot has driven at least the given distance. |
Module Contents¶
- class step.motion.at_distance.WaitUntilDistance(cm: float)¶
Bases:
step.StepWait until the robot has driven at least the given distance.
Snapshots the odometry position when the step starts and polls the straight-line displacement from that point at 100 Hz. Because motion steps no longer reset odometry on start, the threshold is measured relative to this step’s own start — not the (continuously accumulating) odometry origin. Designed to run inside a
parallel()branch alongside a drive step, enabling actions to trigger at specific distances during a drive.- Parameters:
cm – Distance threshold in centimeters.
Example:
from raccoon.step import parallel, seq from raccoon.step.motion import drive_forward, wait_until_distance from raccoon.step.servo import servo # Open a servo after driving 30 cm into a 50 cm drive parallel( [ drive_forward(50), seq([wait_until_distance(30), servo(claw, 90)]), ] )