Trajectory Filter Configuration
The trajectory filter server is configured using two yaml files. One yaml file specifies the types of filters that the trajectory will be run through while the other yaml file specifies the joint limits that will be used for filtering.
The filters yaml specification
The trajectory filters are templated. Most filters will be able to take 3 different messages as input:
doc/api/motion_planning_msgs/html/msg/FilterJointTrajectoryRequest.html
doc/api/motion_planning_msgs/html/msg/JointTrajectoryWithLimits.html
doc/api/motion_planning_msgs/html/msg/FilterJointTrajectoryWithConstraintsRequest.html
The trajectory filter server sets up a chain of filters through which it will pass the input message. The set of filters are specified in the filters.yaml file. Here's an example of a filters.yaml file:
service_type: FilterJointTrajectory filter_chain: - name: numerical_differentiation type: NumericalDifferentiationSplineSmootherFilterJointTrajectoryRequest - name: linear_spline_velocity_scaler type: LinearSplineVelocityScalerFilterJointTrajectoryRequest
The first field (service_type) can take two values: FilterJointTrajectory or FilterJointTrajectoryWithConstraints. When service_type: FilterJointTrajectory, the trajectory filter server is internally setup to listen for a service call of type FilterJointTrajectoryService. When service_type: FilterJointTrajectoryWithConstraints, the trajectory filter server is internally setup to listen for a service call of type FilterJointTrajectoryServiceWithConstraints.
This yaml file specifies two trajectory filters. Each filter has a filter type and a name that differentiates it from filters of the same type. The input trajectory will be passed through the first filter which is of type NumericalDifferentiationSplineSmoother and then through the second filter which is of type LinearSplineVelocityScaler. The first filter uses numerical differentiation to add velocities to a trajectory with only positions filled up while the second filter linearly scales the timing between consecutive waypoints of the trajectory to make sure velocities are within the joint limits specified in the joint limits file.
If you wanted two filters of the same type, make sure you give them two different names.
How do you figure out which filters are available? Well, we are working on a tool that will let you do that easily.
The joint limits specification
Here's an example joint_limits.yaml file showing the joint limits specification for two joints. The fields in this yaml file correspond to the fields in the JointLimits message.
joint_limits: r_shoulder_pan_joint: has_position_limits: true min_position: -2.2853981634 max_position: 0.714601836603 has_velocity_limits: true max_velocity: 0.8 has_acceleration_limits: true max_acceleration: 0.5 r_shoulder_lift_joint: has_position_limits: true min_position: -0.5236 max_position: 0.3963 has_velocity_limits: true max_velocity: 0.82 has_acceleration_limits: true max_acceleration: 0.5
Note that in addition to specifying joint limits, you also need to set the flags for whether the particular limits exist.