fix mesh map stamp when using sim time #67
Merged
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.
Workaround that fixes mesh map display in rviz.
Maybe we could do a cleaner check against uninitialized time in the future, when there is another way of handling unintialized Time. See ros2/rclcpp#2025.
Without this workaround, the mesh map is published with stamp zero. The tf message filter in
mesh_tool
's MeshDisplay rviz plugin will drop the message. This is probably due to the design docs stating thatA time value of zero should be considered an error meaning that time is uninitialized
.Here are some more details:
Setup
I have
sim_time
../clock
, here: gazebotf2_ros::RVizMessageFilter
to ensure the map is transformable into the right frame.Problem
After starting up the system, the map is often not being displayed in rviz.
Analysis
The published map's
header.stamp
is zero.I am relatively sure that this causes
tf2_ros::RVizMessageFilter
to drop the msg, hence, no map is visible.header.stamp
is set vianode->now()
, which is zero, because gazebo did not start up fast enough. So I end up using uninitialized time.Workaround
My workaround consists of a sleep-loop that waits until
node->now()
is not zero anymore, before publishing the map.