Robotics StackExchange | Archived questions

The topic /tf doesn't publish frame ID "camera" pose.

As the title says,I'm using the Apriltag on ROS to localization , the /tf has publish the pose with "camera"->"tagid" and "camera"->"mybundle", and the rviz is worked well("camera" is the parents frame ID , "tagid" and "mybundle" is the child frame ID).

And this is the problem, how can I get the "camera" pose shown in the Figure(red line) , Instead of the mybundle ("camera"->"mybundle") pose(orange line).

This is the Figure file: https://drive.google.com/file/d/1cq6A4AvnyD4a5oMgy_V4DWtpeBxysii1/view?usp=sharing

with kind regards, Mingchi

Asked by mingchi on 2021-06-26 04:47:13 UTC

Comments

Answers

The /tf_static topic carries additional transform data. I'll assume you are using rospy. There are routines in the tf2_ros package that calculate the transform between any two frames, or calculate a pose in a specified frame. For example, look at:

m = tf_buffer.lookup_transform(parent, child, time)

Asked by Mike Scheutzow on 2021-06-26 14:58:51 UTC

Comments

I'm using roscpp , and I tried : listener.waitForTransform("camera", "my_bundle", ros::Time(0), ros::Duration(3.0)); listener.lookupTransform("camera", "my_bundle", ros::Time(0), transform);

but terminal always call back :

"camera" passed to lookupTransform argument target_frame does not exist.

However, the "camera" is acturly exist.

Asked by mingchi on 2021-06-26 22:25:03 UTC

In the rviz image you posted, frame "camera" has no parent frame. This implies that it is not connected to the rest of the transform tree.

Asked by Mike Scheutzow on 2021-06-27 07:23:36 UTC

As you said, "camera" has no parent frame ID, but my TF tree only has "camera", "tag_ID" and "my_bundle", and "camera" is the parent of "tag_ID" and "my_bundle".

This means that the "camera" cannot use lookupTransform?

I use sendtransform to know the "my_bundle" and the "camera" TF, but as the figure you saw, the published TF doesn't mean the posture of "camera" when the fixed frame is "my_bundle".

So how do I know the posture of the "camera" when the fixed frame is "my_bundle"?

Asked by mingchi on 2021-06-27 07:47:36 UTC

Your original question was how to get the pose of "camera" frame. It doesn't really make sense to ask for the pose (more accurately: transform) of the frame at the top of the TF tree.

Regarding your lookupTransform() call, it looks ok to me, assuming the necessary data has actually been published on /tf or /tf_static since you started the node. You need to be careful of what you see in rviz, which will cache previously-published transforms that are no longer being published; in that situation the lookupTransform() call will fail. You can clear the rviz cache by clicking the "Reset" button in the lower left corner of rviz.

Asked by Mike Scheutzow on 2021-06-27 12:09:10 UTC

"Your original question was how to get the pose of "camera" frame. It doesn't really make sense to ask for the pose (more accurately: transform) of the frame at the top of the TF tree."

I didn't phrase this well. Please ignore these two sentences.

Asked by Mike Scheutzow on 2021-06-27 12:19:40 UTC