鱼香ROS社区
    • 版块
    • 最新
    • 未解决
    • 已解决
    • 群组
    • 注册
    • 登录
    紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
    提问前必看的发帖注意事项: 社区问答规则(小鱼个人)更新 | 高质量帖子发布指南

    6.4.2 我在gazebo中无法显示fishbot机器人模型,求求帮看一下是怎么回事,按书上的代码也是一样的报错

    已定时 已固定 已锁定 已移动
    ROS2机器人开发:从入门到实践
    gazebo 仿真 urdf
    2
    3
    221
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 抱
      抱着咸鱼的啊黄 年度VIP
      最后由 编辑

      背景:
      我的代码是如下,和鱼哥的视频里的一样,然后我终端执行ros2 launch fishbot_description gazebo_sim.launch.py命令时,终端显示:
      [ERROR] [launch]: Caught exception in launch (see debug for traceback): launch configuration 'model' does not exist这串错误,并且gazebo打不开
      当我终端执行ros2 launch fishbot_description gazebo_sim.launch.py --debug命令时,gazebo打开了,但是fishbot模型没显示,终端显示:
      [Wrn] [GuiIface.cc:120] Could not find the Qt platform plugin "wayland" in ""
      [DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.process.ProcessStderr'
      [DEBUG] [launch]: processing event: '<launch.events.process.process_stderr.ProcessStderr object at 0x72d00b7d9c30>'
      [DEBUG] [launch]: processing event: '<launch.events.process.process_stderr.ProcessStderr object at 0x72d00b7d9c30>' ✓ '<launch.event_handlers.on_process_io.OnProcessIO object at 0x72d00b6a6650>'
      [gzclient-3] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call
      [DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.process.ProcessStderr'
      [DEBUG] [launch]: processing event: '<launch.events.process.process_stderr.ProcessStderr object at 0x72d00b7d9c30>'
      [DEBUG] [launch]: processing event: '<launch.events.process.process_stderr.ProcessStderr object at 0x72d00b7d9c30>' ✓ '<launch.event_handlers.on_process_io.OnProcessIO object at 0x72d00b6a6650>'
      这个错误

      import launch
      import launch.launch_description_sources
      import launch_ros
      from ament_index_python.packages import get_package_share_directory
      import os
      import launch_ros.descriptions
      def generate_launch_description():

      urdf_package_path = get_package_share_directory('fishbot_description')
      
      default_xacro_path = os.path.join(urdf_package_path, 'urdf','fishbot/fishbot.urdf.xacro')
      # default_xacro_path = os.path.join(urdf_package_path,f'/home/cjl/chapt6/chapt6_ws/src/fishbot_description/urdf/fishbot/fishbot.urdf.xacro')
      #default_rviz_config_path= os.path.join(urdf_package_path,'config','display_robot_model.rviz')
      default_gazebo_world_path= os.path.join(urdf_package_path,'world','custom_room.world')
      #声明一个xacro目录的参数,方便修改
      action_declare_arg_mode_path = launch.actions.DeclareLaunchArgument(
          name='model',default_value=str(default_xacro_path),description='加载的模型文件路径'
      )
      #通过文件路径,获取内容,并转换成参数值对象,以供传入'robot_state_publisher'
      substitutions_command_result =launch.substitutions.Command(['xacro ',launch.
      substitutions.LaunchConfiguration('model')])
      robot_description_value=launch_ros.parameter_descriptions.ParameterValue(substitutions_command_result,
      value_type=str)
      action_robot_state_publisher = launch_ros.actions.Node(
          package='robot_state_publisher',
          executable='robot_state_publisher',
          parameters=[{'robot_description':robot_description_value}]
      )
      
      # action_joint_state_publisher = launch_ros.actions.Node(
      #     package='joint_state_publisher',
      #     executable='joint_state_publisher',
          
      # )
      # action_rviz_node = launch_ros.actions.Node(
      #     package='rviz2',
      #     executable='rviz2',
      #     arguments={'-d',default_rviz_config_path}
      # )
      action_launch_gazebo = launch.actions.IncludeLaunchDescription(
          launch.launch_description_sources.PythonLaunchDescriptionSource(
              [get_package_share_directory('gazebo_ros'),'/launch','/gazebo.launch.py']
          ),
          launch_arguments=[('world',default_gazebo_world_path),('verbose','true')]
      )
      action_spawn_entity =launch_ros.actions.Node(
          package='gazebo_ros',
          executable='spawn_entity.py',
          arguments=['-topic','/robot_description','-entity','fishbot']
      )
      return launch.LaunchDescription({
          action_declare_arg_mode_path,
          action_robot_state_publisher,
          action_launch_gazebo,
          action_spawn_entity
      })
      
      抱 1 条回复 最后回复 回复 引用 0
      • 抱
        抱着咸鱼的啊黄 年度VIP @抱着咸鱼的啊黄
        最后由 编辑

        我车调出来了,之前colcon build 错文件夹了,导致chat6里面有两个install,好像混了,把另外一个删了,车模型就出来,但是我还是有
        [Wrn] [GuiIface.cc:120] Could not find the Qt platform plugin "wayland" in ""
        [DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.process.ProcessStderr'
        [DEBUG] [launch]: processing event: '<launch.events.process.process_stderr.ProcessStderr object at 0x72d00b7d9c30>'
        [DEBUG] [launch]: processing event: '<launch.events.process.process_stderr.ProcessStderr object at 0x72d00b7d9c30>' ✓ '<launch.event_handlers.on_process_io.OnProcessIO object at 0x72d00b6a6650>'
        [gzclient-3] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call
        [DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.process.ProcessStderr'
        [DEBUG] [launch]: processing event: '<launch.events.process.process_stderr.ProcessStderr object at 0x72d00b7d9c30>'
        [DEBUG] [launch]: processing event: '<launch.events.process.process_stderr.ProcessStderr object at 0x72d00b7d9c30>' ✓ '<launch.event_handlers.on_process_io.OnProcessIO object at 0x72d00b6a6650>'
        这个错误
        请问怎么解决

        小鱼小 1 条回复 最后回复 回复 引用 0
        • 小鱼小
          小鱼 技术大佬 @抱着咸鱼的啊黄
          最后由 编辑

          @抱着咸鱼的啊黄 这个没关系

          新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

          1 条回复 最后回复 回复 引用 0
          • 第一个帖子
            最后一个帖子
          皖ICP备16016415号-7
          Powered by NodeBB | 鱼香ROS