Skip to content

Commit a07862e

Browse files
martiniiljschleicherdavetcoleman
authored
Add Pilz Industrial Motion Planner tutorial (#461) (#583)
* Add Pilz Industrial Motion Planner tutorial (#461) Co-authored-by: jschleicher <j.schleicher@pilz.de> Co-authored-by: Dave Coleman <dave@picknik.ai>
1 parent 62e2d64 commit a07862e

6 files changed

Lines changed: 366 additions & 0 deletions

File tree

doc/move_group_interface/src/move_group_interface_tutorial.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ int main(int argc, char** argv)
113113
// ^^^^^^^^^^^^^^^^^^^^^^^^^
114114
visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to start the demo");
115115

116+
// .. _move_group_interface-planning-to-pose-goal:
117+
//
116118
// Planning to a Pose goal
117119
// ^^^^^^^^^^^^^^^^^^^^^^^
118120
// We can plan a motion for this group to a desired pose for the
55.5 KB
Loading
Lines changed: 363 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,363 @@
1+
Pilz Industrial Motion Planner
2+
==============================
3+
4+
``pilz_industrial_motion_planner`` provides a trajectory generator to plan standard robot
5+
motions like PTP, LIN, CIRC with the interface of a MoveIt PlannerManager
6+
plugin.
7+
8+
User Interface MoveGroup
9+
------------------------
10+
11+
This package implements the ``planning_interface::PlannerManager``
12+
interface of MoveIt. By loading the corresponding planning pipeline
13+
(``pilz_industrial_motion_planner_planning_pipeline.launch.xml`` in your
14+
``*_moveit_config`` package), the trajectory generation
15+
functionalities can be accessed through the user interface (c++, python
16+
or rviz) provided by the ``move_group`` node, e.g.
17+
``/plan_kinematics_path`` service and ``/move_group`` action. For
18+
detailed usage tutorials please refer to :doc:`/doc/move_group_interface/move_group_interface_tutorial`.
19+
20+
Joint Limits
21+
------------
22+
23+
For all commands the planner uses maximum velocities and accelerations from
24+
the parameter server. Using the MoveIt setup assistant the file ``joint_limits.yaml``
25+
is auto-generated with proper defaults and loaded during startup.
26+
27+
The limits on the parameter server override the limits from the URDF robot description.
28+
Note that while setting position limits and velocity limits is possible
29+
in both the URDF and the parameter server setting acceleration limits is
30+
only possible via the parameter server. In extension to the common
31+
``has_acceleration`` and ``max_acceleration`` parameter we added the
32+
ability to also set ``has_deceleration`` and
33+
``max_deceleration``\ (<0.0).
34+
35+
The limits are merged under the premise that the limits from the
36+
parameter server must be stricter or at least equal to the parameters
37+
set in the URDF.
38+
39+
Currently the calculated trajectory will respect the limits by using the
40+
strictest combination of all limits as a common limit for all joints.
41+
42+
Cartesian Limits
43+
----------------
44+
45+
For cartesian trajectory generation (LIN/CIRC) the planner needs an
46+
information about the maximum speed in 3D cartesian space. Namely
47+
translational/rotational velocity/acceleration/deceleration need to be
48+
set on the parameter server like this:
49+
50+
.. code:: yaml
51+
52+
cartesian_limits:
53+
max_trans_vel: 1
54+
max_trans_acc: 2.25
55+
max_trans_dec: -5
56+
max_rot_vel: 1.57
57+
58+
The planners assume the same acceleration ratio for translational and
59+
rotational trapezoidal shapes. So the rotational acceleration is
60+
calculated as ``max\_trans\_acc / max\_trans\_vel \* max\_rot\_vel`` (and
61+
for deceleration accordingly).
62+
63+
Planning Interface
64+
------------------
65+
66+
This package uses ``moveit_msgs::MotionPlanRequest`` and ``moveit_msgs::MotionPlanResponse``
67+
as input and output for motion planning. The parameters needed for each planning algorithm
68+
are explained below.
69+
70+
For a general introduction on how to fill a ``MotionPlanRequest`` see
71+
:ref:`move_group_interface-planning-to-pose-goal`.
72+
73+
You can specify "PTP", "LIN" or "CIRC" as the ``planner\_id``of the ``MotionPlanRequest``.
74+
75+
The PTP motion command
76+
----------------------
77+
78+
This planner generates fully synchronized point-to-point trajectories
79+
with trapezoidal joint velocity profiles. All joints are assumed to have
80+
the same maximal joint velocity/acceleration/deceleration limits. If
81+
not, the strictest limits are adopted. The axis with the longest time to
82+
reach the goal is selected as the lead axis. Other axes are decelerated
83+
so that they share the same acceleration/constant velocity/deceleration
84+
phases as the lead axis.
85+
86+
.. image:: ptp.png
87+
:alt: PTP velocity profile with trapezoidal ramps - the axis with the longest duration
88+
determines the maximum velocity
89+
90+
Input parameters in ``moveit_msgs::MotionPlanRequest``
91+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92+
93+
- ``planner_id``: PTP
94+
- ``group_name``: name of the planning group
95+
- ``max_velocity_scaling_factor``: scaling factor of maximal joint velocity
96+
- ``max_acceleration_scaling_factor``: scaling factor of maximal joint acceleration/deceleration
97+
- ``start_state/joint_state/(name, position and velocity``: joint name/position/velocity(optional) of the start state.
98+
- ``goal_constraints`` (goal can be given in joint space or Cartesian space)
99+
- for a goal in joint space
100+
- ``goal_constraints/joint_constraints/joint_name``: goal joint name
101+
- ``goal_constraints/joint_constraints/position``: goal joint position
102+
- for a goal in Cartesian space
103+
- ``goal_constraints/position_constraints/header/frame_id``: frame this data is associated with
104+
- ``goal_constraints/position_constraints/link_name``: target link name
105+
- ``goal_constraints/position_constraints/constraint_region``: bounding volume of the target point
106+
- ``goal_constraints/position_constraints/target_point_offset``: offset (in the link frame) for the target point on
107+
the target link (optional)
108+
109+
110+
Planning results in ``moveit_msg::MotionPlanResponse``
111+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112+
113+
- ``trajectory_start``: first robot state of the planned trajectory
114+
- ``trajectory/joint_trajectory/joint_names``: a list of the joint
115+
names of the generated joint trajectory
116+
- ``trajectory/joint_trajectory/points/(positions,velocities,accelerations,time_from_start)``:
117+
a list of generated way points. Each point has
118+
positions/velocities/accelerations of all joints (same order as the
119+
joint names) and time from start. The last point will have zero
120+
velocity and acceleration.
121+
- ``group_name``: name of the planning group
122+
- ``error_code/val``: error code of the motion planning
123+
124+
The LIN motion command
125+
----------------------
126+
127+
This planner generates linear Cartesian trajectory between goal and
128+
start poses. The planner uses the Cartesian limits to generate a
129+
trapezoidal velocity profile in Cartesian space. The translational
130+
motion is a linear interpolation between start and goal position vector.
131+
The rotational motion is quaternion slerp between start and goal
132+
orientation. The translational and rotational motion is synchronized in
133+
time. This planner only accepts start state with zero velocity. Planning
134+
result is a joint trajectory. The user needs to adapt the Cartesian
135+
velocity/acceleration scaling factor if the motion plan fails due to
136+
violation of joint space limits.
137+
138+
Input parameters in ``moveit_msgs::MotionPlanRequest``
139+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140+
141+
- ``planner_id``: LIN
142+
- ``group_name``: name of the planning group
143+
- ``max_velocity_scaling_factor``: scaling factor of maximal Cartesian
144+
translational/rotational velocity
145+
- ``max_acceleration_scaling_factor``: scaling factor of maximal
146+
Cartesian translational/rotational acceleration/deceleration
147+
- ``start_state/joint_state/(name, position and velocity``: joint
148+
name/position of the start state.
149+
- ``goal_constraints`` (goal can be given in joint space or Cartesian
150+
space)
151+
152+
- for a goal in joint space
153+
154+
- ``goal_constraints/joint_constraints/joint_name``: goal joint
155+
name
156+
- ``goal_constraints/joint_constraints/position``: goal joint
157+
position
158+
159+
- for a goal in Cartesian space
160+
161+
- ``goal_constraints/position_constraints/header/frame_id``:
162+
frame this data is associated with
163+
- ``goal_constraints/position_constraints/link_name``: target
164+
link name
165+
- ``goal_constraints/position_constraints/constraint_region``:
166+
bounding volume of the target point
167+
- ``goal_constraints/position_constraints/target_point_offset``:
168+
offset (in the link frame) for the target point on the target
169+
link (optional)
170+
171+
Planning results in ``moveit_msg::MotionPlanResponse``
172+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173+
174+
- ``trajectory_start``: first robot state of the planned trajectory
175+
- ``trajectory/joint_trajectory/joint_names``: a list of the joint
176+
names of the generated joint trajectory
177+
- ``trajectory/joint_trajectory/points/(positions,velocities,accelerations,time_from_start)``:
178+
a list of generated way points. Each point has
179+
positions/velocities/accelerations of all joints (same order as the
180+
joint names) and time from start. The last point will have zero
181+
velocity and acceleration.
182+
- ``group_name``: name of the planning group
183+
- ``error_code/val``: error code of the motion planning
184+
185+
The CIRC motion command
186+
-----------------------
187+
188+
This planner generates a circular arc trajectory in Cartesian space
189+
between goal and start poses. There are two options for giving a path
190+
constraint:
191+
192+
- the *center* point of the circle: The planner always
193+
generates the shorter arc between start and goal and cannot generate a
194+
half circle,
195+
- an *interim* point on the arc: The generated trajectory
196+
always goes through the interim point. The planner cannot generate a
197+
full circle.
198+
199+
The Cartesian limits, namely translational/rotational
200+
velocity/acceleration/deceleration need to be set and the planner uses
201+
these limits to generate a trapezoidal velocity profile in Cartesian
202+
space. The rotational motion is quaternion slerp between start and goal
203+
orientation. The translational and rotational motion is synchronized in
204+
time. This planner only accepts start state with zero velocity. Planning
205+
result is a joint trajectory. The user needs to adapt the Cartesian
206+
velocity/acceleration scaling factor if motion plan fails due to
207+
violation of joint limits.
208+
209+
Input parameters in ``moveit_msgs::MotionPlanRequest``
210+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
211+
212+
- ``planner_id``: CIRC
213+
- ``group_name``: name of the planning group
214+
- ``max_velocity_scaling_factor``: scaling factor of maximal Cartesian
215+
translational/rotational velocity
216+
- ``max_acceleration_scaling_factor``: scaling factor of maximal
217+
Cartesian translational/rotational acceleration/deceleration
218+
- ``start_state/joint_state/(name, position and velocity``: joint
219+
name/position of the start state.
220+
- ``goal_constraints`` (goal can be given in joint space or Cartesian
221+
space)
222+
223+
- for a goal in joint space
224+
225+
- ``goal_constraints/joint_constraints/joint_name``: goal joint
226+
name
227+
- ``goal_constraints/joint_constraints/position``: goal joint
228+
position
229+
230+
- for a goal in Cartesian space
231+
232+
- ``goal_constraints/position_constraints/header/frame_id``:
233+
frame this data is associated with
234+
- ``goal_constraints/position_constraints/link_name``: target
235+
link name
236+
- ``goal_constraints/position_constraints/constraint_region``:
237+
bounding volume of the target point
238+
- ``goal_constraints/position_constraints/target_point_offset``:
239+
offset (in the link frame) for the target point on the target
240+
link (optional)
241+
242+
- ``path_constraints`` (position of the interim/center point)
243+
244+
- ``path_constraints/name``: interim or center
245+
- ``path_constraints/position_constraints/constraint_region/primitive_poses/point``:
246+
position of the point
247+
248+
249+
Planning results in ``moveit_msg::MotionPlanResponse``
250+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
251+
252+
- ``trajectory_start``: first robot state of the planned trajectory
253+
- ``trajectory/joint_trajectory/joint_names``: a list of the joint
254+
names of the generated joint trajectory
255+
- ``trajectory/joint_trajectory/points/(positions,velocities,accelerations,time_from_start)``:
256+
a list of generated way points. Each point has
257+
positions/velocities/accelerations of all joints (same order as the
258+
joint names) and time from start. The last point will have zero
259+
velocity and acceleration.
260+
- ``group_name``: name of the planning group
261+
- ``error_code/val``: error code of the motion planning
262+
263+
Example
264+
-------
265+
266+
By running
267+
268+
::
269+
270+
roslaunch prbt_moveit_config demo.launch
271+
272+
the user can interact with the planner through rviz.
273+
274+
.. figure:: rviz_planner.png
275+
:alt: rviz figure
276+
277+
Using the planner
278+
-----------------
279+
280+
The *pilz_industrial_motion_planner::CommandPlanner* is provided as a MoveIt Motion Planning
281+
Pipeline and, therefore, can be used with all other manipulators using
282+
MoveIt. Loading the plugin requires the param
283+
``/move_group/planning_plugin`` to be set to ``pilz_industrial_motion_planner::CommandPlanner``
284+
before the ``move_group`` node is started.
285+
286+
To use the command planner cartesian limits have to be defined. The
287+
limits are expected to be under the namespace
288+
``<robot_description>_planning``. Where ``<robot_description>`` refers
289+
to the parameter under which the URDF is loaded. E.g. if the URDF was
290+
loaded into ``/robot_description`` the cartesian limits have to be
291+
defined at ``/robot_description_planning``.
292+
293+
An example showing the cartesian limits which have to be defined can be
294+
found in `prbt_moveit_config
295+
<https://github.com/ros-planning/moveit_resources/blob/master/prbt_moveit_config/config/cartesian_limits.yaml>`_.
296+
297+
Sequence of multiple segments
298+
=============================
299+
300+
To concatenate multiple trajectories and plan the trajectory at once,
301+
you can use the sequence capability. This reduces the planning overhead
302+
and allows to follow a pre-desribed path without stopping at
303+
intermediate points.
304+
305+
**Please note:** In case the planning of a command in a sequence fails,
306+
non of the commands in the sequence are executed.
307+
308+
**Please note:** Sequences commands are allowed to contain commands for
309+
multiple groups (e.g. "Manipulator", "Gripper")
310+
311+
User interface sequence capability
312+
----------------------------------
313+
314+
A specialized MoveIt capability takes a
315+
``moveit_msgs::MotionSequenceRequest`` as input. The request contains a
316+
list of subsequent goals as described above and an additional
317+
``blend_radius`` parameter. If the given ``blend_radius`` in meter is
318+
greater than zero, the corresponding trajectory is merged together with
319+
the following goal such that the robot does not stop at the current
320+
goal. When the TCP comes closer to the goal than the given
321+
``blend_radius``, it is allowed to travel towards the next goal already.
322+
When leaving a sphere around the current goal, the robot returns onto
323+
the trajectory it would have taken without blending.
324+
325+
.. figure:: blend_radius.png
326+
:alt: blend figure
327+
328+
Implementation details are available `as pdf
329+
<https://github.com/ros-planning/moveit/blob/melodic-devel/moveit_planners/pilz_industrial_motion_planner/doc/MotionBlendAlgorithmDescription.pdf>`_.
330+
331+
Restrictions for ``MotionSequenceRequest``
332+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333+
334+
- Only the first goal may have a start state. Following trajectories
335+
start at the previous goal.
336+
- Two subsequent ``blend_radius`` spheres must not overlap.
337+
``blend_radius``\ (i) + ``blend_radius``\ (i+1) has to be smaller
338+
than the distance between the goals.
339+
340+
Action interface
341+
~~~~~~~~~~~~~~~~
342+
343+
In analogy to the ``MoveGroup`` action interface the user can plan and
344+
execute a ``moveit_msgs::MotionSequenceRequest`` through the action server
345+
at ``/sequence_move_group``.
346+
347+
In one point the ``MoveGroupSequenceAction`` differs from the standard
348+
MoveGroup capability: If the robot is already at the goal position, the
349+
path is still executed. The underlying PlannerManager can check, if the
350+
constraints of an individual ``moveit_msgs::MotionPlanRequest`` are
351+
already satisfied but the ``MoveGroupSequenceAction`` capability doesn't
352+
implement such a check to allow moving on a circular or comparable path.
353+
354+
See the ``pilz_robot_programming`` package for an `example python script
355+
<https://github.com/PilzDE/pilz_industrial_motion/blob/melodic-devel/pilz_robot_programming/examples/demo_program.py>`_
356+
that shows how to use the capability.
357+
358+
Service interface
359+
~~~~~~~~~~~~~~~~~
360+
361+
The service ``plan_sequence_path`` allows the user to generate a joint
362+
trajectory for a ``moveit_msgs::MotionSequenceRequest``. The trajectory is
363+
returned and not executed.
16.1 KB
Loading
173 KB
Loading

index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Configuration
6969
doc/ompl_interface/ompl_interface_tutorial
7070
doc/chomp_planner/chomp_planner_tutorial
7171
doc/stomp_planner/stomp_planner_tutorial
72+
doc/pilz_industrial_motion_planner/pilz_industrial_motion_planner
7273
doc/planning_adapters/planning_adapters_tutorial.rst
7374

7475
Miscellaneous

0 commit comments

Comments
 (0)