robot_interfaces_solo.show_data module¶
Classes and functions to implement the “show data” applications for Solo8/12.
- class robot_interfaces_solo.show_data.BackendMode(value)[source]¶
Bases:
Enum
Different backend types.
- FAKE = 1¶
- PYBULLET = 2¶
- REAL = 0¶
- class robot_interfaces_solo.show_data.Robot(robot_name: str, solo_module: module, n_joints: int, config_file: str, backend_mode: BackendMode = BackendMode.REAL)[source]¶
Bases:
object
Wrapper around the robot interface for running in different control modes.
Before using the robot,
initialize()
needs to be called to start the robot. Thenupdate()
should be called in a loop at 1 kHz to run the controller. While running, the control mode can be changed at any time, usingset_control_mode()
.- class ControlMode(value)[source]¶
Bases:
Enum
The different control modes supported by the
Robot
class.- HOLD_POSITION = 2¶
Use position controller to hold all joints at their current position.
- ZERO_TORQUE = 1¶
Apply zero torque on all joints.
- initialize(control_mode: ControlMode) None [source]¶
Initialize the robot. Needs to be called before
update()
.- Parameters:
control_mode – The control mode with which the robot is started.
- set_control_mode(mode: ControlMode) None [source]¶
Set the control mode.
See
ControlMode
for the available modes.
- update() Tuple [source]¶
Get robot data and send a new command to the robot.
This method is expected to be called in the control loop. The command that is sent depends on the selected control mode (see
set_control_mode()
).
- class robot_interfaces_solo.show_data.SliderBar(label: str)[source]¶
Bases:
ProgressBar
urwid widget to show the position of a slider via a progress bar.
- class robot_interfaces_solo.show_data.Window(robot: Robot)[source]¶
Bases:
object
Manages the TUI.
urwid-based TUI for showing the robot data and setting the control mode.
- run() None [source]¶
Run the application.
Runs the TUI mainloop which also takes care of updating the robot controller.
- set_control_mode(mode: ControlMode) None [source]¶
Set robot control mode and update the corresponding label in the TUI.
- robot_interfaces_solo.show_data.labeled_vector(label: str, vector: Sequence, fmt: str = '% .4f') str [source]¶
Construct string with the label followed by the values of the vector.
Example: .. code-block:: Python
labeled_vector(“Label”, [1, 2, 3]) -> “Label: 1.0000 2.0000 3.0000”
- Parameters:
label – Label put before the values
vector – Sequence of values
fmt – Conversion specifier for formatting the values of vector.
- Returns:
The constructed string (see example above).
- robot_interfaces_solo.show_data.main(robot_name: str, solo_module: module, n_joints: int) None [source]¶
Show all sensor data of Solo8/12.
Show all data from observation, status and applied action in a simple TUI. Press M to toggle between position control mode (holding all joints at their current position) and zero torque mode.
- Parameters:
robot_name – Name of the robot (only used for displaying it).
solo_module – The Python module that provides all the classes/functions for the robot interface.
n_joints – Number of joints of the robot.