treat tf parent as child
Hi everybody,
I am using the apriltagros 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 usbcam-->tag2 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?
Asked by Lennart on 2020-05-26 04:05:40 UTC
Answers
To localize a robot base given a known position of an apriltag I would suggest these steps:
Make sure you have a robot model with URDF that uses robot_state_publisher
Launch a static transform broadcaster to publish a transform from map frame to tag frame
Create a ROS node that subscribes to the apriltag detected tags
When a apriltag is detected, get the transform of tag w.r.t. robot base
Now calculate the transform of robot base w.r.t. tag (inverse transform of #4)
Calculate the transform of robot base w.r.t. map (pose of robot base in the map coordinates)
Broadcast the last transform (calculated in step #6)
Asked by Roberto Z. on 2020-05-28 04:42:50 UTC
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?Asked by fvd on 2020-05-26 06:56:55 UTC
Is your camera fixed to a mobile base or is it also fixed to the world?
Asked by Roberto Z. on 2020-05-26 08:43:52 UTC
@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.
Asked by Lennart on 2020-05-27 08:40:22 UTC