ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# robot position and minimal distance to an obsacle

Hello

I want to ask some question regarding robot position and orientation in the space and his minimal distance to some obstacle point. I want to calculate a minimal distance between the robot and some object in the map. Im using amcl for localisation and only laser scan datas. So my robot is assumed as rectangle and a obstacle as a simple line in the wall. So mathematically it is a minimal distance between a point and a line ( assume only 2d because the z coordinate is always 0). So Im using TF transform to label a line coordinate to the map frame. Than calling the TF functions can do those mathematically distance calculation. But my problem is the robot position and orientation during the time. Because during the time the robot change his position and orientation and it has rectangular dimension I have to find that closest point in the rectangle to calculate the disctance. So I know that have to use the geometry_msgs/Quaternion Message but any code help or some advice. ??

Thanks

edit retag close merge delete

Sort by » oldest newest most voted

Assuming the obstacles are polygons (or polylines), the will always be a line of shortest distance between the robot and the obstacle that contains a vertex of at least one of them. So, to get an exact answer, you can search among minimal lines connecting vertices to edges between the robot and the obstacle. In practice that will not scale well, so you may want to look at something involving bounding volumes to get fast approximations.

more