robot_fingers package

class robot_fingers.FingerConfig

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 PositionControlGains

Bases: pybind11_object

property kd
property kp
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(self: robot_fingers.py_real_finger.FingerConfig, position: numpy.ndarray[numpy.float64[3, 1]]) bool

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) robot_fingers.py_real_finger.FingerConfig

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(self: robot_fingers.py_real_finger.FingerConfig) None

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.OneJointConfig

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 PositionControlGains

Bases: pybind11_object

property kd
property kp
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(self: robot_fingers.py_one_joint.OneJointConfig, position: numpy.ndarray[numpy.float64[1, 1]]) bool

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) robot_fingers.py_one_joint.OneJointConfig

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(self: robot_fingers.py_one_joint.OneJointConfig) None

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.Robot(robot_module, create_backend_function, config, logger_buffer_size=0)[source]

Bases: object

classmethod create_by_name(robot_name: str, logger_buffer_size: int = 0)[source]

Create a Robot instance for the specified robot.

Parameters:

robot_name – Name of the robots. See

:param Robot.get_supported_robots() for a list of supported robots.: :param logger_buffer_size: See Robot.__init__().

Returns:

A Robot instance for the specified robot.

Return type:

Robot

frontend

The frontend is used to send actions and get observations.

static get_supported_robots()[source]

Get list of robots supported by create_by_name.

Returns:

List of supported robot names.

initialize()[source]

Initialize the robot.

logger

The logger can be used to log robot data to a file

class robot_fingers.SoloEightConfig

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 PositionControlGains

Bases: pybind11_object

property kd
property kp
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(self: robot_fingers.py_solo_eight.SoloEightConfig, position: numpy.ndarray[numpy.float64[8, 1]]) bool

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) robot_fingers.py_solo_eight.SoloEightConfig

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(self: robot_fingers.py_solo_eight.SoloEightConfig) None

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.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 PositionControlGains

Bases: pybind11_object

property kd
property kp
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.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.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 in TriFingerPlatformFrontend.

Parameters:
  • robot_log_file (str) – Path to the robot log file.

  • camera_log_file (str) – Path to the camera log file.

get_applied_action(t: int) Action

Get actually applied action of time step t.

get_camera_log()
get_camera_observation(t: int)

Get camera observation of robot time step t.

get_desired_action(t: int) Action

Get desired action of 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.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.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 in TriFingerPlatformFrontend.

Parameters:
  • robot_log_file (str) – Path to the robot log file.

  • camera_log_file (str) – Path to the camera log file.

get_applied_action(t: int) Action

Get actually applied action of time step t.

get_camera_log()
get_camera_observation(t: int)

Get camera observation of robot time step t.

get_desired_action(t: int) Action

Get desired action of 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.TwoJointConfig

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 PositionControlGains

Bases: pybind11_object

property kd
property kp
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(self: robot_fingers.py_two_joint.TwoJointConfig, position: numpy.ndarray[numpy.float64[2, 1]]) bool

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) robot_fingers.py_two_joint.TwoJointConfig

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(self: robot_fingers.py_two_joint.TwoJointConfig) None

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.

robot_fingers.create_fake_finger_backend(arg0: robot_interfaces::RobotData<robot_interfaces::NJointAction<3ul>, robot_interfaces::NFingerObservation<1ul> >) robot_interfaces::RobotBackend<robot_interfaces::NJointAction<3ul>, robot_interfaces::NFingerObservation<1ul> >
robot_fingers.create_one_joint_backend(*args, **kwargs)

Overloaded function.

  1. create_one_joint_backend(robot_data: robot_interfaces.py_one_joint_types.BaseData, config: robot_fingers::NJointBlmcRobotDriver<robot_interfaces::NJointObservation<1ul>, 1ul, 1ul>::Config, first_action_timeout: float = inf, max_number_of_actions: int = 0) -> robot_interfaces.py_one_joint_types.Backend

  2. create_one_joint_backend(robot_data: robot_interfaces.py_one_joint_types.BaseData, config_file: str, first_action_timeout: float = inf, max_number_of_actions: int = 0) -> robot_interfaces.py_one_joint_types.Backend

robot_fingers.create_real_finger_backend(*args, **kwargs)

Overloaded function.

  1. create_real_finger_backend(robot_data: robot_interfaces::RobotData<robot_interfaces::NJointAction<3ul>, robot_interfaces::NFingerObservation<1ul> >, config: robot_fingers::NJointBlmcRobotDriver<robot_interfaces::NFingerObservation<1ul>, 3ul, 2ul>::Config, first_action_timeout: float = inf, max_number_of_actions: int = 0) -> robot_interfaces::RobotBackend<robot_interfaces::NJointAction<3ul>, robot_interfaces::NFingerObservation<1ul> >

  2. create_real_finger_backend(robot_data: robot_interfaces::RobotData<robot_interfaces::NJointAction<3ul>, robot_interfaces::NFingerObservation<1ul> >, config_file: str, first_action_timeout: float = inf, max_number_of_actions: int = 0) -> robot_interfaces::RobotBackend<robot_interfaces::NJointAction<3ul>, robot_interfaces::NFingerObservation<1ul> >

robot_fingers.create_solo_eight_backend(*args, **kwargs)

Overloaded function.

  1. create_solo_eight_backend(robot_data: robot_interfaces.py_solo_eight_types.BaseData, config: robot_fingers::NJointBlmcRobotDriver<robot_interfaces::NJointObservation<8ul>, 8ul, 4ul>::Config, first_action_timeout: float = inf, max_number_of_actions: int = 0) -> robot_interfaces.py_solo_eight_types.Backend

  2. create_solo_eight_backend(robot_data: robot_interfaces.py_solo_eight_types.BaseData, config_file: str, first_action_timeout: float = inf, max_number_of_actions: int = 0) -> robot_interfaces.py_solo_eight_types.Backend

robot_fingers.create_trifinger_backend()
robot_fingers.create_two_joint_backend(*args, **kwargs)

Overloaded function.

  1. create_two_joint_backend(robot_data: robot_interfaces.py_two_joint_types.BaseData, config: robot_fingers::NJointBlmcRobotDriver<robot_interfaces::NJointObservation<2ul>, 2ul, 1ul>::Config, first_action_timeout: float = inf, max_number_of_actions: int = 0) -> robot_interfaces.py_two_joint_types.Backend

  2. create_two_joint_backend(robot_data: robot_interfaces.py_two_joint_types.BaseData, config_file: str, first_action_timeout: float = inf, max_number_of_actions: int = 0) -> robot_interfaces.py_two_joint_types.Backend

robot_fingers.demo_print_position(robot)[source]

Send zero-torque commands to the robot and print the joint positions.

Parameters:

robot (Robot) – The robot environment.

Subpackages

Submodules