ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

The first thing you need is to segment out the obstacle from the other objects in the environment. This might or might not be tricky, depending on the environment and the sensors you want to use.

You can either use a laser or a generic pointcloud (coming from a stereo/range camera or a tilting laser). The latter is the most generic and you can always convert a laser message to a pointcloud. However if you are interested in a gazebo simulation only, then a laser will be easier.

Then for every point in the pointcloud, you can transform it to the coordinate system you prefer (e.g. for the PR2 it would be baselink) and a simple euclidean distance will give you the answer.

If you are using the laser only, then the minimum in the range field of the laser message will give you the closest point.