cloudpendulumclient.benchmark.control_loop

Classes

ControlLoop(user_token, experiment_time, ...)

A basic control loop used for running a benchmarking controller.

class cloudpendulumclient.benchmark.control_loop.ControlLoop(user_token: str, experiment_time: float, experiment_type: str, cell_id: int | None = None, initial_position: list[float] | None = None, disturbances: list[Disturbance] | str | None = None, dt: float = 0.002, record: bool = False, preparation_time: float = 5.0)

A basic control loop used for running a benchmarking controller.

__init__(user_token: str, experiment_time: float, experiment_type: str, cell_id: int | None = None, initial_position: list[float] | None = None, disturbances: list[Disturbance] | str | None = None, dt: float = 0.002, record: bool = False, preparation_time: float = 5.0)
finished() bool

Check if the control loop has finished running

iterations() int

Get the number of iterations that the control loop has been running for

time() float

Get the time since the control loop started, until the current control step

start()

Start the control loop by initializing a connection to the cloud pendulum server and starting the experiment.

get_state() list[MotorState]

Get the current state of the system in the form of a list of position/velocity tuples for each actuator in the cell.

get_torque() list[float]

Get the current torque applied to all the actuators in the cell.

step(torques: list[float])

Advance one step in the control loop. Block until next control loop iteration is ready.

Parameters:

torques – The control output torques from the controller.

stop() tuple[str, str]

Stop the control loop. Should be called after finished has returned True.

Returns:

The video url for the experiment if recording was enabled, the logs for the experiment.