Orekit Subclassing in Matlab

Hi all,

I feel I identified a huge stopper to continue using orekit in Matlab.
As we know, using it from Matlab relies on the wrapper accessing the compiled .jar.

Soon the necessity comes up to subclass, e.g. the “OrekitFixedStepHandler”.

For Pyhton there seems to appear a “PyhtonOrekitFixedStepHandler”, however for Matlab this seems not to.

So the question is: is this observation correct? It is not possible to subclass orekit classes in Matlab itself?

If yes, how dramatic do you see this. For me it appears to be a show stopper as soon as you want to use oerkit a bit more customized.

Cheers!

Hi,

You can write your custom classes in Java and pass the .jar as you said yourself to Matlab.

Cheers

Thanks. But for this I need to compile orekit in a Java IDE in order to create the .jar, correct?

You need to compile your Java code into a .jar, preferably using Maven. But you don’t have to package Orekit in your custom .jar, that way your custom.jar will be relatively small.

Thank you!
So simply asking for a concrete example:

In the “propagation tutorial/Intermediate states”:
https://www.orekit.org/site-orekit-tutorials-11.0/tutorials/propagation.html

it is required to have a custom “TutorialStepHandler” by implementing the “OrekitFixedStepHandler”.
How would I do this in Matlab?
Is this the case where I need to do it in Java, compile it to a .jar and then use in Matlab.
Or is there a way to do the implementation directly in Matlab?

private static class TutorialStepHandler implements OrekitFixedStepHandler {

    public void init(final SpacecraftState s0, final AbsoluteDate t, final double step) {
        System.out.println("          date                a           e" +
                           "           i         \u03c9          \u03a9" +
                           "          \u03bd");
    }

    public void handleStep(SpacecraftState currentState, boolean isLast) {
        KeplerianOrbit o = (KeplerianOrbit) OrbitType.KEPLERIAN.convertType(currentState.getOrbit());
        System.out.format(Locale.US, "%s %12.3f %10.8f %10.6f %10.6f %10.6f %10.6f%n",
                          currentState.getDate(),
                          o.getA(), o.getE(),
                          FastMath.toDegrees(o.getI()),
                          FastMath.toDegrees(o.getPerigeeArgument()),
                          FastMath.toDegrees(o.getRightAscensionOfAscendingNode()),
                          FastMath.toDegrees(o.getTrueAnomaly()));
        if (isLast) {
            System.out.println("this was the last step ");
            System.out.println();
        }
    }

}

Cheers

Yes if you need to process the intermediate states you have to implement the OrekitStepHandler or OrekitFixedStepHandler interface, but it’s not mandatory.

Yes this is the case where you have to compile the Java code and pass the .jar to Matlab (but maybe it is possible to implement interfaces directly in Matlab? I haven’t used Matlab for a long time).

Btw you are using an older version of the tutorials for Orekit 11.0. If you are starting a new project I recommend using the latest version based on Orekit 12.2: Orekit Tutorials – Propagation