Skip to content

Roslibrust tf support #55

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

Draft
wants to merge 128 commits into
base: main
Choose a base branch
from
Draft

Roslibrust tf support #55

wants to merge 128 commits into from

Conversation

lucasw
Copy link

@lucasw lucasw commented Jul 26, 2024

I made a version of this that works with https://github.com/Carter12s/roslibrust based on the rosrust version here.

There are a lot of changes made to the underlying tf system that may not have been necessary but I wanted to experiment:

chrono TimeDelta is used in place of the roslibrust Time in most places except for the Transform message because the latter doesn't have comparison or addition or subtraction support.

It was previously inverting every received transforms and adding those with parent-child reversed alongside the originals I think to avoid having to invert later in a lookup, but this made the tf tree harder to traverse to find the chain between any two frames. WIth a directed graph any two frames can traverse the tree upwards until they hit a root frame or a frame that the other traversal has already found, and then there is a tf chain (or disconnected trees if no frames in common).

Also the transform inversion on every incoming frame seemed unnecessary given that tf lookups are probably much lower frequency than incoming transforms, 10s of Hz vs. possibly hundreds of Hz, and there are many incoming transforms that are not part of the chain the node instantiating the tf listener cares about (it would be nice if those unneeded transforms could be dropped on reception, but that only works with a non-dynamic tree). There could be more improvements there where the found tf chain in a lookup knows exactly which transforms need inverting, currently it tries to find a given parent-child transform and fails and then looks up the reversed pair and does the inversion.

Loop detection is only done at lookup time, not for the entire received graph, which is less of a burden.

There are other changes made to handling static transforms and the tree dynamically changing that I made trying to debug lookup issues (which I may have created making other changes). I haven't looked at documentation or compared to behavior of the rospy/roscpp transform libraries, but I don't typically change parents of big parts of the tree or change a transform from static to non-static live, but I could see how some applications would want to do that. Rviz and other tools seem bad at handling big tree changes (maybe just those involving static tf changes?) and require restarts to flush old contradictory transforms, so I won't be surprised if it isn't handled well in the original C++ (or python).

I think the expiration of old transforms ought to be done across the entire buffer, the newest transform stamp - oldest transform stamp should be < cache duration for every parent-child, but currently individual transform pairs expire old transforms based on the time span of just that particular parent-child.

There's an echo.rs executable that mostly duplicates the output of tf2_tools echo.py but isn't yet doing any quaternion to euler conversions, and other command line options aren't supported.

It's up to the executable to update tf_listener subscribers alongside whatever subscribers and timed events they are doing, that could be improved. I wouldn't want to completely take control away by spawning threads behind the scenes, but maybe that should be optionally available.

lucasw added 30 commits July 20, 2024 19:38
…ons on Time and Duration but need to test them, and need cmp()
…ooking up and printing the transform, need to pass in frames as args and use static transforms
…en static and dynamic properly, but maybe python and C++ listeners are the same
… get the most recent stamp- though should get rid of the is_zero check and just pass in a flag to get most recent instead of using a sentinel value
…g the transforms between them, because the inverted transforms aren't getting added to the same data structure more logic is needed - maybe store the inverse transforms adjacent to the normal ones, but clearly distinguished as inverse?
…nsforms and different tf tree leaf frames- but can't say for certain that number are right under dynamic conditions, need to test
…me instances of it getting locked up where next() on both subscribers appear to almost always return something (not sure what, is it the last message over and over again?)
…y sorted, but the cursor functionality isn't available yet so in the process of using another function
… tokio selects in echo, this looks to work fine but need to update other applications using tf listener
lucasw added 27 commits November 5, 2024 07:58
…, which will be useful for a tf_mcap tool to find gaps in tf buffers
…get the same sigint passed into the running commands
…es, but need to integrate clap to be able to override them on the command line
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.

1 participant