I am working with rtabmap in ros. I have everything working currently for a single vehicle, but am trying to launch 2 vehicles at once each running their own rtabmap. The problem i am running into is that the tf frames world->map->odom->camera_link->base_link are not in the namespace with the rest of the topics.
Is there a way to put these into the namespace so that 2 agents can run on the same ros master? ie. world->agent1/map->agent1/odom->agent1/camera_link->agent1/base_link. That way I could launch 2 agents without them stepping on each other. |
Administrator
|
Hi,
You will need to change tf of your static tfs on the robot: "robot1/base_link" -> "robot1/camera_link" "robot2/base_link" -> "robot2/camera_link" Make sure to launch your nodes in different namespaces. Here is an example of general launch file for rtabmap stuff: <launch> <node pkg="tf" type="static_transform_publisher" name="world_to_map1" args="0 0 0 0 0 0 world robot1/map 100" /> <node pkg="tf" type="static_transform_publisher" name="world_to_map2" args="0 0 0 0 0 0 world robot2/map 100" /> <group ns="robot1"> <include file="$(find rtabmap_ros)/launch/rtabmap.launch"> <arg name="rtabmapviz" value="false" /> <arg name="frame_id" value="robot1/base_link"/> <arg name="vo_frame_id" value="robot1/odom"/> <arg name="map_frame_id" value="robot1/map"/> <arg name="database_path" value="~/.ros/robot1.db"/> <arg name="rgb_topic" value="/robot1/camera/rgb/image_rect_color" /> <arg name="depth_topic" value="/robot1/camera/depth_registered/image_raw" /> <arg name="camera_info_topic" value="/robot1/camera/rgb/camera_info" /> </include> </group> <group ns="robot2"> <include file="$(find rtabmap_ros)/launch/rtabmap.launch"> <arg name="rtabmapviz" value="false" /> <arg name="frame_id" value="robot2/base_link"/> <arg name="vo_frame_id" value="robot2/odom"/> <arg name="map_frame_id" value="robot2/map"/> <arg name="database_path" value="~/.ros/robot2.db"/> <arg name="rgb_topic" value="/robot2/camera/rgb/image_rect_color" /> <arg name="depth_topic" value="/robot2/camera/depth_registered/image_raw" /> <arg name="camera_info_topic" value="/robot2/camera/rgb/camera_info" /> </include> </group> </launch>Note also that they should not use the same database if launched from the same computer. This may not be a problem when launching on two different computers, but when launched on the same in Gazebo for example, we should explicitly change the database path. You would get a tf tree like this: world->robot1/map->robot1/odom->robot1/base_link->robot1/camera_link \->robot2/map->robot2/odom->robot2/base_link->robot2/camera_link cheers, Mathieu |
Free forum by Nabble | Edit this page |