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

Don't insert a TF frame if one of the same timestamp already exists, instead just overwrite it. #425

Closed
wants to merge 9 commits into from

Conversation

pbeeson
Copy link
Contributor

@pbeeson pbeeson commented Oct 19, 2019

So, we ran into an issue with ROS on a project (still on kinetic due to legacy robot issues, but this applies to melodic too, so I'll make a similar PR there).

Generally, if a node is broadcasting TF data based on other incoming frames and/or other information, and something goes wrong, it will stop publishing data. But we ran into a scenario where something went wrong in a node, and it kept broadcasting the same TF data with the same timestamp, forever. When this happened, we noticed that all nodes with a tf listener started immediately consuming more and more memory.

In looking into this, it is clear that when storing an incoming TF in the tf2 listener code, that if a frame between parent and child exists with the same timestamp, that the incoming data is not ignored, nor does it overwrite the previous frame, but it gets inserted next to the existing frame with the same timestamp, so that now there are multiple transforms between the same two frames with the same timestamp.

I added some debug console outputs and a small publisher node and a node that just makes a tf listener and spins. This proved that the storage for tf listener does indeed grow infinitely so long as no newer data comes in that is more than max_duration (10 seconds) to force these to be pruned.

The fix is VERY simple, and has been tested with the stand alone programs. where previously the size of storage_ grew without bound when sending the exact same message in a loop, but now remains size 1 for that parent/child transform.

@pbeeson pbeeson changed the title Don't insert a TF frame is one of the same timestamp already exists, instead just overwrite it. Don't insert a TF frame if one of the same timestamp already exists, instead just overwrite it. Oct 19, 2019
@tfoote
Copy link
Member

tfoote commented May 13, 2020

Merged in #459 following discussion in #426

@tfoote tfoote closed this May 13, 2020
ooeygui pushed a commit to ms-iot/geometry2 that referenced this pull request Oct 12, 2022
* [tf2_kdl] pep8 formatting

* [tf2_kdl] fix pep257

* [tf2_kdl] fix copyright

* tf2_kdl header guard and copyright

* more flake8 fixes

Co-authored-by: Bjar Ne <gleichdick@users.noreply.github.com>
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.

2 participants