使用urdf和xacro编写机器人仿真模型的时候,同时开启gazebo和rviz的时候遇到的问题

ubuntu20.04  ros noetic

开启gazebo并启动rviz时,rviz终端会一直产生一个警告:TF_REPEATED_DATA ignoring data with redundant timestamp for frame left_wheel at time 140.726000 according to authority unknown_publisher

[ WARN] [1657462827.907037520, 140.746000000]: TF_REPEATED_DATA ignoring data with redundant timestamp for frame left_wheel at time 140.726000 according to authority unknown_publisher
[ WARN] [1657462827.907093593, 140.746000000]: TF_REPEATED_DATA ignoring data with redundant timestamp for frame right_wheel at time 140.726000 according to authority unknown_publisher
[ WARN] [1657462827.907845999, 140.746000000]: TF_REPEATED_DATA ignoring data with redundant timestamp for frame left_wheel at time 140.746000 according to authority unknown_publisher
[ WARN] [1657462827.907878461, 140.746000000]: TF_REPEATED_DATA ignoring data with redundant timestamp for frame right_wheel at time 140.746000 according to authority unknown_publisher
复制
0

而且在rviz中查看tf坐标,可以看到左右轮的坐标一直在base_link和base_footprint之间跳来跳去

在终端使用roswtf,可以看到如下问题:

0
WARNING The following node subscriptions are unconnected:
 * /gazebo:
   * /gazebo/set_link_state
   * /gazebo/set_model_state
   * /cmd_vel

WARNING These nodes have died:
 * model-4
 
Found 2 error(s).

ERROR TF re-parenting contention:
 * reparenting of [left_wheel] to [base_link] by [/robot_state_publisher]
 * reparenting of [right_wheel] to [base_link] by [/robot_state_publisher]
 * reparenting of [right_wheel] to [base_footprint] by [/gazebo]
 * reparenting of [left_wheel] to [base_footprint] by [/gazebo]

ERROR TF multiple authority contention:
 * node [/robot_state_publisher] publishing transform [left_wheel] with parent [base_link] already published by node [/gazebo]
 * node [/robot_state_publisher] publishing transform [right_wheel] with parent [base_link] already published by node [/gazebo]
 * node [/gazebo] publishing transform [right_wheel] with parent [base_footprint] already published by node [/robot_state_publisher]
 * node [/gazebo] publishing transform [left_wheel] with parent [base_footprint] already published by node [/robot_state_publisher]
复制

报错提示/robot_state_publisher发布了左右轮到base_link的tf变换,但是/gazebo又发布了左右轮到base_footprint的tf变换,导致了二者的冲突。

在ros answers上找到一个类似的问题:tf tree changes over time - ROS Answers: Open Source Q&A Forum

对比该问题提出者的解决方式,发现是/gazebo发布左右轮到base_footprint的tf配置是在gazebo差速轮机器人控制插件中

0

 根据gazebo官网对差速轮控制插件的介绍也可以确定:Gazebo : Tutorial : Gazebo plugins in ROS

0
将gazebo_control中的publishWheelTF和publishWheelJointState均设置为false就可以解决掉这个问题