I’ve had a look at the classes around OCMs in the odm package, and as far as I can tell there isn’t a way to write an OCM file, given a list of SpacecraftStates for example.
Is there a plan to add this functionality in the future (or maybe I just missed something)?
You can use the OCMWriter class. This class extends AbstractMessageWriter which itself implements MessageWriter, so it can be used either to write the message in one call to the writeMessage(generator, message) or to write the message in several steps using the writeHeader, writeSegment and writeFooter methods. The class can generate either XML or KVN files.
It seems we forgot to provide an OCM-based implementation of EphemerisFileWriter though, similar to the one that exists for OEM.
Beware that OCM is not yet a published standard! It is based on draft documents we have because Orekit is one of the two reference implementations needed to validate the standard (the other one is STK). So for now OCM is not official and should be used with caution and not for operational tasks.
Thanks for your reply. I see the OcmWriter, but it does not seem to be possible to create an OCM or a segment to use with the writer as the constructor for OcmMetadata is package-private. However, without an ephemeris writer trying to build these parts for the Ocm would get quite complex, so this probably doesn’t matter.
I take from your comments that providing an ephemeris writer is not a high priority for development yet, this package is effectively read-only for now.
The fact the constructor is package private definitely seems to be a bug to me. Could you file a bug report?
The ephemeris writer is not a low priority, it’s also an error on my side, I just forgot to add it. Here again, please file a bug report so we fix it.