Files
vSLAM_ws/TF_FRAME_MAP.md
trung09122002 120923f9cc upload
2026-08-28 11:16:38 +07:00

40 lines
7.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TF Frame Map
Use verified target-repository facts only. Keep unknown values as `Unknown / needs confirmation`.
Static edges come from URDF fixed joints, published once on `/tf_static` by `robot_state_publisher`. Offsets below are resolved from the xacro properties in `robot.urdf.xacro` (`wheel_radius` 0.075, `wheel_separation` 0.36).
| Parent Frame | Child Frame | Static/Dynamic | Broadcaster | Rate | Source File | Notes |
| --- | --- | --- | --- | --- | --- | --- |
| `map` | `odom` | Dynamic | **one of three, never more**: `slam_core` (L4+), `amcl` (localization mode), `static_transform_publisher` identity (L3 only) | keyframe-driven / amcl update / latched | `slam_core/src/slam_core_node.cpp:191-204`, `robot_bringup/launch/perception.launch`, `robot_bringup/launch/localization.launch` | The drift-correction edge — allowed to jump. `slam.launch` passes `publish_static_map_tf:=false` precisely to retire L3's identity publisher before `slam_core` takes over. ⚠️ `slam_core` is passthrough (no GTSAM), so this correction is currently a no-op and pose drifts. |
| `odom` | `base_footprint` | Dynamic | `ekf_odom` (`robot_localization/ekf_localization_node`) | 50 Hz | `robot_bringup/config/ekf_odom.yaml` | The smooth, continuous, never-blind edge — drifts but never jumps. `slam_core` is configured never to publish it (`publish_tf` there means `map → odom` only). |
| `base_footprint` | `base_link` | Static | `robot_state_publisher` (joint `base_joint`) | `/tf_static` | `robot_bringup/urdf/robot.urdf.xacro` | xyz `0 0 0.075` — exactly `wheel_radius`. `base_footprint` is the ground projection and is the frame the whole nav stack uses. |
| `base_link` | `left_wheel_link` | Dynamic | `robot_state_publisher` from `/joint_states` | ~50 Hz *(sim)* | `robot_bringup/urdf/robot.urdf.xacro` | Continuous joint `left_wheel_joint`, xyz `0 0.18 0`. The joint **name** is the encoder interface shared by Gazebo, the L0 fake publisher, and real MCU firmware. |
| `base_link` | `right_wheel_link` | Dynamic | `robot_state_publisher` from `/joint_states` | ~50 Hz *(sim)* | `robot_bringup/urdf/robot.urdf.xacro` | Continuous joint `right_wheel_joint`, xyz `0 -0.18 0`. |
| `base_link` | `front_caster_link` | Static | `robot_state_publisher` | `/tf_static` | `robot_bringup/urdf/robot.urdf.xacro` | xyz `0.08 0 -0.0375`. Contact stiffness `kp` is 100× softer than the wheels — with a rigid body on four contact points, load distribution is indeterminate and ODE resolves it by stiffness. Getting this wrong once made the encoders report 4.4 m while ground truth showed 0.66 m. |
| `base_link` | `rear_caster_link` | Static | `robot_state_publisher` | `/tf_static` | `robot_bringup/urdf/robot.urdf.xacro` | xyz `-0.20 0 -0.0375`. |
| `base_link` | `laser_link` | Static | `robot_state_publisher` (joint `laser_joint`) | `/tf_static` | `robot_bringup/urdf/sensors.xacro` | xyz `0.24 0 0.125`, no rotation. Mounted ahead of the body front face (x=0.14) so rays are not blocked; height 0.20 m above ground sees chair and table *legs*, not table tops. |
| `base_link` | `camera_link` | Static | `robot_state_publisher` (joint `camera_joint`) | `/tf_static` | `robot_bringup/urdf/sensors.xacro` | xyz `0.19 0 0.725`, rpy `0 0.2618 0` — pitched 15° **down** to see the floor near the robot plus steps and drops. |
| `base_link` | `imu_link` | Static | `robot_state_publisher` (joint `imu_joint`) | `/tf_static` | `robot_bringup/urdf/sensors.xacro` | xyz `0 0 0.025`. Mount rigidly, close to `base_link`, far from motors, with mechanical damping — tile floors and hard wheels produce heavy vibration. |
| `camera_link` | `camera_depth_optical_frame` | Static | `robot_state_publisher` | `/tf_static` | `robot_bringup/urdf/sensors.xacro` | rpy `-π/2 0 -π/2` → z-forward, x-right, y-down (REP-103 optical convention). Depth images and the raw cloud are stamped with this frame. |
| `camera_depth_optical_frame` | `camera_infra1_optical_frame` | Static | `robot_state_publisher` | `/tf_static` | `robot_bringup/urdf/sensors.xacro` | Identity — the D410 computes depth in the left IR frame, so they share an origin. |
| `camera_depth_optical_frame` | `camera_infra2_optical_frame` | Static | `robot_state_publisher` | `/tf_static` | `robot_bringup/urdf/sensors.xacro` | xyz `0.055 0 0` — the 55 mm stereo baseline. |
## Frame Conventions
- Fixed/world frame: `map`
- Robot base frame: `base_footprint` — used by the EKF (`base_link_frame`), `slam_core`, both costmaps (`robot_base_frame`), `octomap_server` (`base_frame_id`), `gravity_align` (`output_frame`), and the Gazebo diff-drive plugin (`robotBaseFrame`). Note `gravity_align` reads `base_frame: base_link` for the tilt lookup but emits clouds in `base_footprint`.
- Sensor frames: `laser_link`, `camera_link`, `imu_link` — all x-forward, y-left, z-up (REP-103)
- Camera optical frames: `camera_depth_optical_frame`, `camera_infra1_optical_frame`, `camera_infra2_optical_frame` — z-forward, x-right, y-down
- Map/odom relationship: strict single-owner split. `ekf_odom` owns `odom → base_footprint` (smooth, continuous, accumulates drift); the SLAM layer owns `map → odom` (corrects drift, permitted to jump). Two nodes publishing one edge produces no error message — only erratic transforms — so this split is enforced by configuration in `ekf_odom.yaml` and `slam_core.yaml` and by the `publish_static_map_tf` argument.
## Known Risks
- **Three candidate publishers for `map → odom`.** L3 uses a static identity, L4+ uses `slam_core`, localization mode uses `amcl`. If `perception.launch` is included without `publish_static_map_tf:=false` while `slam_core` runs, both publish the same edge and TF output jitters silently. `slam.launch` already handles this; any new launch file must too.
- **`slam_core` is passthrough.** GTSAM is not installed, so there is no optimization, scan matching, or loop closure. `map → odom` does not actually correct anything yet and pose drifts without bound. Expected until GĐ5.
- **`world` is not in the TF tree.** It appears only as `header.frame_id` on `/ground_truth/odom`, stamped by `libgazebo_ros_p3d`. Nothing broadcasts a transform to it, so `lookupTransform` against `world` will always fail. Evaluation scripts must compare message poses directly.
- **`/joint_states` can get two publishers.** `description.launch` defaults `publish_fake_joints:=true` for standalone L0. `sim.launch` and the real-hardware path both pass `false`. Leaving it true alongside Gazebo or MCU firmware yields two sources on one topic and unstable wheel TF.
- **Camera extrinsics are nominal, not calibrated.** The 15° downward pitch and all sensor offsets exist only as URDF numbers. `drivers.launch` sets `publish_tf:=false` on `realsense2_camera`, so on real hardware *every* camera frame comes from this URDF — a mount that does not match these values silently misplaces the point cloud. Extrinsic calibration is outstanding (GĐ2).
- **Robot geometry is duplicated.** `wheel_radius` and `wheel_separation` live in `robot.urdf.xacro`, `robot.yaml`, and `depth_filter.yaml` (`gravity_align/wheel_radius`). All three must be edited together. UMBmark calibration will change them.
- **`transform_tolerance: 0.5` in all three costmap configs** is generous enough to mask moderate TF latency rather than surface it.