Observations from satellite

Ok, I just assumed that when you set AttitudeProvider to propagator then it changes the Frame of the propagator. Finally I used the code from Frames tutorial to calculate Sun position in spacecraft frame and used it to create a detector that checks if Sun is behind spacecraft. For anyone interested this is the code for g function of this detector:

public double g(SpacecraftState s) {
        AbsoluteDate date = s.getDate();
        PVCoordinates sCoords = s.getPVCoordinates();
        Transform transform = LOFType.TNW.transformFromInertial(date, sCoords);
        Vector3D sunInert = sun.getPVCoordinates(date, EME).getPosition();
        Vector3D sunPos = transform.transformPosition(sunInert);
        if (sunPos.getX() > 0) {
            return -1;
        }
        else {
            return 1;
        }
    }
1 Like