ethz-asl / grid_map_geo

Geolocalization for grid map using GDAL.
BSD 3-Clause "New" or "Revised" License
141 stars 19 forks source link

Make test_tif_loader publish quicker by taking advantage of transient local QOS #58

Open Ryanf55 opened 9 months ago

Ryanf55 commented 9 months ago

Purpose

The test_tif_loader has a 5 second timer to publish the grid map. The way timers work in ROS is that they aren't executed when constructed; they must go through the first period of time.

The effect is that there is always a 5 second wait before the map shows up in RVIZ.

Goal for this ticket

Make the map publish earlier, as soon as it's ready to be published. Regardless of when RVIZ is started, RVIZ should show the map as soon as it subscribes to the map topic.

Hints

What if you call timer_callback(); at the end of the MapPublisher constructor - seems like it publishes before RVIZ is up and ready to receive the message. What if you change the quality of service of the publisher to reliable, history length 1, transient local durability to support the following behavior:

To achieve a “latched” topic that is visible to late subscribers, both the publisher and subscriber must agree to use ‘Transient Local’.

Finally, if the QoS is changed on the publisher, rviz should be updated to do the same.

Longer term

grid_map_geo should only publish the map when it changes, rather than on a timer, and take advantage of ROS QoS. Is there a reason we aren't using transient local QoS for the map?

Reference

Jaeyoung-Lim commented 9 months ago

@Ryanf55 In terrain-navigation, we use a latched topic, so it is only publsihed when subscribed.

For the map publisher node, I think since we are not updating the map in the node, it is actually irrelevant

Ryanf55 commented 9 months ago

@Ryanf55 In terrain-navigation, we use a latched topic, so it is only publsihed when subscribed.

For the map publisher node, I think since we are not updating the map in the node, it is actually irrelevant

Right. What about the map publisher being latched and just removing the timer on publish for consistency in behavior? This will have behavior because as soon as RVIZ boots, it gets the map without the delay it has now.