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

Get distance from end effector to object face Gazebo

asked 2022-03-01 04:27:58 -0600

LeeAClift gravatar image

Hi,

I'm currently trying to get the distance between my Robot's (Kuka Youbot) end effector and an object in Gazebo (sometimes an imported model, sometimes just a unit cube) for some measurement experiments.

I'm thinking of trying a few different techniques, such as either using the Gazebo Plotting tool and doing some basic maths to work out the position of the edge (alongside the active position of the EE) or manually measuring on Rviz via Gazebo2Rviz.

I just want to check that I'm not missing an easier or more accurate technique?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2022-03-01 04:39:05 -0600

Why not use Gazebo's API to do this? If your robot's end-effector is moving obviously you need a constant need for distance measurement?

You can write a World Plugin for Gazebo, then get the world position of end-effector, as well as world position of the object, then simply calculate the Eucledean between these two.

You can find an example where I did something similar here;

edit flag offensive delete link more

Comments

Hi Fetullah,

Thank you for your quick reply and example code.

I noticed that the code you provided would get the distance between the end effector and object, which is mostly what I need to do.

Specifically, I need to get the distance between the end effector and a specific edge of the object it's tracing.

I'm assuming the best way to do this would be to run the code similar to what you provided and then add an offset manually to the end?

LeeAClift gravatar image LeeAClift  ( 2022-03-01 06:25:55 -0600 )edit

Yes, the distance you will get would be from the center of object to end-effector. If you need distance to the surface, that depends on the type of object, if it’s a sphere then the offset will simply be radius, if it is a cube there will be some math and trigonometry to solve that

Fetullah Atas gravatar image Fetullah Atas  ( 2022-03-01 07:48:34 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2022-03-01 04:27:58 -0600

Seen: 171 times

Last updated: Mar 01 '22