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

- **ID:** `ros2/ros2-graph-discovery-delay-large-system`
- **领域:** ros2
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| ros2:humble | active | — | — |
| ros2:iron | active | — | — |
| rmw_fastrtps_cpp:6.3.0 | active | — | — |
| fastdds:2.10.0 | active | — | — |

## 解决方案

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>

然后重启节点。
   ```

## 无效尝试

- **Increasing the discovery timeout to 60 seconds via environment variable** — Merely extending the timeout does not address the underlying scalability issue; discovery may still fail with more nodes. (70% 失败率)
- **Restarting all nodes simultaneously** — Simultaneous startup can cause a discovery storm, making the problem worse. (85% 失败率)
