Checking self collision using MoveIt! APIs

We have seen how to detect collision in RViz, but what do we have to do if we want to get collision information in our ROS node. In this section, we will discuss how to get the collision information of our robot in an ROS code. This example can check self collision and environment collision, and also tell which links were collided. The example called check_collision.cpp is placed in the seven_dof_arm_test/src folder. This code is a modified version of the collision checking example of PR2 MoveIt! robot tutorials (https://github.com/ros-planning/moveit_pr2/tree/indigo-devel/pr2_moveit_tutorials).

In this code, the following snippet loads the kinematic model of the robot to the planning scene:

robot_model_loader::RobotModelLoader ...

Get ROS Programming: Building Powerful Robots now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.