Closed Krzo99 closed 7 months ago
Good catch! The problem was how SyncParametersClient is working, I wrongly assumed that this callback was only called for parameters set to that node, but the callback is called for parameters set to any nodes. If two nodes share same parameter name (even in different namespace), they would by default process them. In the commit above, I now check if the parameters are set in the expected namespace and node name. This should fix your issue.
I am using 2 robots to map an area. The idea is, to use localization mode, until reaching the edge of the map, and then turning on mapping mode, to save on database size. When I get to the edge of the map, I run:
ros2 service call /leo1/set_mode_mapping std_srvs/srv/Empty {}
I would think that this will only turn on the mapping mode on robotleo1
, however, all avaliable robots switch to it. There is a bit of a different output, but the result is the same:Leo1 output: [rtabmap-2] [INFO] [leo1.rtabmap]: rtabmap: Set mapping mode [rtabmap-2] [INFO] [leo1.rtabmap]: rtabmap: Mapping mode enabled! [rtabmap-2] [INFO] [leo1.rtabmap]: Setting RTAB-Map parameter "Mem/IncrementalMemory"="true" [rtabmap-2] [INFO] [leo1.rtabmap]: rtabmap: Updating parameters [rtabmap-2] [INFO] [leo1.rtabmap]: RTAB-Map rate detection = 1.000000 Hz
Leo2 output: [rtabmap-2] [INFO] [leo2.rtabmap]: Setting RTAB-Map parameter "Mem/IncrementalMemory"="true" [rtabmap-2] [INFO] [leo2.rtabmap]: rtabmap: Updating parameters [rtabmap-2] [INFO] [leo2.rtabmap]: RTAB-Map rate detection = 1.000000 Hz
The same thing happens when setting the parameter:
ros2 param set /leo2/rtabmap Mem/IncrementalMemory "'true'"
The weird thing is, that both the robots start publishing and updating the map to rviz2 while moving, as if both of them are in maping mode (as seen from console output), but when calling
ros2 param get /leo1/rtabmap Mem/IncrementalMemory
for both robots, only the one that was explicitly set to mapping mode, returns true, and the other false. There seems to be a difference between ros2 param and actual state of rtabmap nodes.The rtabmap launch file is launched two times, both in different bash instances, like so:
ros2 launch pkg rtabmap.launch.py robot_ns:=leo1
The rtabmap launch file is:Wouldn't it be more logical to be able to set only one robot into mapping mode, while the other still stays in localization mode?