调试工具ROSWTF
1.ROSWTF命令行工具
ROSWTF将检查您的ROS设置,例如环境变量,并查找配置问题。如果您在线有ROS系统,它将查看并检查任何潜在的问题。
1.1 检查目标
除了一般检查外,ROSWTF还有两种用法。
1.1.1 检查软件包或堆栈
roswtf
这将检查当前的软件包或堆栈是否有问题。
重要的是:ROSWTF根据您从运行的目录执行这些检查。例如,如果您在导航堆栈中运行它,它将根据导航堆栈及其依赖项中的文件进行文件系统检查。
1.1.2 检查启动文件
roswtf yourfile.launch
在这种情况下,它将检查给定的启动文件是否有任何潜在问题。
2.Roswtf寻找什么?
ROSWTF寻找很多东西,并且清单总是在增长。它要寻找的是两类:文件系统问题和在线/图形问题。
对于文件系统问题,ROSWTF查看您的环境变量,软件包配置,堆栈配置等。它还可以接收一个Roslaunch文件,并尝试在其中找到任何潜在的配置问题,例如尚未正确构建的软件包。
对于在线问题,roswtf 会检查您当前图形的状态并尝试查找任何潜在问题。这些问题可能是节点无响应、节点之间缺少连接或 roslaunch 的潜在机器配置问题。
3.警告与错误
roswtf 根据其执行的检查生成包含警告和错误的报告。一般来说,警告看起来很奇怪,但可能还不错。错误是已知问题,如果您遇到问题,您可能应该解决这些问题。
4.示例
4.1 roscore没有运行的正常情况
在终端输入:roswtf,显示如下
Loaded plugin tf.tfwtf
No package or stack in the current directory
================================================================================
Static checks summary:
No errors or warnings
================================================================================
ROS Master does not appear to be running.
Online graph checks will not be run.
ROS_MASTER_URI is [http://localhost:11311]
在这种情况下,这是可以预期的,因为没有其他东西在运行,因此我们可以忽略它。
4.1 roscore运行的正常情况
在终端输入roscore,然后再在另外一个终端输入roswtf,显示如下
Loaded plugin tf.tfwtf
No package or stack in the current directory
================================================================================
Static checks summary:
No errors or warnings
================================================================================
Beginning tests of your ROS graph. These may take a while...
analyzing graph...
... done analyzing graph
running graph rules...
... done running graph rules
running tf checks, this will take a second...
... tf checks complete
Online checks summary:
Found 2 warning(s).
Warnings are things that may be just fine, but are sometimes at fault
WARNING The following node subscriptions are unconnected:
* /rosout:
* /rosout
WARNING No tf messages
roswtf向您警告rosout节点未订阅和没有tf消息。在这种情况下,这是可以预期的,因为没有其他东西在运行,因此我们可以忽略它。
4.3 在rviz查看tf坐标,看到base_link和base_footprint之间跳来跳去
运用roswtf查看问题,显示如下:
Loaded plugin tf.tfwtf
No package or stack in the current directory
================================================================================
Static checks summary:
No errors or warnings
================================================================================
Beginning tests of your ROS graph. These may take a while...
analyzing graph...
... done analyzing graph
running graph rules...
... done running graph rules
running tf checks, this will take a second...
... tf checks complete
Online checks summary:
Found 2 warning(s).
Warnings are things that may be just fine, but are sometimes at fault
WARNING The following node subscriptions are unconnected:
* /gazebo:
* /gazebo/set_link_state
* /gazebo/set_model_state
* /tianbot_mini/slam_gmapping:
* /tianbot_mini/scan
* /tianbot_mini/rviz:
* /tianbot_mini/scan
* /tianbot_mini/move_base/local_costmap/costmap
* /tianbot_mini/move_base/local_costmap/costmap_updates
* /tianbot_mini/map_updates
* /tianbot_mini/move_base/global_costmap/costmap
* /tianbot_mini/move_base/global_costmap/costmap_updates
* /tianbot_mini/move_base/NavfnROS/plan
* /tianbot_mini/move_base/TrajectoryPlannerROS/local_plan
* /tianbot_mini/move_base/global_costmap/footprint
WARNING These nodes have died:
* urdf_spawner-6
Found 2 error(s).
ERROR TF re-parenting contention:
* reparenting of [left_wheel_link] to [chassis] by [/robot_state_publisher]
* reparenting of [right_wheel_link] to [chassis] by [/robot_state_publisher]
* reparenting of [right_wheel_link] to [base_link] by [/gazebo]
* reparenting of [left_wheel_link] to [base_link] by [/gazebo]
ERROR TF multiple authority contention:
* node [/robot_state_publisher] publishing transform [left_wheel_link] with parent [chassis] already published by node [/gazebo]
* node [/robot_state_publisher] publishing transform [right_wheel_link] with parent [chassis] already published by node [/gazebo]
* node [/gazebo] publishing transform [right_wheel_link] with parent [base_link] already published by node [/robot_state_publisher]
* node [/gazebo] publishing transform [left_wheel_link] with parent [base_link] already published by node [/robot_state_publisher]
报错提示/robot_state_publisher发布了左右轮到chassis的tf变换,但是/gazebo又发布了左右轮到base_link的tf变换,导致了二者的冲突。
解决办法:
在ros answers上找到一个类似的问题:tf tree changes over time - ROS Answers: Open Source Q&A Forum
对比该问题提出者的解决方式,发现是/gazebo发布左右轮到base_footprint的tf配置是在gazebo差速轮机器人控制插件中
将gazebo中的:
<publishWheelTF>true</publishWheelTF>
<publishWheelJointState>true</publishWheelJointState>
改为:
<publishWheelTF>false</publishWheelTF>
<publishWheelJointState>false</publishWheelJointState>
参考文献:
http://wiki.ros.org/roswtf
https://blog.csdn.net/qq_39379746/article/details/105298035
https://blog.csdn.net/weixin_41070687/article/details/125736727