> ## Documentation Index
> Fetch the complete documentation index at: https://docs.altnautica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Navigation: camera-IMU time offset

> Optional: load a Kalibr camchain.yaml so Navigation pairs each frame with the right gyro sample.

Optical flow needs no camera calibration. The plugin pairs each frame with the closest gyro sample, and by default it assumes the camera and IMU clocks line up. If your camera has a known delay, you can give the plugin a measured camera-IMU time offset. This is optional.

The only value the plugin uses is `timeshift_cam_imu` from a Kalibr-style `camchain.yaml`. It does not use the intrinsics or `T_cam_imu`.

## 1. Measure the offset with Kalibr

Run Kalibr's camera-IMU calibration (`kalibr_calibrate_imu_camera`) offline for the camera and IMU on the drone. It writes a `camchain.yaml`. The extension does not run Kalibr for you.

## 2. Validate the file

The extension's repository includes a small Python package that loads and checks a `camchain.yaml` before it goes onto a drone:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
git clone https://github.com/altnautica/ADOSExtensions.git
cd ADOSExtensions/extensions/navigation/agent/calibration-helper
python -m pip install -e .
python -c "from altnautica_vision_nav_calib import load_intrinsics, load_extrinsics; \
print(load_intrinsics('camchain.yaml')); print(load_extrinsics('camchain.yaml'))"
```

The loaders raise an error on a malformed block, for example a `T_cam_imu` rotation that is not orthonormal, and the extrinsics object flags a suspicious timeshift (`has_suspicious_timeshift`).

The file holds a `cam0` block (a bare block without the `cam0:` wrapper also loads):

```yaml theme={"theme":{"light":"github-light","dark":"github-dark"}}
cam0:
  camera_model: pinhole
  intrinsics: [460.0, 460.0, 320.0, 240.0]
  distortion_model: radtan
  distortion_coeffs: [-0.28, 0.07, 0.0002, 0.00002]
  resolution: [640, 480]
  T_cam_imu:
    - [0.0, -1.0, 0.0, 0.02]
    - [1.0, 0.0, 0.0, 0.00]
    - [0.0, 0.0, 1.0, -0.01]
    - [0.0, 0.0, 0.0, 1.0]
  timeshift_cam_imu: 0.004
```

`timeshift_cam_imu` is in seconds, with Kalibr's convention `t_imu = t_cam + timeshift`.

## 3. Copy it to the drone

Copy the file into the plugin's per-drone data directory on the drone, named `camchain.yaml`:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
ls /var/ados/plugin-data/com.altnautica.navigation/drones/
sudo cp camchain.yaml /var/ados/plugin-data/com.altnautica.navigation/drones/<agent-id>/camchain.yaml
```

`<agent-id>` is the directory the first command lists for this drone.

## 4. Restart the plugin

The plugin reads the file once, at start-up:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
ados plugin disable com.altnautica.navigation
ados plugin enable com.altnautica.navigation
```

The camera row on the Navigation page's **Sensors** card then shows **Calibrated** instead of **Not calibrated**.

## Sync offset on the Sensors card

The Sensors card shows the live camera-IMU sync offset: green at 10 ms or less, yellow up to 30 ms, red above 30 ms. The colour is informational. It does not change the estimator state or the pre-arm report. A sync offset that drifts usually means the camera mode changed (resolution, frame rate or exposure); measure again in the mode you fly.

## Next steps

> [card] [Troubleshooting](https://docs.altnautica.com/drone-agent/navigation-troubleshooting.md)
>
> Low flow quality, scale problems and lost frames.

> [card] [Modes and fallback](https://docs.altnautica.com/drone-agent/navigation-modes.md)
>
> The modes and the scale ladder.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.