ros2 network_error ai_generated partial

[WARN] [rmw_fastrtps]: 发现超时 30 秒,某些节点可能未被发现

[WARN] [rmw_fastrtps]: Discovery timed out after 30 seconds, some nodes may not be discovered

ID: ros2/ros2-graph-discovery-delay-large-system

其他格式: JSON · Markdown 中文 · English
90%修复率
87%置信度
1证据数
2024-05-12首次发现

版本兼容性

版本状态引入弃用备注
ros2:humble active
ros2:iron active
rmw_fastrtps_cpp:6.3.0 active
fastdds:2.10.0 active

根因分析

Fast DDS 发现阶段因同一网络上节点数量过多(例如 >20)而超过默认超时,导致 ROS 图发现不完整。

English

Fast DDS discovery phase exceeded the default timeout due to a large number of nodes (e.g., >20) on the same network, causing incomplete ROS graph discovery.

generic

官方文档

https://fast-dds.docs.eprosima.com/en/latest/fastdds/ros2/discovery_server.html

解决方案

  1. 使用 Fast DDS 发现服务器减少网络流量。创建发现服务器:
    fastdds discovery --server-id 0
    
    然后使用服务器环境启动节点:
    ROS_DISCOVERY_SERVER=127.0.0.1:11811 ros2 run my_package my_node
    
    这集中了发现过程并减少了超时问题。
  2. 通过设置环境变量增加发现超时并减少发现流量:
    export FASTRTPS_DEFAULT_PROFILES_FILE=/path/to/fastdds_profile.xml
    
    在 XML 中设置:
    <discovery_config>
      <leaseDuration>PT60S</leaseDuration>
      <announcementPeriod>PT5S</announcementPeriod>
    </discovery_config>
    
    然后重启节点。

无效尝试

常见但无效的做法:

  1. Increasing the discovery timeout to 60 seconds via environment variable 70% 失败

    Merely extending the timeout does not address the underlying scalability issue; discovery may still fail with more nodes.

  2. Restarting all nodes simultaneously 85% 失败

    Simultaneous startup can cause a discovery storm, making the problem worse.