Parse and encode CCSDS Orbit Parameter Messages (OPM).
Supports both the KVN (Keyword=Value Notation) and XML formats per CCSDS 502.0-B. An OPM carries a single epoch's Cartesian state plus optional Keplerian elements, spacecraft parameters, a 6x6 covariance, and a list of maneuvers.
parse/1 auto-detects the format from the first non-whitespace character: a
leading < is treated as XML, anything else as KVN. Date/time fields are
preserved as raw strings exactly as written.
Examples
{:ok, opm} = Sidereon.CCSDS.OPM.parse(kvn_string)
opm.metadata.object_name
opm.state.position_km # {x, y, z} in km
opm.keplerian.anomaly # {:true_anomaly, deg} or {:mean_anomaly, deg}
# KVN output (default)
kvn = Sidereon.CCSDS.OPM.encode(opm)
# XML output
xml = Sidereon.CCSDS.OPM.encode(opm, format: :xml)
# Round-trip through XML
{:ok, opm2} = Sidereon.CCSDS.OPM.parse(xml)
Summary
Functions
Encode an OPM.
Encode an OPM to KVN text explicitly.
Encode an OPM to XML text explicitly.
Parse an OPM in either KVN or XML format.
Parse an OPM in KVN format explicitly. Skips format auto-detection.
Parse an OPM in XML format explicitly. Skips format auto-detection.
Types
@type error() :: :missing_field | :invalid_field | :malformed
Failure reason from the OPM readers.
@type t() :: %Sidereon.CCSDS.OPM{ ccsds_opm_vers: String.t(), covariance: Sidereon.CCSDS.OPM.Covariance.t() | nil, creation_date: String.t() | nil, keplerian: Sidereon.CCSDS.OPM.Keplerian.t() | nil, maneuvers: [Sidereon.CCSDS.OPM.Maneuver.t()], metadata: Sidereon.CCSDS.OPM.Metadata.t(), originator: String.t() | nil, spacecraft: Sidereon.CCSDS.OPM.Spacecraft.t() | nil, state: Sidereon.CCSDS.OPM.State.t() }
A Cartesian triple {x, y, z}.
Functions
Encode an OPM.
Options
:format-:kvn(default) or:xml
Encode an OPM to KVN text explicitly.
Encode an OPM to XML text explicitly.
Parse an OPM in either KVN or XML format.
Format is auto-detected from the first non-whitespace character: < routes to
the XML parser, anything else to the KVN parser.
Returns {:ok, %Sidereon.CCSDS.OPM{}} or {:error, reason}.
Parse an OPM in KVN format explicitly. Skips format auto-detection.
Parse an OPM in XML format explicitly. Skips format auto-detection.