robot_fingers.py_trifinger module¶
- class robot_fingers.py_trifinger.TriFingerConfig¶
Bases:
pybind11_object
- class CalibrationParameters¶
Bases:
pybind11_object
- property endstop_search_torques_Nm¶
Torque that is used to find the end stop.
- property move_steps¶
Number of time steps for reaching the initial position.
- class TrajectoryStep¶
Bases:
pybind11_object
- property move_steps¶
Number of time steps for reaching the target position.
- property target_position_rad¶
Target position to which the joints should move.
- property calibration¶
Parameters related to calibration.
- property can_ports¶
List of CAN port names used by the robot.
- property hard_position_limits_lower¶
Hard lower limits for joint positions.
- property hard_position_limits_upper¶
Hard upper limits for joint positions.
- property has_endstop¶
Whether the joints have physical end stops or not.
- property home_offset_rad¶
Offset between home and zero position.
- property initial_position_rad¶
Initial position to which the robot moves during initialisation.
- is_within_hard_position_limits(position: list) bool ¶
Check if the given position is within the hard limits.
- Parameters:
position – Joint positions.
- Returns:
True if hard_position_limits_lower <= position <= hard_position_limits_upper.
- static load_config(config_file_name: str) Config ¶
Load driver configuration from a YAML file.
- Parameters:
config_file_name – Path to the config file.
- Returns:
The configuration loaded from the given file.
- property max_current_A¶
Maximum current that can be sent to the motor [A].
- property move_to_position_tolerance_rad¶
Tolerance for reaching the target with NJointBlmcRobotDriver::move_to_position()
- property position_control_gains¶
Default control gains for the position controller.
- print()¶
Print the configuration.
- property safety_kd¶
D-gain to dampen velocity. Set to zero to disable damping.
- property shutdown_trajectory¶
Trajectory which is executed during shutdown.
- property soft_position_limits_lower¶
Soft lower limits for joint positions.
- property soft_position_limits_upper¶
Soft upper limits for joint positions.
- class robot_fingers.py_trifinger.TriFingerPlatformFrontend¶
Bases:
pybind11_object
- class Action(torque=[0] * n_joints, position=[nan] * n_joints, position_kp=[nan] * n_joints, position_kd=[nan] * n_joints)¶
Bases:
pybind11_object
Action with desired torque and (optional) position.
The resulting torque command sent to the robot is:
torque_command = torque + PD(position)
To disable the position controller, set the target position to NaN. The controller is executed joint-wise, so it is possible to run it only for some joints by setting a target position for these joints and setting the others to NaN.
The specified torque is always added to the result of the position controller, so if you only want to run the position controller, make sure to set torque to zero for all joints.
- Parameters:
torque – Desired torque.
position – Desired position. Set values to NaN to disable position controller for the corresponding joints
position_kp – P-gains for the position controller. Set to NaN to use default values.
position_kd – D-gains for the position controller. Set to NaN to use default values.
- property position¶
List of desired positions, one per joint. If set, a PD position controller is run and the resulting torque is added to
torque
. Set to NaN to disable position controller (default).
- property position_kd¶
D-gains for position controller, one per joint. If NaN, default is used.
- property position_kp¶
P-gains for position controller, one per joint. If NaN, default is used.
- property torque¶
List of desired torques, one per joint.
- append_desired_action(action: robot_interfaces.trifinger.Action) int ¶
Append a desired action to the action time series.
Append an action to the “desired actions” time series. Note that this does not block until the action is actually executed. The time series acts like a queue from which the actions are taken one by one to send them to the actual robot. It is possible to call this method multiple times in a row to already provide actions for the next time steps.
The time step at which the given action will be applied is returned by this method.
- Parameters:
desired_action – The action that shall be applied on the robot. Note that the actually applied action might be different (see
get_applied_action()
).- Returns:
Time step at which the action will be applied.
- get_applied_action(t: int) robot_interfaces.trifinger.Action ¶
Get actually applied action of time step t.
The applied action is the one that was actually applied to the robot based on the desired action of that time step. It may differ from the desired one e.g. due to safety checks which limit the maximum torque and enforce the position limits.
If t is in the future, this method will block and wait.
- get_camera_observation(t: int)¶
Get camera images of time step t.
If t is in the future, this method will block and wait.
- Parameters:
t – Time index of the robot time series. This is internally mapped to the corresponding time index of the camera time series.
- Returns:
Camera images of time step t.
- Raises:
Exception – if t is too old and not in the time series buffer anymore.
- get_current_timeindex() int ¶
Get the current time index.
- get_desired_action(t: int) robot_interfaces.trifinger.Action ¶
Get desired action of time step t.
This corresponds to the action that was appended using append_desired_action(). Note that the actually applied action may differ, see get_applied_action().
If t is in the future, this method will block and wait.
- get_robot_observation(t: int) robot_interfaces.trifinger.Observation ¶
Get robot observation of time step t.
If t is in the future, this method will block and wait.
- Parameters:
t – Index of the time step.
- Returns:
Robot observation of time step t.
- Raises:
Exception – if t is too old and not in the time series buffer anymore.
- get_robot_status(t: int) robot_interfaces.Status ¶
Get robot status of time step t.
If t is in the future, this method will block and wait.
- get_timestamp_ms(t: int) float ¶
Get timestamp in milliseconds of time step t.
If t is in the future, this method will block and wait.
- wait_until_timeindex(t: int)¶
Wait until time step t is reached.
- class robot_fingers.py_trifinger.TriFingerPlatformLog(robot_log_file: str, camera_log_file: str)¶
Bases:
pybind11_object
Load robot and camera log and match observations like during runtime.
The robot and camera observations are provided asynchronously. To access both through a common time index,
TriFingerPlatformFrontend
maps “robot time indices” to the corresponding camera observations based on the time stamps. This mapping is not explicitly saved in the log files. Therefore, TriFingerPlatformLog class provides an interface to load robot and camera logs together and performs the mapping from robot to camera time index in the same way as it is happening inTriFingerPlatformFrontend
.- Parameters:
robot_log_file (str) – Path to the robot log file.
camera_log_file (str) – Path to the camera log file.
- get_camera_log()¶
- get_camera_observation(t: int)¶
Get camera observation of robot time step t.
- get_first_timeindex() int ¶
Get the first time index in the log file.
- get_last_timeindex() int ¶
Get the last time index in the log file.
- get_map_robot_to_camera_index()¶
- get_robot_log()¶
- get_robot_observation(t: int) Observation ¶
Get robot observation of time step t.
- get_robot_status(t: int) Status ¶
Get robot status of time step t.
- get_timestamp_ms(t: int) float ¶
Get timestamp (in milliseconds) of time step t.
- class robot_fingers.py_trifinger.TriFingerPlatformWithObjectFrontend¶
Bases:
pybind11_object
- class Action(torque=[0] * n_joints, position=[nan] * n_joints, position_kp=[nan] * n_joints, position_kd=[nan] * n_joints)¶
Bases:
pybind11_object
Action with desired torque and (optional) position.
The resulting torque command sent to the robot is:
torque_command = torque + PD(position)
To disable the position controller, set the target position to NaN. The controller is executed joint-wise, so it is possible to run it only for some joints by setting a target position for these joints and setting the others to NaN.
The specified torque is always added to the result of the position controller, so if you only want to run the position controller, make sure to set torque to zero for all joints.
- Parameters:
torque – Desired torque.
position – Desired position. Set values to NaN to disable position controller for the corresponding joints
position_kp – P-gains for the position controller. Set to NaN to use default values.
position_kd – D-gains for the position controller. Set to NaN to use default values.
- property position¶
List of desired positions, one per joint. If set, a PD position controller is run and the resulting torque is added to
torque
. Set to NaN to disable position controller (default).
- property position_kd¶
D-gains for position controller, one per joint. If NaN, default is used.
- property position_kp¶
P-gains for position controller, one per joint. If NaN, default is used.
- property torque¶
List of desired torques, one per joint.
- append_desired_action(action: robot_interfaces.trifinger.Action) int ¶
Append a desired action to the action time series.
Append an action to the “desired actions” time series. Note that this does not block until the action is actually executed. The time series acts like a queue from which the actions are taken one by one to send them to the actual robot. It is possible to call this method multiple times in a row to already provide actions for the next time steps.
The time step at which the given action will be applied is returned by this method.
- Parameters:
desired_action – The action that shall be applied on the robot. Note that the actually applied action might be different (see
get_applied_action()
).- Returns:
Time step at which the action will be applied.
- get_applied_action(t: int) robot_interfaces.trifinger.Action ¶
Get actually applied action of time step t.
The applied action is the one that was actually applied to the robot based on the desired action of that time step. It may differ from the desired one e.g. due to safety checks which limit the maximum torque and enforce the position limits.
If t is in the future, this method will block and wait.
- get_camera_observation(t: int)¶
Get camera images of time step t.
If t is in the future, this method will block and wait.
- Parameters:
t – Time index of the robot time series. This is internally mapped to the corresponding time index of the camera time series.
- Returns:
Camera images of time step t.
- Raises:
Exception – if t is too old and not in the time series buffer anymore.
- get_current_timeindex() int ¶
Get the current time index.
- get_desired_action(t: int) robot_interfaces.trifinger.Action ¶
Get desired action of time step t.
This corresponds to the action that was appended using append_desired_action(). Note that the actually applied action may differ, see get_applied_action().
If t is in the future, this method will block and wait.
- get_robot_observation(t: int) robot_interfaces.trifinger.Observation ¶
Get robot observation of time step t.
If t is in the future, this method will block and wait.
- Parameters:
t – Index of the time step.
- Returns:
Robot observation of time step t.
- Raises:
Exception – if t is too old and not in the time series buffer anymore.
- get_robot_status(t: int) robot_interfaces.Status ¶
Get robot status of time step t.
If t is in the future, this method will block and wait.
- get_timestamp_ms(t: int) float ¶
Get timestamp in milliseconds of time step t.
If t is in the future, this method will block and wait.
- wait_until_timeindex(t: int)¶
Wait until time step t is reached.
- class robot_fingers.py_trifinger.TriFingerPlatformWithObjectLog¶
Bases:
pybind11_object
TriFingerPlatformLog(robot_log_file: str, camera_log_file: str)
Load robot and camera log and match observations like during runtime.
The robot and camera observations are provided asynchronously. To access both through a common time index,
TriFingerPlatformFrontend
maps “robot time indices” to the corresponding camera observations based on the time stamps. This mapping is not explicitly saved in the log files. Therefore, TriFingerPlatformLog class provides an interface to load robot and camera logs together and performs the mapping from robot to camera time index in the same way as it is happening inTriFingerPlatformFrontend
.- Parameters:
robot_log_file (str) – Path to the robot log file.
camera_log_file (str) – Path to the camera log file.
- get_camera_log()¶
- get_camera_observation(t: int)¶
Get camera observation of robot time step t.
- get_first_timeindex() int ¶
Get the first time index in the log file.
- get_last_timeindex() int ¶
Get the last time index in the log file.
- get_map_robot_to_camera_index()¶
- get_robot_log()¶
- get_robot_observation(t: int) Observation ¶
Get robot observation of time step t.
- get_robot_status(t: int) Status ¶
Get robot status of time step t.
- get_timestamp_ms(t: int) float ¶
Get timestamp (in milliseconds) of time step t.
- robot_fingers.py_trifinger.create_trifinger_backend()¶