Ask Your Question

Using tf to connect camera observed tag to base_link

asked 2016-02-16 19:16:45 -0500

hhhhhhhhh gravatar image

Dear community members,

I have a legged robot that walks around a floor and is being tracked by an overhead camera. This tracking is done with the ar_tag_alvar package which supplies me with a pose of the tag in camera frame. Please note that in a pose message no child frame is broadcasted. I would like to fuse this information with IMU data and odometry and to do this I use the robot_localization package. My understanding is that this package accepts all poses with covariance but assumes that the pose observed is the pose of the base_link in a certain frame. However, the tag I am using is statically attached on top of the robot so that a transform exists between the base link and a link that I will call "tag link". The full set up is drawn in the following figure.

image description

In which: C = Camera frame, T = Tag frame, B = Base frame. It is clear that knowing the pose of the tag in camera frame implies knowing the pose of the base in camera frame. Mathematically this is not a hard problem to solve when using, for example, homogeneous transformation matrices. This, however, looks like a problem that is so common in ROS that I am assuming tf is able to help me solve it instead of me coding out equations for a homogeneous transformation matrix.

How would I proceed solving this problem with tf? Or am I not seeing a functionality in robot_localization that will handle this, just like it does with the IMU?

edit retag flag offensive close merge delete


In what frame would you like the output data to be reported? Are you assuming the camera frame is your "world" frame?

Tom Moore gravatar image Tom Moore  ( 2016-03-01 12:28:42 -0500 )edit

There exists a static transformation between the camera and the world frame. I would like to know the position to be reported in world frame, yes.

hhhhhhhhh gravatar image hhhhhhhhh  ( 2016-03-01 17:35:09 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2016-03-07 13:51:39 -0500

Tom Moore gravatar image

I had a similar issue with navsat_transform_node and GPS sensors that are not mounted at the origin. You'll need to look up the transform from the base frame to the tag frame, rotate it by the robot's orientation in the world frame, then remove that rotated offset from the tag pose, and then fill out a new pose message with the output (change the frame_id to your world frame for that message) and then use that as input to the EKF.

Alternatively, you can create a new frame_id called tag_frame_world or something, and use the logic above to output the rotated base_frame->tag_frame as a transform from the world frame. In other words, you'd constantly broadcast a dynamic transform from odom (or whatever your world_frame is) to tag_frame_world. Then just change the frame_id in your messages to be tag_frame_world. Note that this would still require a new node or modified code in ar_tag_alvar.

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


Asked: 2016-02-16 19:16:45 -0500

Seen: 1,088 times

Last updated: Mar 07 '16