# tf2.BufferCore::lookupTransform：查找需要外推到未来

- **ID:** `ros2/tf2-buffer-core-lookup-transform-time-travel`
- **领域:** ros2
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

请求的变换时间晚于最新可用帧的时间戳，通常由时钟偏差、sim_time配置错误或发布延迟导致。

## 版本兼容性

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

## 解决方案

1. ```
   Set use_sim_time=True on all nodes and ensure /clock is published correctly. Run 'ros2 bag play --clock' to simulate time.
   ```
2. ```
   Use tf2_ros::Buffer::canTransform() with a timeout before lookupTransform to wait for data.
   ```
3. ```
   Check and synchronize system clocks across machines using NTP or chrony.
   ```

## 无效尝试

- **Increasing the transform timeout in lookupTransform() call** — Timeout increase doesn't fix clock misalignment; the transform still doesn't exist at the requested time. (60% 失败率)
- **Manually setting ROS time using /clock publisher to wall clock** — If use_sim_time is true, wall clock updates are ignored; the buffer only uses simulated time. (70% 失败率)
- **Restarting all nodes** — Transient clock skew or missing data persists if the root cause (e.g., late publisher) isn't addressed. (50% 失败率)
