libstp.step.motion.drive_angle

Classes

DriveAngle

Functions

drive_angle(→ DriveAngle)

Drive at an arbitrary angle for a specified distance.

Module Contents

class libstp.step.motion.drive_angle.DriveAngle(config: libstp.motion.DiagonalMotionConfig)

Bases: libstp.step.motion.motion_step.MotionStep

config
to_simulation_step() libstp.step.SimulationStep
on_start(robot: libstp.robot.api.GenericRobot) None
on_update(robot: libstp.robot.api.GenericRobot, dt: float) bool
libstp.step.motion.drive_angle.drive_angle(angle_deg: float, cm: float, speed: float = 1.0) DriveAngle

Drive at an arbitrary angle for a specified distance.

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.

  • speed – Fraction of max speed, 0.0 to 1.0 (default 1.0).

Returns:

A DriveAngle step.

Example:

from libstp.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)