Open saschroeder opened 4 years ago
I think you can still use the tf_prefix, but change absolute frame names for all the frames Gmapping needs, such as
<param name="odom_frame" value="/$(arg robot_name)/odom"/>
<param name="base_frame" value="/$(arg robot_name)/base_link"/>
<param name="map_frame" value="/$(arg robot_name)/map"/>
in the main launch file, you can use tf_prefix normally:
<group ns="/robot_1">
<param name="tf_prefix" value="robot_1" />
<include file="$(find jackal_gazebo)/launch/spawn_jackal.launch">
<arg name="x" value="0" />
<arg name="y" value="0" />
<arg name="z" value="0.0" />
<arg name="yaw" value="0" />
<arg name="config" value="$(arg config)" />
<arg name="joystick" value="$(arg joystick)" />
<arg name="robot_name" value="robot_1"/>
</include>
<include file="$(find jackal_navigation)/launch/include/multi_map_move.launch">
<arg name="robot_name" value="robot_1"/>
</include>
</group>
when you use absolute frame names, you can change anything you want, and don't need to change the source code. Hope this can help you.
The tf_prefix is not used consistently in the current implementation. The only case, where it is actually resolved is
https://github.com/ros-perception/slam_gmapping/blob/5a707e079364ab9f5349c72310f31bfed4a6c834/gmapping/src/slam_gmapping.cpp#L765
so the frame id of the published maps actually includes the prefix, while the transforms of the map frame are published without the prefix:
https://github.com/ros-perception/slam_gmapping/blob/b916ea23f71fe73593f503810b0a1c59aa0481d8/gmapping/src/slam_gmapping.cpp#L802
So it's not possible to visualize the resulting map if using tf_prefix.
The two possible solutions are: 1) don't use the tf_prefix at all 2) use it consistently (including also the base, scan and odom frame)
If someone knows another solution to use gmapping when the tf_prefix is set, I would appreciate this, too.