Attention
This challenge has ended!
This documentation is only for the Real Robot Challenge 2020 which has ended. Following challenges have their own documentation, see the challenge website for more information.
The SimFinger Class¶
The SimFinger
class provides a simulation
environment for the different finger robots. Note that for this challenge, only
the finger type “trifingerpro” is used.
For the challenge, SimFinger
should not be used
directly but instead the wrapper class
TriFingerPlatform
should be used. Therefore the
documentation here is limited to the relevant methods which are exposed through
TriFingerPlatform
.
API Documentation¶
-
class
rrc_simulation.
SimFinger
(finger_type, time_step=0.004, enable_visualization=False)[source]¶ A simulation environment for the single and the tri-finger robots. This environment is based on PyBullet, the official Python wrapper around the Bullet-C API.
-
Action
(torque=None, position=None)[source]¶ Fill in the fields of the action structure.
This is a factory go create an
Action
instance with proper default values, depending on the finger type.- Parameters
torque (array) – Torques to apply to the joints. Defaults to zero.
position (array) – Angular target positions for the joints. If set to NaN for a joint, no position control is run for this joint. Defaults to all NaN.
- Returns
the action to be applied to the motors
- Return type
Action
-
append_desired_action
(action)[source]¶ Pass an action on which safety checks will be performed and then the action will be applied to the motors.
- Parameters
action (Action) – Joint positions or torques or both
- Returns
The current time index t at which the action is applied.
- Return type
int
-
get_timestamp_ms
(t)[source]¶ Get timestamp of time step ‘t’.
- Parameters
t – Index of the time step. The only valid value is the index of the current step (return value of the last call of
append_desired_action()
).- Returns
Timestamp in milliseconds. The timestamp starts at zero when initializing and is increased with every simulation step according to the configured time step.
- Raises
ValueError – If invalid time index
t
is passed.
-
get_desired_action
(t)[source]¶ Get the desired action of time step ‘t’.
- Parameters
t – Index of the time step. The only valid value is the index of the current step (return value of the last call of
append_desired_action()
).- Returns
The desired action of time step t.
- Raises
ValueError – If invalid time index
t
is passed.
-
get_applied_action
(t)[source]¶ Get the actually applied action of time step ‘t’.
The actually applied action can differ from the desired one, e.g. because the position controller affects the torque command or because too big torques are clamped to the limits.
- Parameters
t – Index of the time step. The only valid value is the index of the current step (return value of the last call of
append_desired_action()
).- Returns
The applied action of time step t.
- Raises
ValueError – If invalid time index
t
is passed.
-
get_observation
(t)[source]¶ Get the observation at the time of applying the action, so the observation actually corresponds to the state of the environment due to the application of the previous action.
This method steps the simulation!
- Parameters
t – Index of the time step. The only valid value is the index of the current step (return value of the last call of
append_desired_action()
).- Returns
Observation of the robot state
- Return type
- Raises
ValueError – If invalid time index
t
is passed.
-
-
class
rrc_simulation.
Action
(torque, position, kp=None, kd=None)[source]¶ Robot action.
The length of the attributes depends on the robot type. In the following
n_joints
is the number of joints andn_fingers
the number of fingers (e.g. for the TriFinger robotsn_fingers = 3, n_joints = 9
).-
torque
¶ Torque commands for the joints.
- Type
array, shape=(n_joints,)
-
position
¶ Position commands for the joints. Set to NaN to disable position control for the corresponding joint.
- Type
array, shape=(n_joints,)
-
kp
¶ P-gain for position controller. Set to NaN to use default gain for the corresponding joint.
- Type
array, shape=(n_joints,)
-
kd
¶ D-gain for position controller. Set to NaN to use default gain for the corresponding joint.
- Type
array, shape=(n_joints,)
-
-
class
rrc_simulation.
Observation
[source]¶ Robot state observation.
The length of the attributes depends on the robot type. In the following
n_joints
is the number of joints andn_fingers
the number of fingers (e.g. for the TriFinger robotsn_fingers = 3, n_joints = 9
).-
position
¶ Angular joint positions in radian.
- Type
array, shape=(n_joints,)
-
velocity
¶ Joint velocities in rad/s.
- Type
array, shape=(n_joints,)
-
torque
¶ Joint torques in Nm.
- Type
array, shape=(n_joints,)
-
tip_force
¶ Measurement of the push sensors on the finger tips.
- Type
array, shape=(n_fingers,)
-