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

    6.2.2运行显示display_robot.launch.py报错[ERROR] [launch]: Caught exception in launch (see debug for traceback): 'ParameterValue' object has no attribute 'describe_sub_entities'

    已定时 已固定 已锁定 已移动
    ROS2机器人开发:从入门到实践
    launch文件启动报错 launch.py 启动报错
    1
    1
    429
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 2
      2208735873
      最后由 编辑

      6.2.2运行显示display_robot.launch.py报错[ERROR] [launch]: Caught exception in launch (see debug for traceback): 'ParameterValue' object has no attribute 'describe_sub_entities'
      0fd0c1bc-d368-4fa3-8cf0-986b1e0a3bf5-图片.png
      debug log:
      dw@dw:~/codes/chapt6/chapt6_ws/src/fishbot_description/launch$ ros2 launch fishbot_description display_robot.launch.py --debug
      [DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.IncludeLaunchDescription'
      [INFO] [launch]: All log files can be found below /home/dw/.ros/log/2025-05-06-11-43-05-130647-dw-11442
      [INFO] [launch]: Default logging verbosity is set to DEBUG
      [DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7cd550b06560>'
      [DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7cd550b06560>' ✓ '<launch.event_handlers.on_include_launch_description.OnIncludeLaunchDescription object at 0x7cd550dcd6c0>'
      [DEBUG] [launch]: An exception was raised in an async action/event
      [DEBUG] [launch]: Traceback (most recent call last):
      File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 336, in run_async
      raise completed_tasks_exceptions[0]
      File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 230, in _process_one_event
      await self.__process_event(next_event)
      File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 250, in __process_event
      visit_all_entities_and_collect_futures(entity, self.__context))
      File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
      futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
      File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
      futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
      File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
      sub_entities = entity.visit(context)
      File "/opt/ros/humble/lib/python3.10/site-packages/launch/action.py", line 108, in visit
      return self.execute(context)
      File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/include_launch_description.py", line 164, in execute
      launch_description.get_launch_arguments_with_include_launch_description_actions())
      File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_description.py", line 161, in get_launch_arguments_with_include_launch_description_actions
      process_entities(self.entities, _conditional_inclusion=conditional_inclusion)
      File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_description.py", line 152, in process_entities
      entity.describe_sub_entities(),
      AttributeError: 'ParameterValue' object has no attribute 'describe_sub_entities'

      [ERROR] [launch]: Caught exception in launch (see debug for traceback): 'ParameterValue' object has no attribute 'describe_sub_entities'
      [DEBUG] [launch.launch_context]: emitting event: 'launch.events.Shutdown'
      [DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7cd550dcd5a0>'
      [DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7cd550dcd5a0>' ✓ '<launch.event_handlers.on_shutdown.OnShutdown object at 0x7cd550b07a00>'

      从网上没搜到相关问题及解决方案,deepseek更改代码如下:

      import launch
      import launch_ros
      from ament_index_python.packages import get_package_share_directory
      import launch_ros.parameter_descriptions

      def generate_launch_description():
      urdf_tutorial_path = get_package_share_directory('fishbot_description')
      default_model_path = urdf_tutorial_path + '/urdf/first_robot.urdf'

      action_declare_arg_mode_path = launch.actions.DeclareLaunchArgument(
          name='model', 
          default_value=default_model_path,  # 不需要str()转换
          description='URDF的绝对路径'
      )
      
      robot_description = launch_ros.parameter_descriptions.ParameterValue(
          launch.substitutions.Command(['cat ', launch.substitutions.LaunchConfiguration('model')]), 
          value_type=str
      )
      
      robot_state_publisher_node = launch_ros.actions.Node(
          package='robot_state_publisher',
          executable='robot_state_publisher',
          parameters=[{'robot_description': robot_description}]
      )
      
      joint_state_publisher_node = launch_ros.actions.Node(
          package='joint_state_publisher',
          executable='joint_state_publisher',
          name='joint_state_publisher'
      )
      
      rviz_node = launch_ros.actions.Node(
          package='rviz2',
          executable='rviz2',
          name='rviz2'
      )
      
      return launch.LaunchDescription([
          action_declare_arg_mode_path,
          joint_state_publisher_node,
          robot_state_publisher_node,  # 确保先启动robot_state_publisher
          rviz_node
          # 移除了robot_description的直接添加
      ])
      

      这段代码与书上的主要不同之处是把action_declare_arg_mode_path中default_value参数去掉str()

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