How to create two map simultaneously using one gazebo?

Viewed 109

As shown in the figure below, now my gazebo is running 2 slam_gmapping package. First is /turtlebot_slam_gmapping publish to the /map topic. Second is /slam_gmapping publish to the same /map topic as first. I would like to create a new /map topic which is /map2 (red) publish from the /slam_gmapping (the second one) and not publish to the /map topic (the blue one that I erased). How can I do this?

enter image description here

2 Answers

Assuming you're using a launch file like the one I suggested in one of your previous questions, you need to include a remap tag for the node telling it what topics to remap. For the above node it should look like this: <remap from="/map" to="/map2" />

With the help from @BTables the launch file of the gmapping can be edit like this. You can create a new launch file in the cd catkin_ws/src/turtlebot3/turtlebot3_slam/launch

  <!-- Gmapping -->
  <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
    <param name="base_frame" value="$(arg set_base_frame)"/>
    <param name="odom_frame" value="$(arg set_odom_frame)"/>
    <param name="map_frame"  value="$(arg set_map_frame)"/>
    <rosparam command="load" file="$(find turtlebot3_slam)/config/gmapping_params.yaml" />
    <remap from="/scan" to="/scan_new2"/>
    <remap from="/map" to="/map2" />
  </node>
</launch>
Related