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

treat tf parent as child

asked 2020-05-26 04:05:40 -0500

Lennart gravatar image

updated 2020-05-27 09:00:53 -0500

Hi everybody, I am using the april_tag_ros package where I get a tf Frame usb_cam -->tag_2. While the camera is detecting a apriltag.

I want to have a tf-tree where the transform world --> camera1 equals tag_2 --> usb_cam.

I tried it with static_transform_publisher that world-->tag2 and usb_cam-->camera1 but than the connection between usb_cam and tag_2 get lost (means when I run rosrun tf tf_view there is no direkt connection between usb_cam and tag_2).

I read that for getting the inverse Frame from a --> b I can use tf tf_echo b a. So I tried that with static_transform_publisher but here I lost another connection.

Can somebody help me?

Greetings

Edit1: Probably I have to write a short skript which listens to the transform usb_cam-->tag_2 and publish the inverse as the transform world-->camera1. Does tf have an inverse-matrix-modul for c++? I read that this exist in tf2. Actually my packages are working with tf. What is easiest way to programm that?

edit retag flag offensive close merge delete

Comments

To start with, I don't understand why you want to connect tag_2 with the world, why the camera would be a child of the tag, and how a connection "gets lost". Surely your camera is still publishing the transform from the camera from the tag?

fvd gravatar image fvd  ( 2020-05-26 06:56:55 -0500 )edit

Is your camera fixed to a mobile base or is it also fixed to the world?

Roberto Z. gravatar image Roberto Z.  ( 2020-05-26 08:43:52 -0500 )edit

@roberto: To clear that. I want to have a moveable camera (means fixed to a mobile base). But the Tag_2 is fixed to the world. This should update every time when the transform usb_cam -->tag_2 is updated.

@fvd: "get lost" means when I run rosrun tf tf_view there is no direkt connection between usb_cam and tag_2. When I stop the static_transform_publisher the connection is there again.

Probably I have to write a short skript which listens to the transform usb_cam-->tag_2 and publishs the inverse as the transform world-->camera1.

Lennart gravatar image Lennart  ( 2020-05-27 08:40:22 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-05-28 04:42:50 -0500

Roberto Z. gravatar image

To localize a robot base given a known position of an apriltag I would suggest these steps:

  1. Make sure you have a robot model with URDF that uses robot_state_publisher

  2. Launch a static transform broadcaster to publish a transform from map frame to tag frame

  3. Create a ROS node that subscribes to the apriltag detected tags

  4. When a apriltag is detected, get the transform of tag w.r.t. robot base

  5. Now calculate the transform of robot base w.r.t. tag (inverse transform of #4)

  6. Calculate the transform of robot base w.r.t. map (pose of robot base in the map coordinates)

  7. Broadcast the last transform (calculated in step #6)

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-05-26 04:05:40 -0500

Seen: 539 times

Last updated: May 28 '20