geometry2 icon indicating copy to clipboard operation
geometry2 copied to clipboard

Add new tf_static broadcaster class which can handle more instances per node

Open Timple opened this issue 5 years ago • 12 comments

Solves #406

Timple avatar Oct 22 '20 10:10 Timple

I guess the implemented behavior should just become the default behavior for normal static TF broadcaster, as the C++ counterpart does exactly the same... Having this duality in the interface really seems wrong to me.

peci1 avatar Jan 18 '21 16:01 peci1

And, the other way round, the statically printed warning could get into to C++ counterpart, as the same limitation applies there, too.

peci1 avatar Jan 18 '21 16:01 peci1

the C++ counterpart does exactly the same

Has the same bug? Or the same fix?

Timple avatar Jan 19 '21 11:01 Timple

It has the behavior of aggregating all received transforms and sending the aggregate every time.

peci1 avatar Jan 19 '21 12:01 peci1

https://github.com/ros/geometry2/blob/c73b5939723db078c9bbe18523230ad54f859682/tf2_ros/src/static_transform_broadcaster.cpp#L46-L62

peci1 avatar Jan 19 '21 12:01 peci1

the statically printed warning could get into to C++ counterpart, as the same limitation applies there, too.

So then the warning is not required in C++?

Timple avatar Jan 19 '21 12:01 Timple

No, it can still happen that you e.g. compose two nodelets, each with its own static broadcaster. The warning should thus be added to C++, too.

Or, maybe, the solution with static (global) publisher object could be ported to C++, too. But I'm not 100% sure how would that play with the plugin/nodelet loading mechanism. And adding global variables isn't a nice thing, but it could actually solve a lot of headaches and make nodelets safely composable. Do you think you could work on the C++ part or should I try to grasp it?

peci1 avatar Jan 19 '21 13:01 peci1

Feel free to grasp it!

I won't put the effort in the c++ part since I haven't run into that yet :slightly_smiling_face:

Timple avatar Jan 19 '21 13:01 Timple

Before this PR is merged, I've released a standalone version with the proposed solution for Python:

http://docs.ros.org/en/noetic/api/cras_py_common/html/cras.html#module-cras.static_transform_broadcaster from package http://wiki.ros.org/cras_py_common .

peci1 avatar Oct 14 '22 08:10 peci1

Yeah, it's a bummer that we need to release custom packages with such minor fixes because they don't get merged or reviewed :slightly_frowning_face:

Timple avatar Oct 14 '22 09:10 Timple

I've added this as a seperate class in the hope this would be easier to accept this change. Since that does not seem the case, should we fix the original implementation?


And if we're doing aggregation there should be at least some way to also delete/remove the transforms

Not sure I agree. The standard implementation is a latched topic. Here the tf could also only be cleared by deleting the publisher . It could not be revoked. I have not seen this in practice, so why would we need that feature here?


Also it would be good to add at least a basic test

Agreed! Will do

Timple avatar Nov 23 '22 06:11 Timple

And if we're doing aggregation there should be at least some way to also delete/remove the transforms besides unloading the python module.

As discussed in https://github.com/ros/geometry2/issues/370, deleting static TFs is not a supported feature (and will never be in ROS 1). To work around this limitation, you can disconnect the transform from the tree (which is a use-case that should be explicitly checked in the unit tests, e.g. transform body->wheel changing to nonexistent->wheel).

peci1 avatar Nov 23 '22 11:11 peci1