Skip to content

Commit 8f000ae

Browse files
committed
Adapt chomp tutorial to panda_moveit_config (#464)
* adapt chomp tutorial to panda_moveit_config * chomp post-processing: a solution not modifying the original ompl pipeline Instead of modifying the ompl pipeline, we now describe how to configure a new ompl-chomp pipeline that reuses the existing ompl and chomp configs.
1 parent 701d5ad commit 8f000ae

2 files changed

Lines changed: 31 additions & 48 deletions

File tree

doc/chomp_planner/chomp_planner_tutorial.rst

Lines changed: 30 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,12 @@ Using CHOMP with Your Robot
2525
#. Adjust the line ``<rosparam command="load" file="$(find panda_moveit_config)/config/chomp_planning.yaml" />`` to ``<rosparam command="load" file="$(find <robot_moveit_config>)/config/chomp_planning.yaml" />`` replacing ``<robot_moveit_config>`` with the name of your MoveIt configuration package.
2626
#. Download :panda_codedir:`chomp_planning.yaml <config/chomp_planning.yaml>` file into the config directory of your MoveIt config package. In our case, we will save this file in the ``panda_moveit_config/config`` directory.
2727
#. Open ``chomp_planning.yaml`` in your favorite editor and change ``animate_endeffector_segment: "panda_rightfinger"`` to the appropriate link for your robot.
28-
#. Copy the ``demo.launch`` file to ``demo_chomp.launch``. Note that this file is also in the launch directory of your MoveIt config package. In our case, the ``panda_moveit_config/launch`` directory.
29-
#. Find the lines where ``move_group.launch`` is included and change it to: ::
30-
31-
<!-- Replace <robot_moveit_config> with the name of your MoveIt configuration package -->
32-
<include file="$(find <robot_moveit_config>)/launch/move_group.launch">
33-
<arg name="allow_trajectory_execution" value="true"/>
34-
<arg name="fake_execution" value="true"/>
35-
<arg name="info" value="true"/>
36-
<arg name="debug" value="$(arg debug)"/>
37-
<arg name="planner" value="chomp" />
38-
</include>
39-
#. Open the ``move_group.launch`` file in your ``<robot_moveit_config>/launch/`` folder and make two changes.
40-
41-
* First, add ``<arg name="planner" default="ompl" />`` just under the ``<launch>`` tag, and,
42-
43-
* Second, within the ``<include ns="move_group">`` tag replace ``<arg name="pipeline" value="ompl" />`` with ``<arg name="pipeline" value="$(arg planner)" />``.
4428

4529
Running the Demo
4630
----------------
4731
If you have the ``panda_moveit_config`` from the `ros-planning/panda_moveit_config <https://github.com/ros-planning/panda_moveit_config>`_ repository you should be able to simply run the demo: ::
4832

49-
roslaunch panda_moveit_config demo_chomp.launch
33+
roslaunch panda_moveit_config demo.launch pipeline:=chomp
5034

5135
Running CHOMP with Obstacles in the Scene
5236
+++++++++++++++++++++++++++++++++++++++++
@@ -58,7 +42,7 @@ This script creates a cluttered scene with four obstacles or a simple scene with
5842

5943
To run the CHOMP planner with obstacles, open two shells. In the first shell start RViz and wait for everything to finish loading: ::
6044

61-
roslaunch panda_moveit_config demo_chomp.launch
45+
roslaunch panda_moveit_config demo.launch pipeline:=chomp
6246

6347
In the second shell, run either of the two commands: ::
6448

@@ -122,37 +106,36 @@ CHOMP: While most high-dimensional motion planners separate trajectory generatio
122106

123107
For scenes containing obstacles, CHOMP often generates paths which do not prefer smooth trajectories by addition of some noise (*ridge_factor*) in the cost function for the dynamical quantities of the robot (like acceleration, velocity). CHOMP is able to avoid obstacles in most cases but it can fail if it gets stuck in the local minima due to a bad initial guess for the trajectory. OMPL can be used to generate collision-free seed trajectories for CHOMP to mitigate this issue.
124108

125-
Using OMPL as a pre-processor for CHOMP
126-
---------------------------------------
109+
Using CHOMP as a post-processor for OMPL
110+
----------------------------------------
127111
Here, it is demonstrated that CHOMP can also be used as a post-processing optimization technique for plans obtained by other planning algorithms. The intuition behind this is that some randomized planning algorithm produces an initial guess for CHOMP. CHOMP then takes this initial guess and further optimizes the trajectory.
128112
To achieve this, follow the steps:
129113

130-
#. Open the ``ompl_planning_pipeline.launch`` file in the ``<robot_moveit_config>/launch`` folder of your robot. For the Panda robot it is :panda_codedir:`this <launch/ompl_planning_pipeline.launch.xml>` file. Edit this launch file, find the lines where ``<arg name="planning_adapters">`` is mentioned and change it to: ::
131-
132-
<arg name="planning_adapters"
133-
value="default_planner_request_adapters/FixWorkspaceBounds
134-
default_planner_request_adapters/FixStartStateBounds
135-
default_planner_request_adapters/FixStartStateCollision
136-
default_planner_request_adapters/FixStartStatePathConstraints
137-
chomp/OptimizerAdapter
138-
default_planner_request_adapters/AddTimeParameterization" />
139-
140-
#. The order of the ``planning_adapters`` is the order in which the mentioned adapters are called / invoked. Inside the CHOMP adapter, a :moveit_codedir:`call <moveit_planners/chomp/chomp_optimizer_adapter/src/chomp_optimizer_adapter.cpp#L169>` to OMPL is made before invoking the CHOMP optimization solver, so CHOMP takes the initial path computed by OMPL as the starting point to further optimize it.
141-
142-
#. Find the line where ``<rosparam command="load" file="$(find panda_moveit_config)/config/ompl_planning.yaml"/>`` is mentioned and after this line, add the following: ::
143-
144-
<rosparam command="load" file="$(find panda_moveit_config)/config/chomp_planning.yaml"/>
145-
146-
#. These additions will add a CHOMP Optimization adapter and load the corresponding CHOMP planner's parameters. To do this with your own robot replace ``panda_moveit_config`` to ``<my_robot>_moveit_config`` of your robot.
147-
148-
#. In the ``move_group.launch`` file of ``<robot_moveit_config>/launch`` folder for your robot, make sure that the default planner is ``ompl``.
149-
150-
#. In the ``chomp_planning.yaml`` file of ``<robot_moveit_config>/config`` folder for your robot, add the following line: ::
151-
152-
trajectory_initialization_method: "fillTrajectory"
153-
154-
#. After making these requisite changes to the launch files, open a terminal and execute the following: ::
155-
156-
roslaunch panda_moveit_config demo_chomp.launch
114+
#. Create a new launch file ``ompl-chomp_planning_pipeline.launch`` in the ``<robot_moveit_config>/launch`` folder of your robot with the following contents: ::
115+
116+
<launch>
117+
<!-- load OMPL planning pipeline, but add the CHOMP planning adapter. -->
118+
<include file="$(find panda_moveit_config)/launch/ompl_planning_pipeline.launch.xml">
119+
<arg name="planning_adapters" value="
120+
default_planner_request_adapters/FixWorkspaceBounds
121+
default_planner_request_adapters/FixStartStateBounds
122+
default_planner_request_adapters/FixStartStateCollision
123+
default_planner_request_adapters/FixStartStatePathConstraints
124+
chomp/OptimizerAdapter
125+
default_planner_request_adapters/AddTimeParameterization"
126+
/>
127+
</include>
128+
<!-- load chomp config -->
129+
<rosparam command="load" file="$(find panda_moveit_config)/config/chomp_planning.yaml"/>
130+
<!-- override trajectory_initialization_method -->
131+
<param name="trajectory_initialization_method" value="fillTrajectory"/>
132+
</launch>
133+
134+
#. This launch file defines the new planning pipeline ``ompl-chomp``, deriving from the ``ompl`` pipeline,
135+
but adding the CHOMP post-processor as a planning adapter. Also, the ``trajectory_initialization_method`` is overriden to use the OMPL-generated trajectory.
136+
137+
#. Now you can launch the newly configure planning pipeline as follows: ::
138+
139+
roslaunch panda_moveit_config demo.launch pipeline:=ompl-chomp
157140

158141
This will launch RViz, select OMPL in the Motion Planning panel under the Context tab. Set the desired start and goal states by moving the end-effector around in the same way as was done for CHOMP above. Finally click on the Plan button to start planning. The planner will now first run OMPL, then run CHOMP on OMPL's output to produce an optimized path.

doc/planning_adapters/planning_adapters_tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ To achieve this, follow the steps:
6464

6565
#. After making these requisite changes to the launch files, open a terminal and execute the following: ::
6666

67-
roslaunch panda_moveit_config demo_chomp.launch
67+
roslaunch panda_moveit_config demo.launch pipeline:=chomp
6868

6969
This will launch RViz, select OMPL in the Motion Planning panel under the Context tab. Set the desired start and goal states by moving the end-effector around in the same way as was done for CHOMP above. Finally click on the Plan button to start planning. The planner will now first run OMPL, then run CHOMP on OMPL's output to produce an optimized path.
7070

0 commit comments

Comments
 (0)