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?
Asked
Active
Viewed 219 times
3

AmirulJ
- 118
- 1
- 11
-
Are you using a launch file? What does it look like? – BTables Sep 23 '21 at 16:12
2 Answers
0
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" />

BTables
- 4,413
- 2
- 11
- 30
-
I used "rosrun gmapping slam_gmapping scan:=scan_new3" but when I try "rosrun gmapping slam_gmapping scan:=scan_new map:=map2" is not working. Alright I'll try first to use the launch file. Thank you very much @BTables . You help me a lot – AmirulJ Sep 24 '21 at 17:12
-
Hi @BTables can you help me answer the next question related to ROS https://stackoverflow.com/q/69389307/16594158 – AmirulJ Sep 30 '21 at 09:02
0
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>

AmirulJ
- 118
- 1
- 11