libstp.step.servo.utility

Functions

clamp_angle(→ float)

Clamp an angle to the supported servo range.

clamp_position(→ float)

Clamp a servo position to the supported range.

estimate_servo_move_time(→ float)

Estimate time (in seconds) for a servo to move between two angles.

angle_to_position(→ int)

Convert an angle (degrees) to the HAL position representation.

position_to_angle(→ float)

Convert a HAL position reading to an angle in degrees.

Module Contents

libstp.step.servo.utility.clamp_angle(angle: float) float

Clamp an angle to the supported servo range.

libstp.step.servo.utility.clamp_position(position: float) float

Clamp a servo position to the supported range.

libstp.step.servo.utility.estimate_servo_move_time(start_angle: float, end_angle: float) float

Estimate time (in seconds) for a servo to move between two angles. Returns 0 when the delta is zero to avoid unnecessary sleeps.

libstp.step.servo.utility.angle_to_position(angle: float) int

Convert an angle (degrees) to the HAL position representation. Currently this is a 1:1 mapping onto degrees with clamping.

libstp.step.servo.utility.position_to_angle(position: int) float

Convert a HAL position reading to an angle in degrees.