紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
第十章配置fishbot建图时Rviz2 fixed frame报错,无法显示地图
-
跟着教程先启动gazebo后启动Rviz2,随后Rviz2的Fixed Frame报错
这是我用rqt_graph查看的node和topic,看起来好像也没什么问题
这是gazebo.launch.py的内容:import os from launch import LaunchDescription from launch.actions import ExecuteProcess from launch_ros.actions import Node from launch_ros.substitutions import FindPackageShare def generate_launch_description(): robot_name_in_model = '' package_name = 'fishbot_description' urdf_name = "fishbot_base.urdf" ld = LaunchDescription() pkg_share = FindPackageShare(package=package_name).find(package_name) urdf_model_path = os.path.join(pkg_share, f'urdf/{urdf_name}') gazebo_world_path = os.path.join(pkg_share, 'world/fishbot.world') # Start Gazebo server start_gazebo_cmd = ExecuteProcess( cmd=['gazebo', '--verbose','-s', 'libgazebo_ros_init.so', '-s', 'libgazebo_ros_factory.so',gazebo_world_path], output='screen') # Launch the robot spawn_entity_cmd = Node( package='gazebo_ros', executable='spawn_entity.py', arguments=['-entity', robot_name_in_model, '-file', urdf_model_path ], output='screen') ld.add_action(start_gazebo_cmd) ld.add_action(spawn_entity_cmd) return ld
这是cartographer.launch.py的内容:
import os from launch import LaunchDescription from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node from launch_ros.substitutions import FindPackageShare def generate_launch_description(): # 定位到功能包的地址 pkg_share = FindPackageShare(package='fishbot_cartographer').find('fishbot_cartographer') #=====================运行节点需要的配置======================================================================= # 是否使用仿真时间,我们用gazebo,这里设置成true use_sim_time = LaunchConfiguration('use_sim_time', default='true') # 地图的分辨率 resolution = LaunchConfiguration('resolution', default='0.05') # 地图的发布周期 publish_period_sec = LaunchConfiguration('publish_period_sec', default='1.0') # 配置文件夹路径 configuration_directory = LaunchConfiguration('configuration_directory',default= os.path.join(pkg_share, 'config') ) # 配置文件 configuration_basename = LaunchConfiguration('configuration_basename', default='fishbot_2d.lua') rviz_config_dir = os.path.join(pkg_share, 'config')+"/cartographer.rviz" print(f"rviz config in {rviz_config_dir}") #=====================声明三个节点,cartographer/occupancy_grid_node/rviz_node================================= cartographer_node = Node( package='cartographer_ros', executable='cartographer_node', name='cartographer_node', output='screen', parameters=[{'use_sim_time': use_sim_time}], arguments=['-configuration_directory', configuration_directory, '-configuration_basename', configuration_basename]) cartographer_occupancy_grid_node = Node( package='cartographer_ros', executable='cartographer_occupancy_grid_node', name='cartographer_occupancy_grid_node', output='screen', parameters=[{'use_sim_time': use_sim_time}], arguments=['-resolution', resolution, '-publish_period_sec', publish_period_sec]) rviz_node = Node( package='rviz2', executable='rviz2', name='rviz2', arguments=['-d', rviz_config_dir], parameters=[{'use_sim_time': use_sim_time}], output='screen') #===============================================定义启动文件======================================================== ld = LaunchDescription() ld.add_action(cartographer_node) ld.add_action(cartographer_occupancy_grid_node) ld.add_action(rviz_node) return ld
gazebo和Rviz2都启动正常,网上搜索尝试了一些办法也没解决,请各位帮我看看问题出哪了
-
@tf_wang cmake里添加代码
- install(
- DIRECTORY config launch rviz
- DESTINATION share/${PROJECT_NAME}
- )