libstp.robot.heading_reference ============================== .. py:module:: libstp.robot.heading_reference Classes ------- .. autoapisummary:: libstp.robot.heading_reference.HeadingReferenceService Module Contents --------------- .. py:class:: HeadingReferenceService(robot: libstp.robot.api.GenericRobot) Bases: :py:obj:`libstp.robot.service.RobotService` Stores an absolute IMU heading reference and computes turns relative to it. Use ``robot.get_service(HeadingReferenceService)`` to access. .. py:method:: mark() -> None Capture the current absolute IMU heading as the reference. .. py:property:: reference_deg :type: float | None The stored reference in degrees, or None if not set. .. py:method:: compute_turn(target_deg: float) -> float Compute the signed relative turn angle to reach *target_deg* from reference. :param 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.