Orbit Comprehensive Message parser (CCSDS 505.0-B-2)
README.md

ocm #

Parse CCSDS 505.0-B-2 orbit messages (OCM) in OCaml.

To tell whether two objects in orbit might collide, conjunction assessment needs each object's predicted trajectory and some idea of how wrong that prediction could be. An Orbit Comprehensive Message (OCM) carries both for one object: the trajectory ephemeris and the covariance history, along with physical properties such as mass and radar cross-section and metadata about how the orbit was determined. Each covariance is a 6x6 matrix over position and velocity, variances on the diagonal, given at a series of epochs.

This library parses OCMs in KVN format, which is lines of keyword = value. Once parsed, a trajectory can be sampled at any epoch it covers; between the two nearest states it fits a cubic Hermite polynomial, so both positions and both velocities are matched. If a copy of the TraCSS conjunction assessment verification dataset is present, the tests also parse a real OCM from it (TraCSS is the US Office of Space Commerce's traffic coordination system).

Installation #

Install with opam:

$ opam install ocm

If opam cannot find the package, it is not in the public opam-repository yet. Add the overlay repository first:

$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install ocm

Usage #

let report path =
  match Ocm.of_file path with
  | Ok ocm ->
      Fmt.pr "Object: %s (%s)@." (Ocm.object_name ocm)
        (Ocm.object_designator ocm);
      List.iter
        (fun traj ->
          Fmt.pr "Trajectory %s: %d points@." traj.Ocm.traj_id
            (Array.length traj.data))
        ocm.trajectories
  | Error e -> Fmt.epr "%a@." Ocm.pp_error e

API Overview #

A parsed message is a t, with its header, metadata, trajectories, covariances, physical properties and orbit determination data. Parse one from KVN text with of_string, of_channel or of_file, and read the metadata with object_name, object_designator, epoch_tzero, useable_start and useable_stop.

Each trajectory is an ephemeris segment with a reference frame and time bounds, made of state_vectors: an epoch, a position in km and a velocity in km/s. state_at interpolates a trajectory anywhere inside its span. Covariances come in covariance_blocks, each with its own reference frame, and covariance_at picks the entry closest to a given time. physical holds the wet mass, area, radar cross-section and solar radiation coefficient.

License #

ISC. See LICENSE.md.