Search in sources :

Example 66 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.

the class TabulatedLofOffsetTest method testYawCompensation.

@Test
public void testYawCompensation() throws OrekitException {
    // create a sample from Yaw compensation law
    final LOFType type = LOFType.VNC;
    final List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>();
    final AttitudeProvider yawCompensLaw = new YawCompensation(orbit.getFrame(), new NadirPointing(orbit.getFrame(), earth));
    final Propagator originalPropagator = new KeplerianPropagator(orbit);
    originalPropagator.setAttitudeProvider(yawCompensLaw);
    originalPropagator.setMasterMode(1.0, new OrekitFixedStepHandler() {

        public void handleStep(final SpacecraftState currentState, final boolean isLast) throws OrekitException {
            Rotation offsetAtt = currentState.getAttitude().getRotation();
            LofOffset aligned = new LofOffset(currentState.getFrame(), type);
            Rotation alignedAtt = aligned.getAttitude(currentState.getOrbit(), currentState.getDate(), currentState.getFrame()).getRotation();
            Rotation offsetProper = offsetAtt.compose(alignedAtt.revert(), RotationConvention.VECTOR_OPERATOR);
            sample.add(new TimeStampedAngularCoordinates(currentState.getDate(), offsetProper, Vector3D.ZERO, Vector3D.ZERO));
        }
    });
    originalPropagator.propagate(orbit.getDate().shiftedBy(2000));
    originalPropagator.setSlaveMode();
    // use the sample and compare it to original
    final AttitudeProvider tabulated = new TabulatedLofOffset(orbit.getFrame(), type, sample, 6, AngularDerivativesFilter.USE_RR);
    final Propagator rebuildingPropagator = new KeplerianPropagator(orbit);
    rebuildingPropagator.setAttitudeProvider(tabulated);
    rebuildingPropagator.setMasterMode(0.3, new OrekitFixedStepHandler() {

        public void handleStep(final SpacecraftState currentState, final boolean isLast) throws OrekitException {
            final SpacecraftState rebuilt = originalPropagator.propagate(currentState.getDate());
            final Rotation r1 = currentState.getAttitude().getRotation();
            final Rotation r2 = rebuilt.getAttitude().getRotation();
            Assert.assertEquals(0.0, Rotation.distance(r1, r2), 7.0e-6);
            checkField(Decimal64Field.getInstance(), tabulated, currentState.getOrbit(), currentState.getDate(), currentState.getFrame());
        }
    });
    rebuildingPropagator.propagate(orbit.getDate().shiftedBy(50), orbit.getDate().shiftedBy(1950));
}
Also used : ArrayList(java.util.ArrayList) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) LOFType(org.orekit.frames.LOFType) Propagator(org.orekit.propagation.Propagator) BoundedPropagator(org.orekit.propagation.BoundedPropagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) OrekitException(org.orekit.errors.OrekitException) OrekitFixedStepHandler(org.orekit.propagation.sampling.OrekitFixedStepHandler) TimeStampedAngularCoordinates(org.orekit.utils.TimeStampedAngularCoordinates) Test(org.junit.Test)

Example 67 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.

the class TargetPointingTest method testSlewedTarget.

/**
 * Test the difference between pointing over two longitudes separated by 5°
 */
@Test
public void testSlewedTarget() throws OrekitException {
    // Spheric earth shape
    OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 0., itrf);
    // Satellite position
    // ********************
    // Create satellite position as circular parameters
    CircularOrbit circ = new CircularOrbit(42164000.0, 0.5e-8, -0.5e-8, 0., 0., FastMath.toRadians(5.300), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
    // Create nadir pointing attitude provider
    // **********************************
    NadirPointing nadirAttitudeLaw = new NadirPointing(circ.getFrame(), earthShape);
    // Get observed ground point from nadir pointing law
    Vector3D pNadirObservedEME2000 = nadirAttitudeLaw.getTargetPV(circ, date, FramesFactory.getEME2000()).getPosition();
    Vector3D pNadirObservedITRF = eme2000ToItrf.transformPosition(pNadirObservedEME2000);
    GeodeticPoint geoNadirObserved = earthShape.transform(pNadirObservedITRF, itrf, date);
    // Create target pointing attitude provider with target equal to nadir target
    // *********************************************************************
    TargetPointing targetLawRef = new TargetPointing(circ.getFrame(), itrf, pNadirObservedITRF);
    // Get attitude rotation in EME2000
    Rotation rotSatRefEME2000 = targetLawRef.getAttitude(circ, date, circ.getFrame()).getRotation();
    // Create target pointing attitude provider with target 5° from nadir target
    // ********************************************************************
    GeodeticPoint geoTarget = new GeodeticPoint(geoNadirObserved.getLatitude(), geoNadirObserved.getLongitude() - FastMath.toRadians(5), geoNadirObserved.getAltitude());
    Vector3D pTargetITRF = earthShape.transform(geoTarget);
    TargetPointing targetLaw = new TargetPointing(circ.getFrame(), itrf, pTargetITRF);
    // Get attitude rotation
    Rotation rotSatEME2000 = targetLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    checkField(Decimal64Field.getInstance(), targetLaw, circ, circ.getDate(), circ.getFrame());
    // Compute difference between both attitude providers
    // *********************************************
    // Difference between attitudes
    // expected
    double tanDeltaExpected = (6378136.460 / (42164000.0 - 6378136.460)) * FastMath.tan(FastMath.toRadians(5));
    double deltaExpected = FastMath.atan(tanDeltaExpected);
    // real
    double deltaReal = Rotation.distance(rotSatEME2000, rotSatRefEME2000);
    Assert.assertEquals(deltaReal, deltaExpected, 1.e-4);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 68 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.

the class YawSteeringTest method testCompensAxis.

@Test
public void testCompensAxis() throws OrekitException {
    // Attitude laws
    // **************
    // Target pointing attitude provider over satellite nadir at date, without yaw compensation
    NadirPointing nadirLaw = new NadirPointing(circOrbit.getFrame(), earthShape);
    // Target pointing attitude provider with yaw compensation
    YawSteering yawCompensLaw = new YawSteering(circOrbit.getFrame(), nadirLaw, CelestialBodyFactory.getSun(), Vector3D.MINUS_I);
    // Get attitude rotations from non yaw compensated / yaw compensated laws
    Rotation rotNoYaw = nadirLaw.getAttitude(circOrbit, date, circOrbit.getFrame()).getRotation();
    Rotation rotYaw = yawCompensLaw.getAttitude(circOrbit, date, circOrbit.getFrame()).getRotation();
    checkField(Decimal64Field.getInstance(), yawCompensLaw, circOrbit, circOrbit.getDate(), circOrbit.getFrame());
    // Compose rotations composition
    Rotation compoRot = rotYaw.compose(rotNoYaw.revert(), RotationConvention.VECTOR_OPERATOR);
    Vector3D yawAxis = compoRot.getAxis(RotationConvention.VECTOR_OPERATOR);
    // Check axis
    Assert.assertEquals(0., yawAxis.getX(), Utils.epsilonTest);
    Assert.assertEquals(0., yawAxis.getY(), Utils.epsilonTest);
    Assert.assertEquals(1., yawAxis.getZ(), Utils.epsilonTest);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 69 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.

the class YawCompensationTest method testCompensAxis.

/**
 * Test that compensation rotation axis is Zsat, yaw axis
 */
@Test
public void testCompensAxis() throws OrekitException {
    // Attitude laws
    // **************
    // Target pointing attitude provider over satellite nadir at date, without yaw compensation
    NadirPointing nadirLaw = new NadirPointing(circOrbit.getFrame(), earthShape);
    // Target pointing attitude provider with yaw compensation
    YawCompensation yawCompensLaw = new YawCompensation(circOrbit.getFrame(), nadirLaw);
    // Get attitude rotations from non yaw compensated / yaw compensated laws
    Rotation rotNoYaw = nadirLaw.getAttitude(circOrbit, date, circOrbit.getFrame()).getRotation();
    Rotation rotYaw = yawCompensLaw.getAttitude(circOrbit, date, circOrbit.getFrame()).getRotation();
    checkField(Decimal64Field.getInstance(), yawCompensLaw, circOrbit, circOrbit.getDate(), circOrbit.getFrame());
    // Compose rotations composition
    Rotation compoRot = rotYaw.compose(rotNoYaw.revert(), RotationConvention.VECTOR_OPERATOR);
    Vector3D yawAxis = compoRot.getAxis(RotationConvention.VECTOR_OPERATOR);
    // Check axis
    Assert.assertEquals(0., yawAxis.subtract(Vector3D.PLUS_K).getNorm(), Utils.epsilonTest);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 70 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.

the class CelestialBodyFactoryTest method testEarthBodyOrientedFrameAroundJ2000.

@Test
public void testEarthBodyOrientedFrameAroundJ2000() throws OrekitException {
    Utils.setDataRoot("regular-data");
    final Frame earthFrame = CelestialBodyFactory.getEarth().getBodyOrientedFrame();
    final Frame base = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    for (double dt = -60; dt <= 60; dt += 1.0) {
        final AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(dt);
        Rotation rotation = base.getTransformTo(earthFrame, date).getRotation();
        Assert.assertEquals(7.9426e-4, Rotation.distance(Rotation.IDENTITY, rotation), 1.0e-8);
    }
}
Also used : Frame(org.orekit.frames.Frame) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)145 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)116 Test (org.junit.Test)100 AbsoluteDate (org.orekit.time.AbsoluteDate)55 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)53 FieldRotation (org.hipparchus.geometry.euclidean.threed.FieldRotation)43 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)38 PVCoordinates (org.orekit.utils.PVCoordinates)30 SpacecraftState (org.orekit.propagation.SpacecraftState)26 DateComponents (org.orekit.time.DateComponents)22 Frame (org.orekit.frames.Frame)21 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)21 RandomGenerator (org.hipparchus.random.RandomGenerator)19 Transform (org.orekit.frames.Transform)19 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)19 CircularOrbit (org.orekit.orbits.CircularOrbit)18 TimeComponents (org.orekit.time.TimeComponents)17 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)16 GeodeticPoint (org.orekit.bodies.GeodeticPoint)15 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)14