Ask Your Question
0

Is it possible to get the distance from the robot to an AR Tag?

asked 2015-07-27 08:48:29 -0500

shahvineet98 gravatar image

I am using the ar_track_alvar package to detect ar tags found here: markers

I launch the package using this command:

roslaunch ar_track_alvar ar_track_alvar 4.4 0.08 0.2 /camera/depth_registered/points /camera/rgb/camera_info /base_link

The tag detection works really well and the Kinect is able to detect the tags pretty well. I was wondering however if I could continuously get a distance from the robot to the tag with my callback function with the tag detection. I need some way of getting a distance to the tag. I am using a Create Base and using ROS Groovy.

I appreciate your help!

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
1

answered 2015-08-11 10:48:04 -0500

updated 2015-08-11 10:48:43 -0500

Using the markers as @Falko and @Mehdi. said is not the correct way to do this. Markers are intended for visualization only. ar_track_alvar broadcasts a tf frame for each ar tag. You can find the distance by using tf to lookup the transform from whatever robot frame you're interested in (e.g. base_link) to the tag's frame.

See:

edit flag offensive delete link more
0

answered 2015-08-11 08:03:53 -0500

Mehdi. gravatar image

ar_track_alvar publishes by default the detected markers to the topic : ar_pose_marker

You can see in this topic that the pose contains the distance from the camera to the marker in the variable pose.position.z

Alternatively, since you are using a kinect, you could recalculate the pixel at which the marker is centered and get its corresponding depth from the kinect.

In both cases you will get a distance from the marker to the camera and you need to use tf to transform it such that you get the distance from the marker to the create base.

edit flag offensive delete link more

Comments

How do you get the pixel at which the tag is centered? Where is that information?

haelannaleah gravatar imagehaelannaleah ( 2017-03-10 12:33:06 -0500 )edit

You have to compute it by yourself using the pose of the marker in camera frame (x, y, z) and the camera intrinsic parameters (focal length and principal point) which is available in the CameraInfo topic. https://en.wikipedia.org/wiki/Pinhole...

Mehdi. gravatar imageMehdi. ( 2017-03-21 04:14:28 -0500 )edit
0

answered 2015-08-11 07:49:30 -0500

The ar_track_alvar node should publish a set of markers, each containing a pose. This is the marker location and orientation in the robot's coordinate frame. The distance to the location (x,y,z) is the marker distance.

Is this what you were asking?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-07-27 08:48:29 -0500

Seen: 1,243 times

Last updated: Aug 11 '15