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 a ROS code. This example can check self collisions and environment collisions, and also tell which links were collided. The example called X 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. In this code, the following snippet loads the kinematic model of the robot to the planning scene:
robot_model_loader::RobotModelLoader robot_model_loader("robot_description"); robot_model::RobotModelPtr ...