Ask Your Question
1

Is it possible to delete a static TFs

asked 2019-01-03 04:23:29 -0600

mgangl gravatar image

updated 2019-01-03 04:26:08 -0600

Hello ros community, I am using static TFs for the Transformation between Robot Flansch and TCP. Now i wonder if i am able to get rid of ones sent static tfs (broadcaster = tf2_ros.StaticTransformBroadcaster()). Atm I am just able to send a new static TF for a new TCP. But the “old” static TF is then ofc still in the “TF Broadcaster” and visible in Rviz.

I thought, I ones red something about it, but now I cannot find a solution in the documentation.

best wishes and a happy new Year mgangl

edit retag flag offensive close merge delete

Comments

If you stop publishing a TF then it should be graphically shown to fade out in RVIZ after a few seconds. It may remain in the list because RVIZ remembers it was published in the past, but if a TF hasn't been published for a 60 seconds or more it realistically no longer exists.

PeteBlackerThe3rd gravatar imagePeteBlackerThe3rd ( 2019-01-03 06:42:55 -0600 )edit

you are right for using the "TransformBroadcaster()", but i am talking about the "StaticTransformBroadcaster()". The idea is to publish a TF only once, since it is STATIC.

mgangl gravatar imagemgangl ( 2019-01-03 08:04:26 -0600 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2019-03-04 11:46:50 -0600

lucasw gravatar image

You could republish the static tf with the same child_frame_id but with a new parent that detaches it from your tf tree- the parent should have no static or dynamic transforms to any other frame in your scene. This will produce exceptions in lookups that try to use it which need to be handled appropriately, rviz will have some complaints (e.g. No transform from [foo] to frame [bar]) about it but anything hanging off of that child frame should disappear. I just now tested this with rviz tf, not robot model or Markers but they should disappear also.

edit flag offensive delete link more
0

answered 2019-01-03 08:11:04 -0600

This will make more sense if I explain how the TF system works because even static transforms need broadcasting at regular intervals.

ROS components that are consumers of TF information use a TF listener, this listener is created not knowing any transforms. It listens to the TF topic and over time receives TF messages which allow it to fill up a buffer of TF information so it can solve TF queries. So if a TF isn't being regularly broadcast, even if it's static, then consumers of TF information will not know that TF exists. This is the reason why you specify a frequency when creating a static transform publisher node.

As such there is not concept of 'deleting' a transform. But if it's no longer published eventually it will no longer be present in the TF buffers of all registered listener objects, at this point it effectively no longer exists.

Hope this makes sense.

edit flag offensive delete link more

Comments

1

[..] because even static transforms need broadcasting at regular intervals.

Static TF works slightly different: under the hood, latching publishers are used for static TF broadcasters, removing the need for period republishing of the same transform, which was the goal of TF2 and static TFs.

gvdhoorn gravatar imagegvdhoorn ( 2019-01-03 08:13:37 -0600 )edit

hmm, but if the listener is created before the static TF got broadcasted it is in the buffer of the listener. I guess i have to test it, but in this Scenario the static TF will stay for that listener for ever.

I also guess, that rviz has just an build in listener.

mgangl gravatar imagemgangl ( 2019-01-03 08:19:25 -0600 )edit

@gvdhoorn  thanks for clarifying. Sry for the question again. I just want to be sure. Is there a way to delete static tfs? i guess not.

mgangl gravatar imagemgangl ( 2019-01-11 06:09:17 -0600 )edit

"deleting a TF" is a strange question, as it implies that they are stored somewhere and then retrieved. It doesn't work that way. As Peter already explained, consumers receive broadcasted transforms and cache them locally. Any queries inside those consumers are performed against that local cache. ..

gvdhoorn gravatar imagegvdhoorn ( 2019-01-11 07:49:00 -0600 )edit

.. If a consumer has never heard of a transform, queries for it will fail.

There is no "delete" operation defined for TF publications. Simply not broadcasting them means that information about them will go stale, and eventually queries will return errors as timestamps will have diverged too ..

gvdhoorn gravatar imagegvdhoorn ( 2019-01-11 07:50:13 -0600 )edit

.. much from when the last information about a transform was received.

Latching publishers make this all a bit more difficult, as late joiners will always receive the last message published on those topics, even if it is (very) old. So with static TF, the publisher should not be around any more ..

gvdhoorn gravatar imagegvdhoorn ( 2019-01-11 07:51:17 -0600 )edit

.. for a transform to "not exist" any more (but note again: that is a strange thing to say). Or the last msg broadcast by a producer of transforms must not include any information about a transform any longer. In that case consumers will not receive it (and late joiners will never have seen it).

gvdhoorn gravatar imagegvdhoorn ( 2019-01-11 07:52:41 -0600 )edit

Ok thanks. Nevertheless, i think a functionality to rename or delete STATIC TFs would be a nice to have. Ty for your time.

mgangl gravatar imagemgangl ( 2019-01-11 07:53:45 -0600 )edit

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: 2019-01-03 04:23:29 -0600

Seen: 371 times

Last updated: Mar 04