紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
(foxy教程10.9运行nav2时报错)Timed out waiting for transform from base_link to odom to become available, tf error: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist
-
在跟着教程走到运行nav2,初始化设置的时候,rviz出现的不是error,而是warm,rviz界面如下:
终端报错如下:[controller_server-4] [INFO] [1712253661.690443611] [local_costmap.local_costmap]: Timed out waiting for transform from base_link to odom to become available, tf error: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist [rviz2-10] [INFO] [1712253661.773769226] [rviz2]: Waiting for the lifecycle_manager_navigation/is_active service... [rviz2-10] [INFO] [1712253661.773940891] [rviz2]: Sending lifecycle_manager_navigation/is_active request [controller_server-4] [INFO] [1712253662.190515009] [local_costmap.local_costmap]: Timed out waiting for transform from base_link to odom to become available, tf error: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist [controller_server-4] [INFO] [1712253662.690512522] [local_costmap.local_costmap]: Timed out waiting for transform from base_link to odom to become available, tf error: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist [rviz2-10] [INFO] [1712253662.774192578] [rviz2]: Waiting for the lifecycle_manager_navigation/is_active service... [rviz2-10] [INFO] [1712253662.774363237] [rviz2]: Sending lifecycle_manager_navigation/is_active request [controller_server-4] [INFO] [1712253663.190443715] [local_costmap.local_costmap]: Timed out waiting for transform from base_link to odom to become available, tf error: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist
目前我自己的nav2功能包中,CMAKEList文件:
cmake_minimum_required(VERSION 3.5) project(sim_nav2) # Default to C99 if(NOT CMAKE_C_STANDARD) set(CMAKE_C_STANDARD 99) endif() # Default to C++14 if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14) endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() # find dependencies find_package(ament_cmake REQUIRED) find_package(nav2_bringup REQUIRED) install( DIRECTORY launch param maps DESTINATION share/${PROJECT_NAME} ) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) # the following line skips the linter which checks for copyrights # uncomment the line when a copyright and license is not present in all source files #set(ament_cmake_copyright_FOUND TRUE) # the following line skips cpplint (only works in a git repo) # uncomment the line when this package is not in a git repo #set(ament_cmake_cpplint_FOUND TRUE) ament_lint_auto_find_test_dependencies() endif() ament_package()
package.xml文件:
<?xml version="1.0"?> <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> <package format="3"> <name>sim_nav2</name> <version>0.0.0</version> <description>TODO: Package description</description> <maintainer email="wjndem@163.com">jeni</maintainer> <license>TODO: License declaration</license> <buildtool_depend>ament_cmake</buildtool_depend> <depend>nav2_bringup</depend> <test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_common</test_depend> <export> <build_type>ament_cmake</build_type> </export> </package>
launch文件:
''' 作者: 小鱼 公众号: 鱼香ROS QQ交流群: 2642868461 描述: Nav2 launch启动文件 ''' import os from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription from launch.actions import IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node def generate_launch_description(): #=============================1.定位到包的地址============================================================= fishbot_navigation2_dir = get_package_share_directory('sim_nav2') nav2_bringup_dir = get_package_share_directory('nav2_bringup') #=============================2.声明参数,获取配置文件路径=================================================== # use_sim_time 这里要设置成true,因为gazebo是仿真环境,其时间是通过/clock话题获取,而不是系统时间 use_sim_time = LaunchConfiguration('use_sim_time', default='true') map_yaml_path = LaunchConfiguration('map',default=os.path.join(fishbot_navigation2_dir,'maps','sim_map.yaml')) nav2_param_path = LaunchConfiguration('params_file',default=os.path.join(fishbot_navigation2_dir,'param','whe_nav2.yaml')) rviz_config_dir = os.path.join(nav2_bringup_dir,'rviz','nav2_default_view.rviz') #=============================3.声明启动launch文件,传入:地图路径、是否使用仿真时间以及nav2参数文件============== nav2_bringup_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource([nav2_bringup_dir,'/launch','/bringup_launch.py']), launch_arguments={ 'map': map_yaml_path, 'use_sim_time': use_sim_time, 'params_file': nav2_param_path}.items(), ) rviz_node = Node( package='rviz2', executable='rviz2', name='rviz2', arguments=['-d', rviz_config_dir], parameters=[{'use_sim_time': use_sim_time}], output='screen') return LaunchDescription([nav2_bringup_launch,rviz_node])
麻烦大佬帮忙看看什么问题,谢谢!