CHOMP Planner

../../_images/chomp.png

Covariant Hamiltonian optimization for motion planning (CHOMP) is a novel gradient-based trajectory optimization procedure that makes many everyday motion planning problems both simple and trainable (Ratliff et al., 2009c). While most high-dimensional motion planners separate trajectory generation into distinct planning and optimization stages, this algorithm capitalizes on covariant gradient and functional gradient approaches to the optimization stage to design a motion planning algorithm based entirely on trajectory optimization. Given an infeasible naive trajectory, CHOMP reacts to the surrounding environment to quickly pull the trajectory out of collision while simultaneously optimizing dynamical quantities such as joint velocities and accelerations. It rapidly converges to a smooth collision-free trajectory that can be executed efficiently on the robot. Integration into latest version of MoveIt! is work in progress. More info

Getting Started

If you haven’t already done so, make sure you’ve completed the steps in Getting Started.

You should also have gone through the steps in Visualization with MoveIt! RViz Plugin

Prerequisites

  1. You must have the latest version of MoveIt! installed. On ROS Kinetic you will need to build MoveIt! from source. A build from source is required as CHOMP is not part of the official release yet. It is therefore not included in the binary packages. We will go through the steps for doing this below.
  2. To use CHOMP with your robot you must already have a MoveIt! configuration package for your robot already. For example, if you have a Panda robot, it’s probably called panda_moveit_config. This is typically built using the MoveIt! Setup Assistant.

Installing MoveIt! from Source

As you add and remove packages from your workspace you will need to clean your workspace and re-run the command to install new missing dependencies. Clean your workspace to remove references to the system wide installation of MoveIt!:

cd ~/ws_moveit/src
catkin clean

Now follow the instructions on the MoveIt! homepage for installing MoveIt! Kinetic from source. Note that you can skip the Prerequisites section since you should already have a Catkin workspace.

Re-source the setup files:

source ~/ws_moveit/devel/setup.bash

Using CHOMP with Your Robot

Note: if you are following this demo using the panda_moveit_config from the ros-planning/panda_moveit_config repository, these steps are already done for you and you can skip this section.

  1. Simply download chomp_planning_pipeline.launch.xml file into the launch directory of your MoveIt! config package. In our case, we will save this file in the panda_moveit_config/launch directory.

  2. 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.

  3. Download 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.

  4. Open chomp_planning.yaml in your favorite editor and change animate_endeffector_segment: "panda_rightfinger" to the appropriate link for your robot.

  5. 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.

  6. Find the lines where move_group.launch is included and change it to:

    <!-- Replace <robot_moveit_config> with the name of your MoveIt! configuration package -->
    <include file="$(find <robot_moveit_config>)/launch/move_group.launch">
      <arg name="allow_trajectory_execution" value="true"/>
      <arg name="fake_execution" value="true"/>
      <arg name="info" value="true"/>
      <arg name="debug" value="$(arg debug)"/>
      <arg name="planner" value="chomp" />
    </include>
    
  7. Open the move_group.launch file in your <robot_moveit_config>/launch/ folder and make two changes.

  • First, add <arg name="planner" default="ompl" /> just under the <launch> tag, and,
  • Second, within the <include ns="move_group"> tag replace <arg name="pipeline" value="ompl" /> with <arg name="pipeline" value="$(arg planner)" />.

Running the Demo

If you have the panda_moveit_config from the ros-planning/panda_moveit_config repository you should be able to simply run the demo:

roslaunch panda_moveit_config demo_chomp.launch

Running CHOMP with Obstacles in the Scene

To run CHOMP in an evironment with obstacles, you can run the sample python script:

This scripts creates a cluttered scene with four ostacles or a simple scene with one obstacle depending on the argument given to the script. One can also change the position/size of the obstacles to change the scene.

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

roslaunch panda_moveit_config demo_chomp.launch

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

rosrun moveit_tutorials collision_scene_example.py cluttered

or:

rosrun moveit_tutorials collision_scene_example.py sparse

Next, in RViz, select CHOMP in the MotionPlanning pannel under the Context tab. Set the desired start and goal states by moving the end-effector around with the imarker and then click on the Plan button under the Planning tab in the MotionPlanning pannel to start planning. The planner will now attempt to find a feasible solution between the given start and end position.

Tweaking some of the parameters for CHOMP

CHOMP has some optimization parameters associated with it. These can be modified for the given environment/robot you are working with and is normally present in the chomp_planning.yaml file in config folder of the robot you are working with. If this file does not exist for your robot, you can create it and set the parameter values as you want. The following are some of the insights to set up these parameter values for some of them:

  • planning_time_limit: the maximum time the optimizer can take to find a solution before terminating
  • max_iterations: this is the maximum number of iterations that the planner can take to find a good solution while optimization
  • max_iterations_after_collision_free: maximum iterations to be performed after a collision free path is found.
  • smoothness_cost_weight: the smoothness_cost_weight parameters controls its weight in the final cost that CHOMP is actually optimizing over
  • obstacle_cost_weight: this controls the weight to be given to obstacles towards the final cost CHOMP optimizes over. e.g., 0.0 would have obstacles to be ignored, 1.0 would be a hard constraint
  • learning_rate: this is the learning rate used by the optimizer to find the local / global minima while reducing the total cost.
  • smoothness_cost_velocity, smoothness_cost_acceleration, smoothness_cost_jerk: variables associated with the cost in velocity, acceleration and jerk.
  • ridge_factor: the noise added to the diagnal of the total quadratic cost matrix in the objective function. Addition of small noise (e.g., 0.001) allows CHOMP to avoid obstacles at the cost of smoothness in trajectory.
  • use_pseudo_inverse: enable pseudo inverse calculations or not.
  • pseudo_inverse_ridge_factor: set the ridge factor if pseudo inverse is enabled.
  • joint_update_limit: set the update limit for the robot joints
  • collision_clearance: the minimum distance that needs to be maintained to avoid obstacles.
  • collision_threshold: the collision threshold cost that needs to be mainted to avoid collisions
  • use_stochastic_descent: set this to true/false if you want to use stochastic descent while optimizing the cost. In stochastic descent, a random point from the trajectory is used, rather than all the trajectory points. This is faster and guaranteed to converge, but it may take more iterations in the worst case.

Choosing parameters for CHOMP requires some sort of intuition based on the environment we are working in. One can have the default parameters for CHOMP and this works well in environments without obstacles. However in cases where the scene is populated with obstacles, we need to vary some parameters to ensure that CHOMP is not stuck in local minima, or quickly finds optimal solutions, prefering trajectories which ovoids obstacles. Some parameters like increasing the ridge_factor to say 0.001 makes CHOMP avoids obstacles by not prefering smooth trajectories, so there is a trade-off between smoothness and CHOMP’s ability to avoid obstacles. Choosing the correct number of max_iterations, learning_rate is important based on the environment we are working in. Not choosing the appropriate CHOMP parameters might lead to CHOMP reporting not finding a collision free path. collision_clearance, collision_threshold parameters are useful in specifying the minimum distance to be kept from obstacles to avoid collisions.

Some of the unused/commented parameters are hmc_stochasticity, hmc_annealing_factor, hmc_discretization, use_hamiltonian_montecarlo, animate_endeffector, animate_endeffector_segment, animate_path, random_jump_amount, add_randomness.

Difference between plans obtained by CHOMP and OMPL

Optimizing planners optimize a cost function that may sometimes lead to surprising results: moving through a thin obstacle might be lower cost than a long, winding trajectory that avoids all collisions. In this section we make a distinction between paths obtained from CHOMP and contrast it to those obtained from OMPL.

OMPL is a open source library for sampling based / randomized motion planning algorithms. Sampling based algorithms are probabilistically complete: a solution would be eventually found if one exists, however non-existence of a solution cannot be reported. These algorithms are efficient and usually find a solution quickly. OMPL does not contain any code related to collision checking or visualization as the designers of OMPL did not want to tie it to a any particular colision checker or visualization front end. The library is designed so it can be easily integrated into systems that provide the additional components. MoveIt integrates directly with OMPL and uses the motion planners from OMP as its default set of planners. The planners in OMPL are abstract; i.e. OMPL has no concept of a robot. Instead, MoveIt! configures OMPL and provides the back-end for OMPL to work with problems in Robotics.

CHOMP: While most high-dimensional motion planners separate trajectory generation into distinct planning and optimization stages, CHOMP capitalizes on covariant gradient and functional gradient approaches to the optimization stage to design a motion planning algorithm based entirely on trajectory optimization. Given an infeasible naive trajectory, CHOMP reacts to the surrounding environment to quickly pull the trajectory out of collision while simultaneously optimizing dynamical quantities such as joint velocities and accelerations. It rapidly converges to a smooth collision-free trajectory that can be executed efficiently on the robot. A covaraint update rule ensures that CHOMP quickly converges to a locally optimal trajectory.

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 obstacle in most cases but also fails in some if it gets stuck in the local minima and might report a solution not found due to a naive initial guess for the trajectory. OMPL on the other hand generates collision free smooth paths in the presence of obstacles too.

Open Source Feedback

See something that needs improvement? Please open a pull request on this GitHub page