Search code examples
ros

Why gmapping package is not run in multiple robot in real robot (not simulation)?


I have run this command from raspberry pi of the robot tb3_0 to run the /tb3_0/turtlebot3_core node

pi@raspberrypi:~ $ ROS_NAMESPACE=tb3_0 roslaunch turtlebot3_bringup turtlebot3_robot.launch

And then I run gmapping package for tb3_0 robot in the pc terminal

amirul@nmy-lab:~$ ROS_NAMESPACE=tb3_0 roslaunch turtlebot3_slam turtlebot3_gmapping.launch set_base_frame:=tb3_0/base_footprint set_odom_frame:=tb3_0/odom set_map_frame:=tb3_0/map

But the gmapping package show a warning message

[ WARN] [1635496431.864557793]: MessageFilter [target=odom ]: Dropped 100.00% of messages so far. Please turn the [ros.gmapping.message_notifier] rosconsole logger to DEBUG for more information.

What I think is I didnt publish the robot_state_publisher node to the /tb3_0/gmapping node. How can I run the robot_state_publisher node in the tb3_0 ROSNAMESPACE? Thank you!

This is the rqt_graph of the running node rqt_graph


Solution

  • It depends on how you're launching robot_state_publisher. If using a launch file you can use the ns attribute to apply a namespace to the node. However, if you want to publish a namespaced transform you should use the tf_prefix param. Take the following example

    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher">
        <param name="publish_frequency" value="50.0"/>
        <param name="tf_prefix" value="tb3_0" />
    </node>