trajectory_generation
The Trajectory Generation Task Library

The components in this task library use the Reflexxes Motion Libraries (RML) to generate smooth motion commands based on the current state of the system, the target state and motion constraints. Reflexxes ensures that the generated motion command never violates the given motion constraints (e.g. position limits, max. velocity, acceleration or jerk). Generally, there are two possible ways to use this task library:

For details on the implementation of Reflexxes, please check the documentation on their website. Please note that there are two different Reflexxes libraries, that provide different features:

Please check against which version of Reflexxes you are linking. By default, Type II will be used. In order to switch to the Reflexxes Type IV implementation, please add the following to your overrides.yml in the autoproj folder of your Rock installation (note that you will need access to the DFKI RIC Gitlab Server for this to work):

1 - control/reflexxes:
2  dfkigit: dfki-control/reflexxes_type_iv.git
3  branch: master
4  patches:
5  - $AUTOPROJ_SOURCE_DIR/remotes/dfki.control/patches/reflexxes_type_iv.patch

The Rock componenents within this task library provide the following features:

Examples

Check the scripts folder for examples on each of the components. There are four different implementations:

  1. RMLPositionTask: Position based implementation in joint space
    • Inputs:
      • Current joint state
      • Target position and (optionally) target velocity for each joint (target port). If velocity is unset, zero target velocity is assumed.
      • (Optionally) Target position / velocity for each joint, plus new motion constraints. Note that changing the motion constraints online might lead to an unresolvable situation, in which case RML will throw an error
    • Outputs:
      • Smooth motion command (position/speed/acceleration)
  2. RMLVelocityTask: Velocity based implementation in joint space
    • Inputs:
      • Current joint state
      • Target velocity for each joint (target port)
      • (Optionally) Target velocity for each joint, plus new motion constraints. Note that changing the motion constraints online might lead to an unresolvable situation, in which case RML will throw an error
    • Outputs:
      • Smooth motion command. Will be speed/acceleration if convert_to_position is set to false or position/speed/acceleration if convert_to_position is set to true
      • The output velocity will be set to zero if no new target value arrived for more than no_reference_timeout seconds. You can disable the timeout by setting no_reference_timeout to infinity.
  3. RMLCartesianPositionTask: Position based implementation in Cartesian space
    • Inputs:
      • Current Cartesian state
      • Target Cartesian position/orientation and (optionally) target translations/rotational velocity (target port). Note that in the current implementation, the orientation is converted to ZYX-euler angles (wrt. rotated coordinate system). Euler angles are prone to stability problems near singular configurations. These problems can be avoided by limiting the target orientation accordingly.
    • Outputs:
      • Smooth motion command (position/speed)
  4. RMLCartesianVelocityTask: Velocity based implementation in Cartesian space
    • Inputs:
      • Current Cartesian state
      • Target target translational/angular velocity (target port)
    • Outputs:
      • Smooth motion command. Will be speed/acceleration if convert_to_position is set to false or position/speed/acceleration if convert_to_position is set to true
      • The output velocity will be set to zero if no new target value arrived for more than no_reference_timeout seconds. You can disable the timeout by setting no_reference_timeout to infinity.

Each component is based on the RMLTask task context. An example configuration looks as follows (for the RMLPositionTask):

1 --- name:default
2 # Cycle Time is seconds. IMPORTANT: This value has to match the period of the component. Default is 0.01 which matches the default period.
3 cycle_time: 0.01
4 
5 # Motion constraints that define the properties of the output trajectory (command-port). These include the maximum/minimum position,
6 # maximum maximum speed, maximum acceleration and maximum jerk (derivative of acceleration).
7 motion_constraints:
8  names: ["Joint1", "Joint2"]
9  elements: [{max: {position: 1.0, speed: 0.3, acceleration: 0.5}, min: {position: -1.0}, max_jerk: 1.0},
10  {max: {position: 1.5, speed: 0.6, acceleration: 1.0}, min: {position: -1.0}, max_jerk: 1.0}]
11 
12 # Behaviour on the position limits (only reflexxes TypeIV!!!). Can be one of POSITIONAL_LIMITS_IGNORE, POSITIONAL_LIMITS_ERROR_MSG_ONLY
13 # and POSITIONAL_LIMITS_ACTIVELY_PREVENT. See reflexxes/RMLFlags.h for details.
14 positional_limits_behavior: :POSITIONAL_LIMITS_IGNORE
15 
16 # Synchronozation behavior for the different joints. Can be one of PHASE_SYNCHRONIZATION_IF_POSSIBLE, ONLY_TIME_SYNCHRONIZATION,
17 # ONLY_PHASE_SYNCHRONIZATION and NO_SYNCHRONIZATION. See reflexxes/RMLFlags.h for details.
18 synchronization_behavior: :PHASE_SYNCHRONIZATION_IF_POSSIBLE

Limitations and Remarks