# RMW实现不支持的消息类型：'my_msgs/msg/MyType' 不被此RMW实现支持

- **ID:** `ros2/rmw-impl-unsupported-type`
- **领域:** ros2
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

自定义消息类型使用了所选RMW实现（如rmw_fastrtps_cpp）无法序列化的字段类型（如嵌套数组、带复杂类型的无界序列），这是DDS类型系统的限制。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| ROS2 Humble | active | — | — |
| ROS2 Iron | active | — | — |
| ROS2 Rolling | active | — | — |

## 解决方案

1. ```
   简化消息类型：将嵌套序列替换为扁平字段或使用有界序列。例如，如果最大大小已知，将'float64[] data'改为'float64[100] data'。
   ```
2. ```
   切换到其他RMW实现以更好地支持该类型，例如设置RMW_IMPLEMENTATION=rmw_connextdds（如果已授权）并使用相同消息测试。
   ```
3. ```
   将复杂消息拆分为多个简单消息，发布到不同话题，然后在订阅者节点中同步。
   ```

## 无效尝试

- **Switching to another RMW implementation (e.g., rmw_cyclonedds_cpp) blindly without testing message compatibility** — The error is specific to the message type, not the RMW. Other RMWs may have similar limitations for complex types. (70% 失败率)
- **Removing all fields from the message type to make it simpler, losing functionality** — Overly aggressive simplification may break application logic; the type may still be unsupported if any problematic field remains. (50% 失败率)
