step.motion.drive_angle

Classes

DriveAngle

Drive at an arbitrary angle with distance or condition-based termination.

DriveAngleLeft

Drive at an angle to the left with distance or condition-based termination.

DriveAngleRight

Drive at an angle to the right with distance or condition-based termination.

Module Contents

class step.motion.drive_angle.DriveAngle(angle_deg: float, cm: float = None, speed: float = 1.0, until: step.condition.StopCondition = None)

Bases: step.motion.motion_step.MotionStep

Drive at an arbitrary angle with distance or condition-based termination.

Decomposes the desired heading into forward and lateral velocity components, then runs a profiled PID controller in a rotated coordinate frame with heading maintenance and cross-track correction.

Requires a mecanum or omni-wheel drivetrain.

Angle convention (robot-centric): 0 = forward, 90 = right, -90 = left, 180 = backward.

Parameters:
  • angle_deg – Travel angle in degrees.

  • cm – Distance to travel in centimeters. Omit to use condition-only mode.

  • speed – Fraction of max speed, 0.0 to 1.0.

  • until – Stop condition for early termination.

Example:

from raccoon.step.motion import drive_angle

# Drive diagonally forward-right at 45 degrees
drive_angle(45, cm=30)

# Drive pure right (same as strafe_right)
drive_angle(90, cm=20)
to_simulation_step() step.SimulationStep
on_start(robot: raccoon.robot.api.GenericRobot) None
on_update(robot: raccoon.robot.api.GenericRobot, dt: float) bool
class step.motion.drive_angle.DriveAngleLeft(angle_deg: float, cm: float = None, speed: float = 1.0, until: step.condition.StopCondition = None)

Bases: DriveAngle

Drive at an angle to the left with distance or condition-based termination.

Convenience wrapper around DriveAngle that negates the angle so that the angle_deg parameter is always positive (pointing left).

The angle is measured as degrees to the left of forward: 0 = forward, 45 = forward-left diagonal, 90 = pure left.

Parameters:
  • angle_deg – Degrees to the left of forward (0 = forward, 90 = pure left).

  • cm – Distance to travel in centimeters. Omit to use condition-only mode.

  • speed – Fraction of max speed, 0.0 to 1.0.

  • until – Stop condition for early termination.

Example:

from raccoon.step.motion import drive_angle_left

# Drive diagonally forward-left at 45 degrees
drive_angle_left(45, cm=30)

# Drive pure left until sensor
drive_angle_left(90, speed=0.6).until(on_black(s))
class step.motion.drive_angle.DriveAngleRight(angle_deg: float, cm: float = None, speed: float = 1.0, until: step.condition.StopCondition = None)

Bases: DriveAngle

Drive at an angle to the right with distance or condition-based termination.

Convenience wrapper around DriveAngle that passes the angle directly (positive = right in the robot frame).

The angle is measured as degrees to the right of forward: 0 = forward, 45 = forward-right diagonal, 90 = pure right.

Parameters:
  • angle_deg – Degrees to the right of forward (0 = forward, 90 = pure right).

  • cm – Distance to travel in centimeters. Omit to use condition-only mode.

  • speed – Fraction of max speed, 0.0 to 1.0.

  • until – Stop condition for early termination.

Example:

from raccoon.step.motion import drive_angle_right

# Drive diagonally forward-right at 45 degrees
drive_angle_right(45, cm=30)

# Drive pure right until sensor
drive_angle_right(90, speed=0.6).until(on_black(s))