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

robot position and minimal distance to an obsacle

asked 2012-08-19 19:40:30 -0600

Astronaut gravatar image

updated 2014-01-28 17:13:23 -0600

ngrennan gravatar image


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


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-02-07 17:51:36 -0600

updated 2013-02-07 17:55:00 -0600

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.

edit flag offensive delete link more

Question Tools


Asked: 2012-08-19 19:40:30 -0600

Seen: 670 times

Last updated: Feb 07 '13