libstp.robot.heading_reference¶
Classes¶
Stores an absolute IMU heading reference and computes turns relative to it. |
Module Contents¶
- class libstp.robot.heading_reference.HeadingReferenceService(robot: libstp.robot.api.GenericRobot)¶
Bases:
libstp.robot.service.RobotServiceStores an absolute IMU heading reference and computes turns relative to it.
Use
robot.get_service(HeadingReferenceService)to access.- compute_turn(target_deg: float) float¶
Compute the signed relative turn angle to reach target_deg from reference.
- Parameters:
target_deg – Desired heading in degrees relative to the reference.
- Returns:
Signed angle in degrees (positive = CCW / left, negative = CW / right). Normalized to [-180, 180] for the shortest path.
- Raises:
RuntimeError – If no reference has been marked yet.