step.motion.heading_reference_dsl¶
Auto-generated step builders and DSL functions — DO NOT EDIT.
Source: heading_reference.py
Classes¶
Builder for MarkHeadingReference. Auto-generated — do not edit. |
Functions¶
|
Mark the current IMU heading as a reference point for absolute turns. |
Module Contents¶
- class step.motion.heading_reference_dsl.MarkHeadingReferenceBuilder¶
Bases:
raccoon.step.step_builder.StepBuilderBuilder for MarkHeadingReference. Auto-generated — do not edit.
- positive_direction(value: Literal['left', 'right'])¶
- step.motion.heading_reference_dsl.mark_heading_reference(origin_offset_deg: float = 0.0, positive_direction: Literal['left', 'right'] = 'left')¶
Mark the current IMU heading as a reference point for absolute turns.
Captures the robot’s current absolute IMU heading and stores it as a reference. Subsequent calls to
turn_to_heading_right()andturn_to_heading_left()will compute turn angles relative to this stored reference, enabling absolute heading control even after the robot has moved and turned through other motion steps.The reference uses the raw IMU heading which is unaffected by odometry resets that occur during normal motion steps.
Multiple calls overwrite the previous reference.
Place this step right after
wait_for_light()so the heading origin is captured before the robot moves.- Parameters:
origin_offset_deg – Offset in degrees added to the captured heading. Use this to define a consistent board-relative origin regardless of the robot’s physical starting rotation. For example, if the robot always starts angled 30° clockwise from “forward on the board”, pass
origin_offset_deg=-30so that 0° means “forward on the board”.positive_direction – Which physical direction is treated as positive for subsequent
turn_to_heading_leftandturn_to_heading_rightcalls."left"(default) means counter-clockwise angles are positive, matching the standard mathematical convention."right"flips the sign so clockwise angles are positive.
- Returns:
A MarkHeadingReferenceBuilder (chainable via
.origin_offset_deg(),.positive_direction(),.on_anomaly(),.skip_timing()).
Example:
from raccoon.step.motion import mark_heading_reference, turn_to_heading_right # Capture heading origin right after wait-for-light mark_heading_reference() # ... robot drives around ... # Turn to face 90 degrees clockwise from origin turn_to_heading_right(90) # With offset: robot starts 30° CW from board forward mark_heading_reference(origin_offset_deg=-30) # Positive direction is clockwise (right) mark_heading_reference(positive_direction="right")