avidbots / flatland

A 2D robot simulator for ROS
BSD 3-Clause "New" or "Revised" License
104 stars 66 forks source link

Change layer QoS policy #91

Closed JoaoCostaIFG closed 1 year ago

JoaoCostaIFG commented 1 year ago

A problem showed up during the migration of the turtlebot_flatland project to Ros2: the World layer wasn't showing up.

Apparently, in Ros1 the last x published messages would be saved for late-joining subscribers (not sure about the exact mechanic). In Ros2, this is a configurable setting managed with the new QoS settings, more specifically, the Durability setting.

The problem is caused by the flatland_server publishing the layers' markers too fast for rviz to catch them.

The small change in this commit (setting the durability QoS policy) fixes the problem, without resorting to always re-publishing layer information (currently it only publishes when there's a change).

anaines14 commented 1 year ago

Important note: In order for this to work, we had to manually set the correct policy in Rviz too. For the map example, it is a dropdown under map settings. The selected policy should be changed toTRANSCIENT LOCAL.

josephduchesne commented 1 year ago

This fix seems fine. In a production context I'd be a little worried about massive debug messages hanging around, but for the simulator I think it's acceptable.