Re: tf info in namespace
Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/tf-info-in-namespace-tp5966p5967.html
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