You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

真实多机器人场景gmapping运行异常,如何在tb3_0命名空间启动robot_state_publisher

解决方案

方法1:命令行直接启动

  1. 先声明TurtleBot3型号,根据你实际使用的型号替换burger为waffle/waffle_pi:
    export TURTLEBOT3_MODEL=burger
  2. 带命名空间运行robot_state_publisher节点:
    ROS_NAMESPACE=tb3_0 rosrun robot_state_publisher robot_state_publisher /opt/ros/$(ROS_DISTRO)/share/turtlebot3_description/urdf/turtlebot3_${TURTLEBOT3_MODEL}.urdf.xacro
    将命令中的$(ROS_DISTRO)替换为你实际使用的ROS版本名,比如noetic、melodic。

方法2:写入launch文件统一管理(更适合多机器人场景)

你可以直接创建独立launch文件,片段示例如下:

<launch>
  <arg name="tb3_model" default="burger" />
  <!-- 加载机器人URDF模型 -->
  <param name="robot_description" command="xacro /opt/ros/$(env ROS_DISTRO)/share/turtlebot3_description/urdf/turtlebot3_$(arg tb3_model).urdf.xacro" />
  <!-- 加入tb3_0命名空间组 -->
  <group ns="tb3_0">
    <node 
      pkg="robot_state_publisher" 
      type="robot_state_publisher" 
      name="robot_state_publisher" 
      output="screen"
    />
  </group>
</launch>

保存后直接运行roslaunch <你存的launch文件名>.launch即可。


额外排查建议

你遇到的gmapping丢包警告,除了robot_state_publisher的问题,还可以确认以下两点:

  • 运行rosrun tf tf_echo tb3_0/odom tb3_0/base_footprint,检查两个坐标系的tf变换是否正常发布
  • 如果警告仍然存在,启动gmapping时额外加上tf_prefix:=tb3_0参数,确保gmapping识别带命名空间的坐标系

内容的提问来源于stack exchange,提问作者AmirulJ

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.28 05:24:10