Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an API to clear out cached static transforms. #523

Closed
wants to merge 1 commit into from

Conversation

clalancette
Copy link
Contributor

When calling sendTransform() on the StaticTransformBroadcaster
class, all transforms are cached internally. Subsequent calls
to sendTransform() will only add and republish those transforms
that are different from previously seen ones. This works well
for code that wants to "build up" a list of static transforms
from a diverse set of sources. (As a side note, there is a
bug in here where a second static transform between the same
two joints but with a different translation or rotation is
silently ignored. That should probably produce an error.)

However, this caching becomes a problem if a node ever wants
to remove joints during runtime. To facilitate this, add a
new clearTransforms() API that allows the caller to do this.
This has the potential to remove unrelated transforms, but
since it is an opt-in API, presumably the user knows what
they are doing. The first user of this will be robot_state_publisher,
which knows it is getting all of its static transforms from
a single URDF file.

Signed-off-by: Chris Lalancette clalancette@openrobotics.org

Still a draft because it needs further testing.

When calling sendTransform() on the StaticTransformBroadcaster
class, all transforms are cached internally.  Subsequent calls
to sendTransform() will only add and republish those transforms
that are different from previously seen ones.  This works well
for code that wants to "build up" a list of static transforms
from a diverse set of sources.  (As a side note, there is a
bug in here where a second static transform between the same
two joints but with a different translation or rotation is
silently ignored.  That should probably produce an error.)

However, this caching becomes a problem if a node ever wants
to remove joints during runtime.  To facilitate this, add a
new clearTransforms() API that allows the caller to do this.
This has the potential to remove unrelated transforms, but
since it is an opt-in API, presumably the user knows what
they are doing.  The first user of this will be robot_state_publisher,
which knows it is getting all of its static transforms from
a single URDF file.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
@clalancette
Copy link
Contributor Author

Oof, never mind. This definitely needs more work; it turns out that the lower layers (tf2 itself) also need to be able to clear out certain transforms for this to work.

@audrow audrow changed the base branch from ros2 to rolling June 28, 2022 14:18
@clalancette
Copy link
Contributor Author

I'm closing this out, as I won't have time to work on this in the near future.

@clalancette clalancette deleted the clalancette/add-clear-transforms branch February 12, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant