How to publish new topic to gmapping package in multiple robot?

I have used this command in the terminal to publish /scan_new topic to the gmapping package in tb3_0 robotROS_NAMESPACE=tb3_0 rosrun gmapping slam_gmapping scan:=scan_new set_base_frame:=tb3_0/base_footprint set_odom_frame:=tb3_0/odom set_map_frame:=tb3_0/map, but the gampping package is not subscribe to the /scan_new topic. What is the correct command to make sure that gmapping package of the tb3_0 robot is subscribe to the /scan_new topic?

*notes: As in the figure, red word is the ann_publisher node publish to the /scan_new and the gmapping package subscribe to /scan_new topic.

What do you mean by “is not subscribed”? I ran the same command and see that it’s subscribed:

Terminal 1

user:~$ rosrun gmapping slam_gmapping scan:=scan_new set_base_frame:=tb3_0/base_footprint set_odom_frame:=tb3_0/odom set_map_frame:=tb3_0/map
Warning: TF_REPEATED_DATA ignoring data with redundant timestamp for frame odom at time 204.368000 according to authority unknown_publisher
         at line 278 in /tmp/binarydeb/ros-noetic-tf2-0.7.5/src/buffer_core.cpp

Terminal 2

user:~$ rostopic info /scan_new
Type: sensor_msgs/LaserScan

Publishers: None

Subscribers:
 * /slam_gmapping (http://4_xterm:37057/)

I have try the command but when I execute the command to another robot (tb3_1), the last command is stopped. How can I run the gmapping package to tb3_0 and tb3_1 at the same time?

I would like to run the slam gmapping as shown in the figure below but subscribe with the new topic (/scan_new). For this figure I run the usual command from TurtleBot3

You should find out if the gmapping package can work on two robots at the same time.

One quick way to do this is to use roslaunch instead of rosrun and create a launch file that starts two gmapping nodes with different names (using the name parameter of the <node> tag).

1 Like