Fix discrepancy between tf and odometry/filtered when world_frame is set to map_frame #939
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found that, even when the
transform_timeout
parameter is set, there is a difference between/odometry/filtered
and the map-base_link transform from a tf lookup with the same timestamp.This occurs because the base_link-odom transform that is required to compute the broadcastable map-odom transform is evaluated at the wrong time. Instead of evaluating this at the same time as the computed map-base_link transform, it is always evaluated at
tf2::TimePointZero
.This solution evaluates the base_link-odom transform at the correct time if a suitable value for the already existing
transform_timeout
parameter is set. If the timeout is insufficient to get the transform at the requested time, the latest available transform is used (tf2::TimePointZero
). This is covered bylookupTransFormsafe
.The solution improves performance in applications that rely on accurate map-odom transforms. Examples being precision navigation and comparison of estimates with ground truth data.