# cartographer/sensor/odometry_data.h ## Overview `OdometryData` is a timestamped robot pose measurement from an odometry source (wheel odometry, visual odometry, or similar). It is used by the pose extrapolator to improve pose prediction during local SLAM and by the optimization problem to add relative-pose constraints between consecutive nodes. ## Struct: `cartographer::sensor::OdometryData` ```cpp struct OdometryData { common::Time time; transform::Rigid3d pose; }; ``` - `time` — Timestamp of the measurement. - `pose` — The robot pose in an arbitrary odometry frame. ## Serialization ```cpp proto::OdometryData ToProto(const OdometryData& odometry_data); OdometryData FromProto(const proto::OdometryData& proto); ``` `proto::OdometryData` (defined in `sensor/proto/sensor.proto`) stores the timestamp as a UTS `int64` and the pose as a `transform.proto.Rigid3d`: ```protobuf message OdometryData { int64 timestamp = 1; transform.proto.Rigid3d pose = 2; } ``` ## Usage ```cpp sensor::OdometryData odometry{time, pose}; trajectory_builder->AddOdometryData(sensor_id, odometry); ``` Data is wrapped into a `Dispatchable` by the collator before being dispatched to the trajectory builder: ```cpp auto dispatchable = sensor::MakeDispatchable("odometer", odometry); ``` ## Role in the SLAM Pipeline - **Local SLAM** — `LocalTrajectoryBuilder2D`/`LocalTrajectoryBuilder3D` forward odometry to the `PoseExtrapolator`, which interpolates odometry to compute relative motion between scan-match nodes and adds odometry residuals to its Ceres problem (`odometry_translation_weight` / `odometry_rotation_weight`). - **Global optimization** — `OptimizationProblemInterface` stores `MapByTime` and the pose graph adds relative-pose constraints between consecutive nodes based on interpolated odometry. - **Serialization** — odometry data is stored per-trajectory in the serialization format via `proto::OdometryData` in `serialization.proto`. ## See Also - [Data](data.md) — Base class and `Dispatchable` wrapping - [ImuData](imu_data.md) — Complementary inertial measurement - [FixedFramePoseData](fixed_frame_pose_data.md) — Absolute pose measurement - [ImuBasedPoseExtrapolator](../mapping/internal/imu_based_pose_extrapolator.md) — Interpolates odometry between nodes