Skip to main content

Conventions and Coordinate Systems

This document describes the geodetic and attitude conventions used by the Raptor SDK. For the API-side view of how these are configured on a pose, see the SDK Integration Guide.

Reference Frame​

The SDK uses ITRF2008 (International Terrestrial Reference Frame 2008) as its default reference frame. It is equivalent to WGS 84 G1762 within millimetres and to WGS 84 G1674 within centimetres.

Coordinate Systems​

The SDK supports two coordinate systems: ECEF and Geodetic.

ECEF (Earth-Centered Earth-Fixed)​

A 3D Cartesian system with its origin at Earth's center of mass:

  • X-axis: equator × prime meridian (0° lat, 0° lon)
  • Y-axis: equator at 90° E
  • Z-axis: North Pole
  • Coordinates: [X, Y, Z] in meters
  • Attitude: rotation relative to the ECEF X/Y/Z axes

Geodetic​

Latitude, longitude and height above a reference surface (positive up):

  • Latitude: north/south of the equator, range [-π/2, π/2] (radians) or [-90°, 90°]
  • Longitude: east/west of the prime meridian, range [-π, π] (radians) or [-180°, 180°]
  • Altitude: height above the reference surface, positive upward
  • Attitude: rotation relative to the local NED frame at the position

NEU vs NED​

NEU labels the lat, lon, alt ordering of the position components on the coords field of position::Geodetic / pose::Geodetic (altitude positive up) — it is an ordering, not a Cartesian frame. Attitude on a geodetic pose is always relative to the local NED tangent-plane frame defined below.

Height System (Vertical Datum)​

The supported height systems are:

  • Ellipsoid (HAE — Height Above Ellipsoid): height perpendicular to the WGS84 ellipsoid. GPS/GNSS receivers natively output ellipsoid heights.
  • EGM2008 (Orthometric / HAMSL): height perpendicular to the EGM2008 geoid, which approximates mean sea level. Surveyed elevations, topographic maps and barometric altimeters typically reference the geoid.
  • EGM96 (Orthometric / HAMSL): height perpendicular to the lower-resolution EGM96 geoid, used by some GNSS receivers and flight controllers.

NED (North-East-Down)​

NED is the local tangent-plane frame used for attitude on geodetic poses and as the intermediate frame in the rotation chain below. It follows the DIN 9300 convention: x → north, y → east, z → down. North refers to the true/geographic north, not the magnetic north.

NED axes convention

NED convention with axes named according to the standard DIN 9300

Attitude Representation​

The SDK takes camera attitude as a unit quaternion [x, y, z, w] (scalar component last): the orientation of the camera frame relative to the attitude frame of the pose. The attitude frame is the ECEF axes for pose::Ecef and the local NED axes for pose::Geodetic.

The rotation matrix of the quaternion converts camera-frame vector components into attitude-frame components:

vatt=Rcamatt⋅vcamv_{att} = R^{att}_{cam} \cdot v_{cam}

Its columns are the camera axes expressed in the attitude frame. Transpose it to convert attitude-frame components into camera-frame components.

The derivations below use rotation matrices and Euler angles only as intermediate steps; convert the final rotation matrix to a quaternion before passing it to the SDK.

Euler angles in this guide follow the Z-Y-X (yaw-pitch-roll) intrinsic sequence. The camera frame itself follows the DIN 9300 convention (x-forward along the optical axis into the scene, y-right, z-down), the same convention used for the platform frame.

Pick whichever CRS your nav system produces​

Pass pose::Geodetic if your nav system gives lat/lon/height with attitude relative to local NED (the usual GPS/IMU output). Pass pose::Ecef if it gives ECEF position with attitude relative to the ECEF axes. The SDK accepts either representation and accounts for the local NED ↔ ECEF rotation of the attitude — you do not need to apply that rotation yourself.

The helpers cameraRelativeToNed(pose) and nedRelativeToCamera(pose) in <raptor/transforms.hpp> (Python: raptor.camera_relative_to_ned(pose) and raptor.ned_relative_to_camera(pose)) return the camera orientation relative to local NED and its inverse, for a pose in either CRS. The first equals the attitude of the pose expressed as a pose::Geodetic. They only rotate the attitude; they do not convert positions.

The rest of this section derives the rotation chain for reference, e.g. if you need to inspect or debug attitude outside the SDK, or build a quaternion by hand from raw yaw/pitch/roll plus a camera mounting.

Camera-to-attitude-frame rotation chain​

In the formulas, RBAR^{A}_{B} converts vector components from frame B into frame A, so a product of rotations is applied from right to left.

The camera attitude is composed from successive frame rotations:

  • Camera frame → Platform / body frame → Attitude frame (local NED, and then ECEF for a pose::Ecef)

The derivation below uses ECEF as the attitude frame. For a pose::Geodetic the attitude frame is local NED, so the NED→ECEF step drops out.

The complete transformation is:

R=RNEDECEF⋅RcamNED=RNEDECEF⋅RbodyNED⋅Rcambody\mathbf{R} = R^{^{ECEF}}_{_{NED}} \cdot R^{^{NED}}_{_{cam}} = R^{^{ECEF}}_{_{NED}} \cdot R^{^{NED}}_{_{body}} \cdot R^{^{body}}_{_{cam}}

The steps below describe the factors of this product from left to right, i.e. from the attitude frame towards the camera.

1. Local NED to ECEF​

The NED-to-ECEF rotation depends only on latitude ϕ\phi and longitude λ\lambda. Its columns are the local N, E and D axes expressed in ECEF:

RNEDECEF=[−sin⁡(ϕ)cos⁡(λ)−sin⁡(λ)−cos⁡(ϕ)cos⁡(λ)−sin⁡(ϕ)sin⁡(λ)cos⁡(λ)−cos⁡(ϕ)sin⁡(λ)cos⁡(ϕ)0−sin⁡(ϕ)]R^{^{ECEF}}_{_{NED}} = \begin{bmatrix} -\sin(\phi) \cos(\lambda) & -\sin(\lambda) & -\cos(\phi) \cos(\lambda) \\ -\sin(\phi) \sin(\lambda) & \cos(\lambda) & -\cos(\phi) \sin(\lambda) \\ \cos(\phi) & 0 & -\sin(\phi) \end{bmatrix}

If the position is given in ECEF, convert it to geodetic first to obtain ϕ\phi and λ\lambda.

2. Platform (body frame) to local NED​

Navigation systems (GPS/IMU, flight management systems) typically express platform attitude as yaw, pitch and roll angles relative to local NED. Synonyms you may encounter:

  • yaw — heading, azimuth, bearing
  • pitch — elevation, nose-up/down
  • roll — bank, wing-up/down

The Z-Y-X intrinsic composition gives:

RbodyNED=RZ(yaw)⋅RY(pitch)⋅RX(roll)R^{^{NED}}_{_{body}} = R_{_{Z}}(\text{yaw}) \cdot R_{_{Y}}(\text{pitch}) \cdot R_{_{X}}(\text{roll})

// Navigation system outputs (radians)
Matrix R_ned_from_body = eulerZYX(yaw, pitch, roll);

3. Camera to platform​

Encodes the camera's mounting orientation in the platform frame. For a fixed mount this is a constant matrix derived from the mechanical mounting angles; for a gimbal mount it varies with the gimbal state and must be supplied per frame.

Example — nadir-looking camera (straight down):

// -90° pitch points the camera X-axis (optical axis) downward;
// -90° roll aligns image width with the platform X-axis.
double yaw = 0.0;
double pitch = degreesToRadians(-90.0);
double roll = degreesToRadians(-90.0);
Matrix R_body_from_camera = eulerZYX(yaw, pitch, roll);

For this mount, image width aligns with the platform X-axis (forward/aft) and image height with the platform Y-axis (left/right).

Camera mount nadir

Nadir-looking camera

Example — forward-looking camera, 45° down from horizontal:

double yaw   = 0.0;
double pitch = degreesToRadians(-45.0);
double roll = 0.0;
Matrix R_body_from_camera = eulerZYX(yaw, pitch, roll);

Camera mount 45 degrees

Forward-looking camera with 45° downward tilt

Image-plane convention (only if your pipeline uses a different one)​

The SDK's camera frame follows DIN 9300: x-forward (into the image), y-right, z-down. If an upstream stage produces poses in the typical computer-vision image frame (x-right, y-down, z-out of the image), apply the corresponding fixed rotation before passing the result to the SDK.

Rotation matrix to quaternion​

Convert the combined rotation matrix to a unit quaternion using any numerically stable routine. The SDK consumes the result as [x, y, z, w] with the scalar component last.

Putting it together​

The attitude quaternion carried by each pose type encodes:

  • pose::Geodetic: RcamNED=RbodyNED⋅RcambodyR^{NED}_{cam} = R^{NED}_{body} \cdot R^{body}_{cam}
  • pose::Ecef: RcamECEF=RNEDECEF⋅RbodyNED⋅RcambodyR^{ECEF}_{cam} = R^{ECEF}_{NED} \cdot R^{NED}_{body} \cdot R^{body}_{cam}

In practice, supply whichever form your nav system produces and let the SDK convert; you only need to build the chain by hand if you are constructing a pose outside the SDK or validating its contents.

Other SDK Conventions​

Data Format​

  • Matrix Storage: Row-major order for all matrices and images
  • Angular Units: Radians for all internal calculations
  • North Reference: True north (not magnetic north)