# tf2.BufferCore::lookupTransform: 找不到从 'map' 到 'base_link' 的变换，错误：传递给 lookupTransform 参数 target_frame 的 'base_link' 不存在

- **ID:** `ros2/tf2-buffer-core-timeout`
- **领域:** ros2
- **类别:** runtime_error
- **错误码:** `TF-3001`
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

TF 缓冲区不包含请求的变换，因为源帧 ('base_link') 从未被发布，或者变换发布者（例如 robot_state_publisher）未运行或未发布正确的帧。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| ROS2 Foxy Fitzroy | active | — | — |
| ROS2 Humble Hawksbill | active | — | — |
| ROS2 Iron Irwini | active | — | — |

## 解决方案

1. ```
   Verify that the robot_state_publisher is running and publishing the correct transforms. Run `ros2 run tf2_ros tf2_echo map base_link` to check if the transform exists. If not, ensure the URDF/SDF file defines the 'base_link' frame and that robot_state_publisher is launched.
   ```
2. ```
   If the frame is published by a custom node, add a delay before calling `lookupTransform` to allow the TF tree to populate. Use `tf2_ros::Buffer::canTransform` with a timeout.
   ```

## 无效尝试

- **** — Adding a static transform publisher with wrong frame names (e.g., 'odom' instead of 'map') may silence the error but produce incorrect transforms, leading to navigation or visualization issues. (70% 失败率)
- **** — Increasing the TF buffer size in the node parameters doesn't help because the transform was never published; the buffer is empty for that frame. (80% 失败率)
