libstp.step.motion.turn

Classes

Turn

Step wrapper around the native TurnMotion controller.

Functions

turn_left(→ Turn)

Turn counter-clockwise (left) by a specified angle.

turn_right(→ Turn)

Turn clockwise (right) by a specified angle.

Module Contents

class libstp.step.motion.turn.Turn(config: libstp.motion.TurnConfig)

Bases: libstp.step.motion.motion_step.MotionStep

Step wrapper around the native TurnMotion controller.

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.turn.turn_left(degrees: float, speed: float = 1.0) Turn

Turn counter-clockwise (left) by a specified angle.

Uses a PID controller on the IMU heading to rotate the robot in place. The controller saturates output at the configured max angular rate, producing an implicit trapezoidal velocity profile.

Parameters:
  • degrees – Angle to turn in degrees (positive = counter-clockwise).

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

Returns:

A Turn step configured for counter-clockwise rotation.

Example:

from libstp.step.motion import turn_left

# Turn 90 degrees to the left
turn_left(90)

# Gentle 45-degree turn at half speed
turn_left(45, speed=0.5)
libstp.step.motion.turn.turn_right(degrees: float, speed: float = 1.0) Turn

Turn clockwise (right) by a specified angle.

Uses a PID controller on the IMU heading to rotate the robot in place. The controller saturates output at the configured max angular rate, producing an implicit trapezoidal velocity profile.

Parameters:
  • degrees – Angle to turn in degrees (positive = clockwise).

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

Returns:

A Turn step configured for clockwise rotation.

Example:

from libstp.step.motion import turn_right

# Turn 90 degrees to the right
turn_right(90)