libstp.step.wait_for_seconds

Classes

WaitForSeconds

A step that waits for a specified duration before completing.

Functions

wait(→ WaitForSeconds)

Pause execution for a fixed number of seconds.

Module Contents

class libstp.step.wait_for_seconds.WaitForSeconds(seconds: float | int)

Bases: libstp.step.Step

A step that waits for a specified duration before completing.

seconds
to_simulation_step() libstp.step.SimulationStep
libstp.step.wait_for_seconds.wait(seconds: float) WaitForSeconds

Pause execution for a fixed number of seconds.

Suspends the current step sequence for the specified duration using an async sleep. No hardware commands are issued during the wait, and other concurrent tasks (e.g. odometry updates) continue running normally. The wait duration is deterministic and is reflected accurately in simulation estimates.

Parameters:

seconds – Duration to pause in seconds. Must be non-negative. Passing 0 yields control to the event loop for one tick without any meaningful delay.

Returns:

A WaitForSeconds step ready to be scheduled in a step sequence.

Example:

from libstp.step import wait

# Pause between two motor commands
sequence(
    motor_power(robot.motor(0), 100),
    wait(2.5),
    motor_brake(robot.motor(0)),
)

# Brief yield to let sensors settle
wait(0.1)