Search in sources :

Example 51 with Rotation

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

the class NadirPointingTest method testSphericEarth.

/**
 * Test in the case of a spheric earth : nadir pointing shall be
 * the same as earth center pointing
 */
@Test
public void testSphericEarth() throws OrekitException {
    // Spheric earth shape
    OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 0., itrf);
    // Create nadir pointing attitude provider
    NadirPointing nadirAttitudeLaw = new NadirPointing(FramesFactory.getEME2000(), earthShape);
    // Create earth center pointing attitude provider
    BodyCenterPointing earthCenterAttitudeLaw = new BodyCenterPointing(FramesFactory.getEME2000(), earthShape);
    // Create satellite position as circular parameters
    CircularOrbit circ = new CircularOrbit(7178000.0, 0.5e-4, -0.5e-4, FastMath.toRadians(50.), FastMath.toRadians(270.), FastMath.toRadians(5.300), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
    // Get nadir attitude
    Rotation rotNadir = nadirAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // Get earth center attitude
    Rotation rotCenter = earthCenterAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // For a spheric earth, earth center pointing attitude and nadir pointing attitude
    // shall be the same, i.e the composition of inverse earth pointing rotation
    // with nadir pointing rotation shall be identity.
    Rotation rotCompo = rotCenter.composeInverse(rotNadir, RotationConvention.VECTOR_OPERATOR);
    double angle = rotCompo.getAngle();
    Assert.assertEquals(angle, 0.0, Utils.epsilonAngle);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CircularOrbit(org.orekit.orbits.CircularOrbit) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 52 with Rotation

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

the class NadirPointingTest method testSpin.

@Test
public void testSpin() throws OrekitException {
    // Elliptic earth shape
    OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
    // Create earth center pointing attitude provider
    NadirPointing law = new NadirPointing(FramesFactory.getEME2000(), earthShape);
    // Satellite on any position
    KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
    Propagator propagator = new KeplerianPropagator(orbit, law, mu, 2500.0);
    double h = 0.1;
    SpacecraftState sMinus = propagator.propagate(date.shiftedBy(-h));
    SpacecraftState s0 = propagator.propagate(date);
    SpacecraftState sPlus = propagator.propagate(date.shiftedBy(h));
    // check spin is consistent with attitude evolution
    double errorAngleMinus = Rotation.distance(sMinus.shiftedBy(h).getAttitude().getRotation(), s0.getAttitude().getRotation());
    double evolutionAngleMinus = Rotation.distance(sMinus.getAttitude().getRotation(), s0.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAngleMinus, 5.3e-9 * evolutionAngleMinus);
    double errorAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.shiftedBy(-h).getAttitude().getRotation());
    double evolutionAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAnglePlus, 8.1e-9 * evolutionAnglePlus);
    Vector3D spin0 = s0.getAttitude().getSpin();
    Rotation rM = sMinus.getAttitude().getRotation();
    Rotation rP = sPlus.getAttitude().getRotation();
    Vector3D reference = AngularCoordinates.estimateRate(rM, rP, 2 * h);
    Assert.assertTrue(Rotation.distance(rM, rP) > 2.0e-4);
    Assert.assertEquals(0.0, spin0.subtract(reference).getNorm(), 2.0e-6);
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 53 with Rotation

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

the class NadirPointingTest method testNonSphericEarth.

/**
 * Test in the case of an elliptic earth : nadir pointing shall be :
 *   - the same as earth center pointing in case of equatorial or polar position
 *   - different from earth center pointing in any other case
 */
@Test
public void testNonSphericEarth() throws OrekitException {
    // Elliptic earth shape
    OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
    // Create nadir pointing attitude provider
    NadirPointing nadirAttitudeLaw = new NadirPointing(FramesFactory.getEME2000(), earthShape);
    // Create earth center pointing attitude provider
    BodyCenterPointing earthCenterAttitudeLaw = new BodyCenterPointing(FramesFactory.getEME2000(), earthShape);
    // Satellite on equatorial position
    // **********************************
    KeplerianOrbit kep = new KeplerianOrbit(7178000.0, 1.e-8, FastMath.toRadians(50.), 0., 0., 0., PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
    // Get nadir attitude
    Rotation rotNadir = nadirAttitudeLaw.getAttitude(kep, date, kep.getFrame()).getRotation();
    checkField(Decimal64Field.getInstance(), nadirAttitudeLaw, kep, kep.getDate(), kep.getFrame());
    // Get earth center attitude
    Rotation rotCenter = earthCenterAttitudeLaw.getAttitude(kep, date, kep.getFrame()).getRotation();
    // For a satellite at equatorial position, earth center pointing attitude and nadir pointing
    // attitude shall be the same, i.e the composition of inverse earth pointing rotation
    // with nadir pointing rotation shall be identity.
    Rotation rotCompo = rotCenter.composeInverse(rotNadir, RotationConvention.VECTOR_OPERATOR);
    double angle = rotCompo.getAngle();
    Assert.assertEquals(0.0, angle, 5.e-6);
    // Satellite on polar position
    // *****************************
    CircularOrbit circ = new CircularOrbit(7178000.0, 1.e-5, 0., FastMath.toRadians(90.), 0., FastMath.toRadians(90.), PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
    // Get nadir attitude
    rotNadir = nadirAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // Get earth center attitude
    rotCenter = earthCenterAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // For a satellite at polar position, earth center pointing attitude and nadir pointing
    // attitude shall be the same, i.e the composition of inverse earth pointing rotation
    // with nadir pointing rotation shall be identity.
    rotCompo = rotCenter.composeInverse(rotNadir, RotationConvention.VECTOR_OPERATOR);
    angle = rotCompo.getAngle();
    Assert.assertEquals(angle, 0.0, 5.e-6);
    // Satellite on any position
    // ***************************
    circ = new CircularOrbit(7178000.0, 1.e-5, 0., FastMath.toRadians(50.), 0., FastMath.toRadians(90.), PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
    // Get nadir attitude
    rotNadir = nadirAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // Get earth center attitude
    rotCenter = earthCenterAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // For a satellite at any position, earth center pointing attitude and nadir pointing
    // and nadir pointing attitude shall not be the same, i.e the composition of inverse earth
    // pointing rotation with nadir pointing rotation shall be different from identity.
    rotCompo = rotCenter.composeInverse(rotNadir, RotationConvention.VECTOR_OPERATOR);
    angle = rotCompo.getAngle();
    Assert.assertEquals(angle, FastMath.toRadians(0.16797386586252272), Utils.epsilonAngle);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CircularOrbit(org.orekit.orbits.CircularOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 54 with Rotation

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

the class NadirPointingTest method testVertical.

/**
 * Vertical test : check that Z satellite axis is collinear to local vertical axis,
 *        which direction is : (cos(lon)*cos(lat), sin(lon)*cos(lat), sin(lat)),
 *        where lon et lat stand for observed point coordinates
 *        (i.e satellite ones, since they are the same by construction,
 *        but that's what is to test.
 */
@Test
public void testVertical() throws OrekitException {
    // Elliptic earth shape
    OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
    // Create earth center pointing attitude provider
    NadirPointing nadirAttitudeLaw = new NadirPointing(FramesFactory.getEME2000(), earthShape);
    // Satellite on any position
    CircularOrbit circ = new CircularOrbit(7178000.0, 1.e-5, 0., FastMath.toRadians(50.), 0., FastMath.toRadians(90.), PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
    // Vertical test
    // ***************
    // Get observed ground point position/velocity
    TimeStampedPVCoordinates pvTargetItrf = nadirAttitudeLaw.getTargetPV(circ, date, itrf);
    // Convert to geodetic coordinates
    GeodeticPoint geoTarget = earthShape.transform(pvTargetItrf.getPosition(), itrf, date);
    // Compute local vertical axis
    double xVert = FastMath.cos(geoTarget.getLongitude()) * FastMath.cos(geoTarget.getLatitude());
    double yVert = FastMath.sin(geoTarget.getLongitude()) * FastMath.cos(geoTarget.getLatitude());
    double zVert = FastMath.sin(geoTarget.getLatitude());
    Vector3D targetVertical = new Vector3D(xVert, yVert, zVert);
    // Get attitude rotation state
    Rotation rotSatEME2000 = nadirAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // Get satellite Z axis in EME2000 frame
    Vector3D zSatEME2000 = rotSatEME2000.applyInverseTo(Vector3D.PLUS_K);
    Vector3D zSatItrf = FramesFactory.getEME2000().getTransformTo(itrf, date).transformVector(zSatEME2000);
    // Check that satellite Z axis is collinear to local vertical axis
    double angle = Vector3D.angle(zSatItrf, targetVertical);
    Assert.assertEquals(0.0, FastMath.sin(angle), Utils.epsilonTest);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 55 with Rotation

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

the class AttitudeTest method testZeroRate.

@Test
public void testZeroRate() throws OrekitException {
    Attitude attitude = new Attitude(AbsoluteDate.J2000_EPOCH, FramesFactory.getEME2000(), new Rotation(0.48, 0.64, 0.36, 0.48, false), Vector3D.ZERO, Vector3D.ZERO);
    Assert.assertEquals(Vector3D.ZERO, attitude.getSpin());
    double dt = 10.0;
    Attitude shifted = attitude.shiftedBy(dt);
    Assert.assertEquals(Vector3D.ZERO, shifted.getRotationAcceleration());
    Assert.assertEquals(Vector3D.ZERO, shifted.getSpin());
    Assert.assertEquals(0.0, Rotation.distance(attitude.getRotation(), shifted.getRotation()), 1.0e-15);
}
Also used : Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) 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