step.motion.sensor_group ======================== .. py:module:: step.motion.sensor_group .. autoapi-nested-parse:: SensorGroup: pre-bind IR sensor pairs with default threshold, speed, and PID gains so mission code doesn't repeat them on every call. Usage:: from raccoon.step.motion.sensor_group import SensorGroup front = SensorGroup( left=front_left_ir, right=front_right_ir, ) # In a mission: front.lineup_on_black() front.drive_until_black() front.drive_over_line() front.follow_right_edge(cm=125) # Override defaults per-call: front.lineup_on_black(threshold=0.5) front.strafe_left_until_black(speed=0.3, threshold=0.3) # Single-sensor access for raw builder calls: strafe_left(speed=0.3).until(on_black(front.right)) Classes ------- .. autoapisummary:: step.motion.sensor_group.SensorGroup Module Contents --------------- .. py:class:: SensorGroup(left=None, right=None, threshold: float = 0.7, speed: float = 1.0, follow_speed: float = 0.8, follow_kp: float = 0.5, follow_ki: float = 0.02, follow_kd: float = 0.0) A named sensor pair with pre-bound defaults for threshold, speed, and PID. Provides convenience methods for common sensor-triggered operations: lineup, drive-until, strafe-until, and line-following. All methods return Step builders that can be used directly in ``seq([...])``. :param left: IR sensor mounted on the left side (or None). :param right: IR sensor mounted on the right side (or None). :param threshold: Default confidence threshold (0.0--1.0) for black/white detection. Defaults to 0.7. :param speed: Default motion speed fraction (0.0--1.0). Defaults to 1.0. :param follow_speed: Default speed for line-following. Defaults to 0.8. :param follow_kp: Proportional gain for line-follow PID. Defaults to 0.5. :param follow_ki: Integral gain for line-follow PID. Defaults to 0.02. :param follow_kd: Derivative gain for line-follow PID. Defaults to 0.0. .. py:attribute:: left :value: None .. py:attribute:: right :value: None .. py:method:: lineup_on_black(threshold=None) .. py:method:: lineup_on_white(threshold=None) .. py:method:: lineup(target=None, threshold=None) .. py:method:: backward_lineup_on_black() .. py:method:: backward_lineup_on_white() .. py:method:: drive_until_black(speed=None, threshold=None) .. py:method:: drive_until_white(speed=None, threshold=None) .. py:method:: drive_over_line(speed=None, threshold=None) Drive forward through black then white (crosses one line). .. py:method:: drive_backward_until_black(sensor=None, speed=None, threshold=None) .. py:method:: strafe_left_until_black(sensor=None, speed=None, threshold=None) .. py:method:: strafe_right_until_black(sensor=None, speed=None, threshold=None) .. py:method:: strafe_right_until_white(sensor=None, speed=None, threshold=None) .. py:method:: follow_right_edge(cm, speed=None) .. py:method:: follow_right_until_black(speed=None)