Posted by @RValner:
Hi,
I recently updated the RMF submodules in my project (after ~3 months) and now the traffic map in rviz is not loaded on a physical setup. All works fine in the simulation but if I set the use_sim_time:=false
in the top-level launch file, the map will not come up. This bug/behavior is really hard to isolate but that’s as close I could get, i.e., here’s a simple launch file that reproduces the bug with the latest RMF setup (note that use_sim_time
arg is not even defined nor used!):
<launch>
<arg name="viz_config_file"/>
<arg name="config_file"/>
<!-- Traffic Schedule - LEAVE THAT ONE OUT AND NO MAP -->
<node pkg="rmf_traffic_ros2" exec="rmf_traffic_schedule" output="both"/>
<!-- Building Map -->
<node pkg="rmf_building_map_tools" exec="building_map_server" args="$(var config_file)"/>
<!-- Visualizer -->
<include file="$(find-pkg-share rmf_visualization)/visualization.launch.xml">
<arg name="viz_config_file" value ="$(var viz_config_file)"/>
</include>
</launch>
and I launch it via
ros2 launch rmf_test test.launch viz_config_file:=/path/to/viz/config config_file:=/path/to/building/yaml use_sim_time:=true
If I set use_sim_time:=true
, the map will appear and use_sim_time:=false
the map will not appear. To make the case even weirder I ran all these three components in a separate terminal with use_sim_time:=false
and the map did appear (but I had to launch the visualization.launch.xml last, otherwise no map, go figure) … I seriously have no clue with this one. The way how use_sim_time
argument is implicitly there in the launch file and affects RMF is odd. Any help very highly appreciated!
Edited by @RValner at 2021-12-08T09:28:20Z
Chosen answer
Answer chosen by @RValner at 2021-12-08T15:42:56Z.
Answered by @youliangtan:
Sorry, I am a bit confused about your description. As what u have described in the last paragraph, it seems that when use_sim_time:=true
the map appears; however when false
the map will fail to show. I briefly tested it with the example rmf_demos office
world, it does work. Maybe you can provide us with an example launch file along with instructions to recreate the issue.
Anyway, just for your info. the use_sim_time
param acts slightly different while compare to ros1. In ros1, use_sim_time
is a “global” rosparam, which will be applied to all running nodes if enabled/disabled. For ros2 case, use_sim_time
is a private rosparam within a ros2 node. Therfore, you will need to ensure that all nodes’ use_sim_time
are equally enabled or disabled at the same time. This might be the cause of the issue you have stated here.
Posted by @youliangtan:
Sorry, I am a bit confused about your description. As what u have described in the last paragraph, it seems that when use_sim_time:=true
the map appears; however when false
the map will fail to show. I briefly tested it with the example rmf_demos office
world, it does work. Maybe you can provide us with an example launch file along with instructions to recreate the issue.
Anyway, just for your info. the use_sim_time
param acts slightly different while compare to ros1. In ros1, use_sim_time
is a “global” rosparam, which will be applied to all running nodes if enabled/disabled. For ros2 case, use_sim_time
is a private rosparam within a ros2 node. Therfore, you will need to ensure that all nodes’ use_sim_time
are equally enabled or disabled at the same time. This might be the cause of the issue you have stated here.
This is the chosen answer.
Posted by @RValner:
My bad, I made a typo both in the title and in the top part of the description, which are now corrected. Shortly, if I want to deploy RMF on a setup with a real robot, I set the use_sim_time=false
, but in that case the map will not be loaded. I assume that this is not by design, as the setup should work on wall time. I copy-pasted a launch file that reproduces the problem on my setup (ROS Foxy, Ubuntu 20.04) in my initial description (requires rmf_visualization, rmf_building_map_tools and rmf_traffic_ros2 packages) but I can package it properly and provide a git link if that helps. Sorry for the confusion.
Edited by @RValner at 2021-12-08T09:40:35Z
Posted by @youliangtan:
After testing out the launch file above, I am still able to view the map and lanes on rviz, with both true and false for use_sim_time
. Just for a sanity check, you can try to echo the topic /map
with qos transient_local
.
Posted by @RValner:
Just to be clear, based on your request I:
- launched the above described launch file
ros2 launch rmf_test test.launch viz_config_file:=/path/to/viz/config config_file:=/path/to/building/yaml use_sim_time:=false/true
- in a separate terminal:
ros2 topic echo --qos-durability transient_local /map
Regardless whether the use_sim_time
is true or false, nothing is echoed on the /map
topic with or without the transient_local
qos setting. BUT now if I keep the /map
subscriber running and restart the launch file (step 1), then the map is echoed. Am I missing something here?
Posted by @mxgrey:
When you echo you should also set --qos-reliability reliable
to make sure that DDS doesn’t let the packet get dropped.
If that doesn’t work, then it might be worth trying out a different DDS implementation just to figure out if the issue you’re experiencing is caused by the DDS level. In theory if the publisher and subscriber both use transient local and reliable QoS settings then the message should definitely make it, but maybe there’s an issue in one of the DDS implementations.
You can find a list of supported DDS implementations here. For Foxy the default is rwm_fastrtps_cpp
while for Galactic the default is rmw_cyclonedds_cpp
. Those are the two free open source DDS implementations that ROS2 has full support for. You can use
$ export RMW_IMPLEMENTATION=rmw_<selection>_cpp
to select a different implementation. Just make sure to apply that to all the terminals that you’re running ROS2 from.
Posted by @RValner:
Looks like issue is indeed originating from the DDS level. When I switched from the default rwm_fastrtps_cpp
to rmw_cyclonedds_cpp
on my Foxy setup and ran the above described launch file again with use_sim_time=false
, the map did appear in rviz. Also with the default rwm_fastrtps_cpp
the /map
subscriber was able to receive the message after I added the --qos-reliability reliable
flag along with --qos-durability transient_local
flag. Seems that switching the DDS will do the trick. Very peculiar bug.
Thank you both!
Posted by @mxgrey:
It may be the case that fastrtps can work but only if the subscriber in rviz has a “reliable” QoS (the “reliable” setting only works if both the punisher AND subscriber have it turned on).
We should check if there’s a way to tell rviz to use a reliable connection for the map topic.