step.motion.drive_dsl ===================== .. py:module:: step.motion.drive_dsl .. autoapi-nested-parse:: Auto-generated step builders and DSL functions — DO NOT EDIT. Source: drive.py Classes ------- .. autoapisummary:: step.motion.drive_dsl.DriveForwardBuilder step.motion.drive_dsl.DriveBackwardBuilder step.motion.drive_dsl.StrafeLeftBuilder step.motion.drive_dsl.StrafeRightBuilder Functions --------- .. autoapisummary:: step.motion.drive_dsl.drive_forward step.motion.drive_dsl.drive_backward step.motion.drive_dsl.strafe_left step.motion.drive_dsl.strafe_right Module Contents --------------- .. py:class:: DriveForwardBuilder Bases: :py:obj:`raccoon.step.step_builder.StepBuilder` Builder for DriveForward. Auto-generated — do not edit. .. py:method:: cm(value: float) .. py:method:: speed(value: float) .. py:method:: until(value: raccoon.step.condition.StopCondition) .. py:method:: heading(value: float) .. py:function:: drive_forward(cm: float = None, speed: float = 1.0, until: raccoon.step.condition.StopCondition = None, heading: float = None) Drive forward with distance or condition-based termination. Uses profiled PID motion control with a trapezoidal velocity profile. The robot accelerates, cruises, and decelerates while maintaining heading via IMU feedback. When ``heading`` is given, the controller holds that absolute heading (degrees from heading reference) instead of the heading at start, preventing drift accumulation across consecutive drives. Requires ``calibrate_distance()`` for distance-based mode. Requires ``mark_heading_reference()`` when using ``heading``. :param cm: Distance in centimeters. Omit to use condition-only mode. :param speed: Fraction of max speed, 0.0 to 1.0. :param until: Stop condition for early termination (e.g., ``on_black(sensor)``). Can also be chained via the ``.until()`` builder method. :param heading: Absolute heading in degrees from the heading reference to hold during this drive. ``None`` (default) holds the heading at the start of the drive (relative mode). :returns: A DriveForwardBuilder (chainable via ``.cm()``, ``.speed()``, ``.until()``, ``.heading()``, ``.on_anomaly()``, ``.skip_timing()``). Example:: drive_forward(25) # 25 cm, relative heading drive_forward(25, heading=90) # hold 90° absolute drive_forward(speed=0.8).until(on_black(s)) # until sensor .. py:class:: DriveBackwardBuilder Bases: :py:obj:`raccoon.step.step_builder.StepBuilder` Builder for DriveBackward. Auto-generated — do not edit. .. py:method:: cm(value: float) .. py:method:: speed(value: float) .. py:method:: until(value: raccoon.step.condition.StopCondition) .. py:method:: heading(value: float) .. py:function:: drive_backward(cm: float = None, speed: float = 1.0, until: raccoon.step.condition.StopCondition = None, heading: float = None) Drive backward with distance or condition-based termination. Identical to ``drive_forward()`` but in reverse. Uses profiled PID motion control while maintaining heading via IMU feedback. Supports the same ``heading`` parameter for absolute heading hold. Requires ``calibrate_distance()`` for distance-based mode. Requires ``mark_heading_reference()`` when using ``heading``. :param cm: Distance in centimeters. Omit to use condition-only mode. :param speed: Fraction of max speed, 0.0 to 1.0. :param until: Stop condition for early termination (e.g., ``on_black(sensor)``). Can also be chained via the ``.until()`` builder method. :param heading: Absolute heading in degrees from the heading reference to hold during this drive. ``None`` (default) holds the heading at the start of the drive (relative mode). :returns: A DriveBackwardBuilder (chainable via ``.cm()``, ``.speed()``, ``.until()``, ``.heading()``, ``.on_anomaly()``, ``.skip_timing()``). Example:: drive_backward(20) drive_backward(20, heading=0) # hold 0° absolute drive_backward(speed=0.5).until(on_white(s)) .. py:class:: StrafeLeftBuilder Bases: :py:obj:`raccoon.step.step_builder.StepBuilder` Builder for StrafeLeft. Auto-generated — do not edit. .. py:method:: cm(value: float) .. py:method:: speed(value: float) .. py:method:: until(value: raccoon.step.condition.StopCondition) .. py:method:: heading(value: float) .. py:function:: strafe_left(cm: float = None, speed: float = 1.0, until: raccoon.step.condition.StopCondition = None, heading: float = None) Strafe left with distance or condition-based termination. Requires a mecanum or omni-wheel drivetrain. The robot moves laterally to the left while maintaining heading via IMU feedback. Supports the same ``heading`` parameter for absolute heading hold. Requires ``mark_heading_reference()`` when using ``heading``. :param cm: Distance in centimeters. Omit to use condition-only mode. :param speed: Fraction of max speed, 0.0 to 1.0. :param until: Stop condition for early termination (e.g., ``on_black(sensor)``). Can also be chained via the ``.until()`` builder method. :param heading: Absolute heading in degrees from the heading reference to hold during this strafe. ``None`` (default) holds the heading at the start of the strafe (relative mode). :returns: A StrafeLeftBuilder (chainable via ``.cm()``, ``.speed()``, ``.until()``, ``.heading()``, ``.on_anomaly()``, ``.skip_timing()``). Example:: strafe_left(15) strafe_left(15, heading=90) # hold 90° absolute strafe_left(speed=0.6).until(on_black(s)) .. py:class:: StrafeRightBuilder Bases: :py:obj:`raccoon.step.step_builder.StepBuilder` Builder for StrafeRight. Auto-generated — do not edit. .. py:method:: cm(value: float) .. py:method:: speed(value: float) .. py:method:: until(value: raccoon.step.condition.StopCondition) .. py:method:: heading(value: float) .. py:function:: strafe_right(cm: float = None, speed: float = 1.0, until: raccoon.step.condition.StopCondition = None, heading: float = None) Strafe right with distance or condition-based termination. Requires a mecanum or omni-wheel drivetrain. The robot moves laterally to the right while maintaining heading via IMU feedback. Supports the same ``heading`` parameter for absolute heading hold. Requires ``mark_heading_reference()`` when using ``heading``. :param cm: Distance in centimeters. Omit to use condition-only mode. :param speed: Fraction of max speed, 0.0 to 1.0. :param until: Stop condition for early termination (e.g., ``on_black(sensor)``). Can also be chained via the ``.until()`` builder method. :param heading: Absolute heading in degrees from the heading reference to hold during this strafe. ``None`` (default) holds the heading at the start of the strafe (relative mode). :returns: A StrafeRightBuilder (chainable via ``.cm()``, ``.speed()``, ``.until()``, ``.heading()``, ``.on_anomaly()``, ``.skip_timing()``). Example:: strafe_right(15) strafe_right(15, heading=0) # hold 0° absolute strafe_right(speed=0.6).until(on_black(s))