# [警告] [rosbag2_player]: 没有时钟发布者。播放暂停时不会发布时钟。

- **ID:** `ros2/rosbag2-clock-not-published-when-paused`
- **领域:** ros2
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

当 ros2 bag play 暂停时（例如通过空格键），/clock 主题停止发布，导致依赖 sim_time 的节点挂起或失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| ROS2 Humble | active | — | — |
| ROS2 Iron | active | — | — |
| rosbag2 0.15.x | active | — | — |
| rosbag2 0.16.x | active | — | — |

## 解决方案

1. ```
   避免暂停播放。相反，使用 'ros2 bag play --rate 0.0' 冻结时间，然后以正速率恢复。
   ```
2. ```
   实现一个自定义时钟桥接节点，缓存最后一个 /clock 消息，并在包暂停时重新发布它。
   ```

## 无效尝试

- **** — The bag player controls clock publishing; manual intervention may cause timestamp mismatches or conflicts. (80% 失败率)
- **** — Pausing is intended; restarting loses playback position and may not fix the underlying issue if nodes need continuous clock. (50% 失败率)
- **** — This defeats the purpose of using sim_time and may cause nodes to use wall clock, leading to desynchronization. (90% 失败率)
