Running oreczml tutorials

Hey. I was trying to run one of the oreczml-tutorial files. I managed to build and run oreczml-core and I also managed to successfully hook up the tutorials to the compiled oreczml-core.jar library, because the code runs until the very end where it’s writing out the .czml file, but at that point I have an issue where the oreczml-core package can’t find the satellite.png image file that it uses to generate the images.

Exception in thread "main" java.lang.RuntimeException: java.nio.file.NoSuchFileException: /home/baubin/Projects/Code/01-Orekit/oreczml/oreczml-tutorials/file:/home/baubin/.m2/repository/org/orekit/czml/1.0/czml-1.0.jar!/satellite.png
        at org.orekit.czml.object.primary.Satellite.writeCzmlBlock(Satellite.java:294)
        at org.orekit.czml.file.CzmlFile.write(CzmlFile.java:173)
        at org.orekit.czml.file.CzmlFile.write(CzmlFile.java:131)
        at org.orekit.czml.fieldofviewtuto.YawCompensationExample.main(YawCompensationExample.java:258)
Caused by: java.nio.file.NoSuchFileException: /home/baubin/Projects/Code/01-Orekit/oreczml/oreczml-tutorials/file:/home/baubin/.m2/repository/org/orekit/czml/1.0/czml-1.0.jar!/satellite.png

Also, here is the pom.xml file with my modifications to include the cesiumlangaugewriter and czml (oreczml-core) libraries

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.orekit</groupId>
        <artifactId>oreczml-parent</artifactId>
        <version>1.0</version>
    </parent>

    <artifactId>oreczml-tutorials</artifactId>
    <packaging>jar</packaging>

    <name>oreczml-tutorials</name>
    <url>https://gitlab.orekit.org/Zudo/oreczml</url>
    <description>OreCzml core module</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <oreczml.hipparchus.version>3.1</oreczml.hipparchus.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.orekit</groupId>
            <artifactId>orekit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.orekit</groupId>
            <artifactId>czml</artifactId>
            <version>${project.parent.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
	    <groupId>com.agi</groupId>
	    <artifactId>czml-writer</artifactId>
	    <version>3.0.0</version>
	</dependency>
        <dependency>
            <groupId>org.hipparchus</groupId>
            <artifactId>hipparchus-geometry</artifactId>
            <version>${oreczml.hipparchus.version}</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>

</project>

Thanks in advance for your help.

Hello @baubin,

This is indeed an issue in the code. You can use any picture you want as a workaround but the tutorial shall indeed work as is. I’m opening an issue on the gitlab.

I have also noticed this problem in the pom and it has been fixed on the develop branch.

UPDATE: Issue opened here YawCompensationExample needs a Satellite.png to work (#59) · Issues · Orekit / OreCZML · GitLab

Cheers,
Vincent

1 Like

@Vincent Thanks for the update. Handling coding environments isn’t my best skill so I tend to assume that if something new that I set up fails to run, it’s because I messed it up somehow.

Yup the library is still very new so there is room for improvements and issues are to be expected.

To anyone reading this and using OreCZML : Feel free to ask questions on the forum and to raise issues so that we can fix them !

Cheers,
Vincent

1 Like

Hello @baubin , I will be working on this library this week end, trying to fix the issue, I let you know in the few days if the issue is fixed or not.

1 Like

The problem is now fixed in the develop branch, you can update your project from this branch.

2 Likes

Hi @baubin

I have the same issue but I am not sure how you solved this issue? Did you pull the new code from the develop branch or did you use a workaround?

Kind regards,

Benoist

@benoist

So the reason I couldn’t initially solve the issue on my own was because if you look at the place the code was looking for the satellite.png file:

java.nio.file.NoSuchFileException: /home/baubin/Projects/Code/01-Orekit/oreczml/oreczml-tutorials/file:/home/baubin/.m2/repository/org/orekit/czml/1.0/czml-1.0.jar!/satellite.png

You’ll see there’s no way a place like this could have existed on my machine. However, since that time @Zudo has fixed the code so it should be looking for the image file in a place that either does exist already on your computer, or a location you can create. Just pull the develop branch, find/make that location on your computer and place the satellite.png file there, and you should be good to go.

1 Like

Hi,
I think I’m stuck with a similar issue when searching for ISSModel.glb or satellite.png, I get the issues below.

Would you have an idea on how to solve this? It does not seem related to the existence of the path (and I checked in the .jar that the objects existed) but more to the class loadResources (for the ISS model) and Spacecraft (for the satellite.png).

Thank you very much for your help!

Benoist

Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:\C:\Users\BenoistLOSCUL\.m2\repository\org\orekit\OreCzml-tutorials\1.1-SNAPSHOT\oreczml-tutorials-1.1-SNAPSHOT.jar!\Default3DModels\ISSModel.glb
        at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:204)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:175)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
        at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:231)
        at java.base/java.io.File.toPath(File.java:2413)
        at org.orekit.czml.TutorialUtils.loadResources(TutorialUtils.java:136)
Exception in thread "main" java.lang.ExceptionInInitializerError
        at com.visualizer.App.main(App.java:150)
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:\C:\Users\BenoistLOSCUL\.m2\repository\org\orekit\oreczml-core\1.1-SNAPSHOT\oreczml-core-1.1-SNAPSHOT.jar!\satellite.png

Hello @benoist , can you please tell me which version of OreCzml you are using, and which tutorial is failing to load the resources ?

Hi @Zudo,

I just pulled the develop branch (this morning).

I didn’t try to use a complete tutorial but I used SSOAttitudeExample to code, see below:

final EphemerisGenerator generator = propagator.getEphemerisGenerator();
propagator.propagate(initialDate.shiftedBy(simDuration));
BoundedPropagator ephemeris = generator.getGeneratedEphemeris();

// Creation of the satellite
final String IssModel = TutorialUtils.loadResources("Default3DModels/ISSModel.glb");

// Creation of the satellite
final Spacecraft satellite =
    Spacecraft.builder(ephemeris, header)
        .withModelPath(IssModel).withColor(Color.RED)
        .withOnlyOnePeriod().withDisplayAttitude().withReferenceSystem()
        .build();

final AttitudePointing pointing =
    AttitudePointing
        .builder(satellite, TutorialUtils.getEarth(), Vector3D.MINUS_K,
                    header)
        .withColor(Color.ORANGE).displayPointingPath()
        .displayPeriodPointingPath().build();


// Creation of the field of observation of the satellite, it describes the area the satellite see
final Transform initialInertToBody = initialState.getFrame()
                                                    .getTransformTo(TutorialUtils.getEarth()
                                                                                .getBodyFrame(),
                                                            initialState.getDate());
final Transform initialFovBody = new Transform(initialState.getDate(), initialState.toTransform()
                                                                                    .getInverse(),
        initialInertToBody);
final FieldOfView fov = new DoubleDihedraFieldOfView(Vector3D.MINUS_K, Vector3D.PLUS_I, FastMath.toRadians(20),
        Vector3D.PLUS_J, FastMath.toRadians(20), 2);
final FieldOfObservation fieldOfObservation = FieldOfObservation.builder(satellite, fov, initialFovBody, header).build();

// Creation of the file
    final CzmlFile file =
        CzmlFile.builder().withHeader(header).withSpacecraft(satellite)
            .withAttitudePointing(pointing)
            .withFieldOfObservation(fieldOfObservation).build();

// Writing in the file
file.write(output);