ROS2学习遇到的问题1—TF_OLD_DATA
以下只是想记录一下自己学习ROS过程中的问题
问题1
我使用的是humble版本的ROS2,配置是双系统UBUNTU22.04,在进行NAVIGATION2学习时进行第一步设置机器人时,运行lunch文件:
ros2 launch sam_bot_description display.launch.py
会报出以下警告:
[ekf_node-5] Warning: TF_OLD_DATA ignoring data from the past for frame drivewhl_r_link at time 40.052000 according to authority Authority undetectable
[ekf_node-5] Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
[ekf_node-5] at line 292 in ./src/buffer_core.cpp
[ekf_node-5] Warning: TF_OLD_DATA ignoring data from the past for frame drivewhl_l_link at time 40.052000 according to authority Authority undetectable
[ekf_node-5] Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
[ekf_node-5] at line 292 in ./src/buffer_core.cpp
[rviz2-6] Warning: TF_OLD_DATA ignoring data from the past for frame drivewhl_l_link at time 40.052000 according to authority Authority undetectable
[rviz2-6] Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
[rviz2-6] at line 292 in ./src/buffer_core.cpp
[rviz2-6] Warning: TF_OLD_DATA ignoring data from the past for frame drivewhl_r_link at time 40.062000 according to authority Authority undetectable
[rviz2-6] Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
[rviz2-6] at line 292 in ./src/buffer_core.cpp
[rviz2-6] Warning: TF_OLD_DATA ignoring data from the past for frame drivewhl_l_link at time 40.062000 according to authority Authority undetectable
[rviz2-6] Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
[rviz2-6] at line 292 in ./src/buffer_core.cpp
解决方法如下:
在差速轮的设置中按照如下配置:
<gazebo>
<plugin name='diff_drive' filename='libgazebo_ros_diff_drive.so'>
<ros>
<namespace>/demo</namespace>
</ros>
<!-- wheels -->
<left_joint>drivewhl_l_joint</left_joint>
<right_joint>drivewhl_r_joint</right_joint>
<!-- kinematics -->
<wheel_separation>0.4</wheel_separation>
<wheel_diameter>0.2</wheel_diameter>
<!-- limits -->
<max_wheel_torque>20</max_wheel_torque>
<max_wheel_acceleration>1.0</max_wheel_acceleration>
<!-- output -->
<publish_odom>true</publish_odom>
<publish_odom_tf>true</publish_odom_tf>
<publish_wheel_tf>false</publish_wheel_tf>
<odometry_frame>odom</odometry_frame>
<robot_base_frame>base_link</robot_base_frame>
</plugin>
</gazebo>
其中最重要的下面参数的设置:
<publish_odom>true</publish_odom>
<publish_odom_tf>true</publish_odom_tf>
<publish_wheel_tf>false</publish_wheel_tf>
然后保证:
robot_localization_node = launch_ros.actions.Node(
package='robot_localization',
executable='ekf_node',
name='ekf_filter_node',
output='screen',
parameters=[os.path.join(pkg_share, 'config/ekf.yaml'), {'use_sim_time':True}]
)
将use_sim_time设置为true即可
问题相关话题:
github描述