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

Distance between two robots in gazebo?

asked 2016-04-19 18:38:46 -0500

jwidauer gravatar image

Is there an easy way to calculate the distance between two robots in gazebo?

If you have, for instance, the names of both robots, I would then like to be able to have a function which would allow me to easily calculate the minimum euclidean distance plus distance vector between the visual meshes of the two robots.

Is there something like that already implemented?

The distance between a point and a robot would be even better.

I've looked online and was not able to find anything useful, except the pointer to the fcl library. Is that really the only way to go?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-04-20 12:20:12 -0500

lucasw gravatar image

If you spawned the robots from urdf/xacro files through gazebo_ros_pkgs the two robots should have positions in tf that you can query with standard tf transform lookups, you can get an xyz distance to one robot in the frame of the other robot, and then you can get the L2 norm to get the distance.

An easy way to see if the tfs exist is to launch rviz and start a tf plugin.

If the robots aren't brought up through ros try http://answers.gazebosim.org .

edit flag offensive delete link more

Comments

I knew about that, but have the problem that I want the minimal distance between the two robot models. Meaning the distance from one visual model to the other. I think I'll ask the question again on the gazebosim site, since I believe that fits the problem better. Thanks for your answer anyway.

jwidauer gravatar image jwidauer  ( 2016-04-20 12:49:42 -0500 )edit

Like the closest distance between the surface of the meshes? That sounds involved... like you need to get access to the mesh vertices, transform them into a common frame, and then search through them (ideally not brute force) and calculate distances between pairs.

lucasw gravatar image lucasw  ( 2016-04-20 14:13:05 -0500 )edit

And I see that is what https://github.com/flexible-collision... does. So you'd have a node getting the transforms from tf, then feeding that info into fcl which would have independently loaded the meshes. If ode/bullet can do it maybe a gazebo plugin could access that.

lucasw gravatar image lucasw  ( 2016-04-20 14:16:27 -0500 )edit

Yeah that's exactly what I want to do and the idea I had. I just wanted to ask if there is something like that already implemented, so I wouldn't have to deal with that mess. But looks like I'll have to implement it on my own.

jwidauer gravatar image jwidauer  ( 2016-04-20 14:35:04 -0500 )edit

Question Tools

Stats

Asked: 2016-04-19 18:38:46 -0500

Seen: 2,002 times

Last updated: Apr 20 '16