List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Rotation revert
public Rotation revert()
From source file:org.orekit.attitudes.InertialAttitudeTest.java
@Test public void testSpin() throws OrekitException { AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789), TimeScalesFactory.getUTC()); AttitudeProvider law = new InertialProvider(new Rotation(new Vector3D(-0.64, 0.6, 0.48), 0.2)); 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, 3.986004415e14); Propagator propagator = new KeplerianPropagator(orbit, law); double h = 100.0; 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, 1.0e-6 * 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, 1.0e-6 * evolutionAnglePlus); // compute spin axis using finite differences Rotation rMinus = sMinus.getAttitude().getRotation(); Rotation rPlus = sPlus.getAttitude().getRotation(); Rotation dr = rPlus.applyTo(rMinus.revert()); Assert.assertEquals(0, dr.getAngle(), 1.0e-10); Vector3D spin0 = s0.getAttitude().getSpin(); Assert.assertEquals(0, spin0.getNorm(), 1.0e-10); }
From source file:org.orekit.attitudes.LofOffsetTest.java
/** Test if the lof offset is the one expected *//*from w ww.j a va 2 s . c o m*/ @Test public void testOffset() throws OrekitException, CardanEulerSingularityException { // Satellite position final CircularOrbit circ = new CircularOrbit(7178000.0, 0.5e-4, -0.5e-4, FastMath.toRadians(0.), FastMath.toRadians(270.), FastMath.toRadians(5.300), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu); // Create target pointing attitude provider // ************************************ // Elliptic earth shape final OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf); final GeodeticPoint geoTargetITRF2005 = new GeodeticPoint(FastMath.toRadians(43.36), FastMath.toRadians(1.26), 600.); // Attitude law definition from geodetic point target final TargetPointing targetLaw = new TargetPointing(circ.getFrame(), geoTargetITRF2005, earthShape); final Rotation targetRot = targetLaw.getAttitude(circ, date, circ.getFrame()).getRotation(); // Create lof aligned attitude provider // ******************************* final LofOffset lofAlignedLaw = new LofOffset(orbit.getFrame(), LOFType.VVLH); final Rotation lofAlignedRot = lofAlignedLaw.getAttitude(circ, date, circ.getFrame()).getRotation(); // Get rotation from LOF to target pointing attitude Rotation rollPitchYaw = targetRot.applyTo(lofAlignedRot.revert()).revert(); final double[] angles = rollPitchYaw.getAngles(RotationOrder.ZYX); final double yaw = angles[0]; final double pitch = angles[1]; final double roll = angles[2]; // Create lof offset attitude provider with computed roll, pitch, yaw // ************************************************************** final LofOffset lofOffsetLaw = new LofOffset(orbit.getFrame(), LOFType.VVLH, RotationOrder.ZYX, yaw, pitch, roll); final Rotation lofOffsetRot = lofOffsetLaw.getAttitude(circ, date, circ.getFrame()).getRotation(); // Compose rotations : target pointing attitudes final double angleCompo = targetRot.applyInverseTo(lofOffsetRot).getAngle(); Assert.assertEquals(0., angleCompo, Utils.epsilonAngle); }
From source file:org.orekit.attitudes.LofOffsetTest.java
/** Test is the target pointed is the one expected *///from w w w . ja v a 2 s .c o m @Test public void testTarget() throws OrekitException, CardanEulerSingularityException { // Create target point and target pointing law towards that point final GeodeticPoint targetDef = new GeodeticPoint(FastMath.toRadians(5.), FastMath.toRadians(-40.), 0.); final TargetPointing targetLaw = new TargetPointing(orbit.getFrame(), targetDef, earthSpheric); // Get roll, pitch, yaw angles corresponding to this pointing law final LofOffset lofAlignedLaw = new LofOffset(orbit.getFrame(), LOFType.VVLH); final Rotation lofAlignedRot = lofAlignedLaw.getAttitude(orbit, date, orbit.getFrame()).getRotation(); final Attitude targetAttitude = targetLaw.getAttitude(orbit, date, orbit.getFrame()); final Rotation rollPitchYaw = targetAttitude.getRotation().applyTo(lofAlignedRot.revert()).revert(); final double[] angles = rollPitchYaw.getAngles(RotationOrder.ZYX); final double yaw = angles[0]; final double pitch = angles[1]; final double roll = angles[2]; // Create a lof offset law from those values final LofOffset lofOffsetLaw = new LofOffset(orbit.getFrame(), LOFType.VVLH, RotationOrder.ZYX, yaw, pitch, roll); final LofOffsetPointing lofOffsetPtLaw = new LofOffsetPointing(orbit.getFrame(), earthSpheric, lofOffsetLaw, Vector3D.PLUS_K); // Check target pointed by this law : shall be the same as defined final Vector3D pTargetRes = lofOffsetPtLaw.getTargetPV(orbit, date, earthSpheric.getBodyFrame()) .getPosition(); final GeodeticPoint targetRes = earthSpheric.transform(pTargetRes, earthSpheric.getBodyFrame(), date); Assert.assertEquals(targetDef.getLongitude(), targetRes.getLongitude(), Utils.epsilonAngle); Assert.assertEquals(targetDef.getLongitude(), targetRes.getLongitude(), Utils.epsilonAngle); }
From source file:org.orekit.attitudes.LofOffsetTest.java
@Test public void testRetrieveAngles() throws OrekitException, CardanEulerSingularityException { AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789), TimeScalesFactory.getUTC()); 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, 3.986004415e14); RotationOrder order = RotationOrder.ZXY; double alpha1 = 0.123; double alpha2 = 0.456; double alpha3 = 0.789; LofOffset law = new LofOffset(orbit.getFrame(), LOFType.VVLH, order, alpha1, alpha2, alpha3); Rotation offsetAtt = law.getAttitude(orbit, date, orbit.getFrame()).getRotation(); Rotation alignedAtt = new LofOffset(orbit.getFrame(), LOFType.VVLH) .getAttitude(orbit, date, orbit.getFrame()).getRotation(); Rotation offsetProper = offsetAtt.applyTo(alignedAtt.revert()); double[] angles = offsetProper.revert().getAngles(order); Assert.assertEquals(alpha1, angles[0], 1.0e-11); Assert.assertEquals(alpha2, angles[1], 1.0e-11); Assert.assertEquals(alpha3, angles[2], 1.0e-11); }
From source file:org.orekit.attitudes.YawCompensation.java
/** Compute the yaw compensation angle at date. * @param pvProv provider for PV coordinates * @param date date at which compensation is requested * @param frame reference frame from which attitude is computed * @return yaw compensation angle for orbit. * @throws OrekitException if some specific error occurs *///from ww w. j a v a2 s . c o m public double getYawAngle(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException { final Rotation rBase = getBaseState(pvProv, date, frame).getRotation(); final Rotation rCompensated = getAttitude(pvProv, date, frame).getRotation(); final Rotation compensation = rCompensated.applyTo(rBase.revert()); return -compensation.applyTo(Vector3D.PLUS_I).getAlpha(); }
From source file:org.orekit.attitudes.YawCompensationTest.java
/** Test that compensation rotation axis is Zsat, yaw axis *//*from w w w .ja va 2 s. co m*/ @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(); // Compose rotations composition Rotation compoRot = rotYaw.applyTo(rotNoYaw.revert()); Vector3D yawAxis = compoRot.getAxis(); // Check axis Assert.assertEquals(0., yawAxis.subtract(Vector3D.PLUS_K).getNorm(), Utils.epsilonTest); }
From source file:org.orekit.attitudes.YawSteeringTest.java
@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);/* w ww . j a va 2 s . c o m*/ // 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(); // Compose rotations composition Rotation compoRot = rotYaw.applyTo(rotNoYaw.revert()); Vector3D yawAxis = compoRot.getAxis(); // Check axis Assert.assertEquals(0., yawAxis.getX(), Utils.epsilonTest); Assert.assertEquals(0., yawAxis.getY(), Utils.epsilonTest); Assert.assertEquals(1., yawAxis.getZ(), Utils.epsilonTest); }
From source file:org.orekit.frames.ITRFProvider.java
/** Get the transform from TIRF 2000 at specified date. * <p>The update considers the pole motion from IERS data.</p> * @param date new value of the date/* ww w . j av a 2 s . c o m*/ * @return transform at the specified date * @exception OrekitException if the nutation model data embedded in the * library cannot be read */ public Transform getTransform(final AbsoluteDate date) throws OrekitException { // offset from J2000 epoch in julian centuries final double tts = date.durationFrom(AbsoluteDate.J2000_EPOCH); final double ttc = tts / Constants.JULIAN_CENTURY; // pole correction parameters final PoleCorrection eop = eopHistory.getPoleCorrection(date); // elementary rotations due to pole motion in terrestrial frame final Rotation r1 = new Rotation(Vector3D.PLUS_I, -eop.getYp()); final Rotation r2 = new Rotation(Vector3D.PLUS_J, -eop.getXp()); final Rotation r3 = new Rotation(Vector3D.PLUS_K, S_PRIME_RATE * ttc); // complete pole motion in terrestrial frame final Rotation wRot = r3.applyTo(r2.applyTo(r1)); // combined effects final Rotation combined = wRot.revert(); // set up the transform from parent TIRF return new Transform(date, combined, Vector3D.ZERO); }
From source file:org.orekit.frames.ITRFProviderWithoutTidalEffectsTest.java
@Test public void testMSLIBTransformJ2000_TerRef() throws OrekitException { AbsoluteDate t0 = new AbsoluteDate(new DateComponents(2003, 10, 14), new TimeComponents(02, 00, 00), TimeScalesFactory.getUTC()); Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true); Transform trans = FramesFactory.getEME2000().getTransformTo(itrf, t0); // Coordinates in EME2000 PVCoordinates pvEME2000 = new PVCoordinates(new Vector3D(6500000.0, -1234567.0, 4000000.0), new Vector3D(3609.28229, 3322.88979, -7083.950661)); // Reference coordinates in ITRF PVCoordinates pvRef = new PVCoordinates( new Vector3D(3011113.971820046, -5889827.854375269, 4002158.938875904), new Vector3D(4410.393506651586, -1033.61784235127, -7082.633883124906)); // tests using direct transform checkPV(pvRef, trans.transformPVCoordinates(pvEME2000), 0.594, 1.79e-4); // compute local evolution using finite differences double h = 1.0; Rotation r0 = trans.getRotation(); AbsoluteDate date = t0.shiftedBy(-2 * h); Rotation evoM2h = FramesFactory.getEME2000().getTransformTo(itrf, date).getRotation().applyTo(r0.revert()); double alphaM2h = -evoM2h.getAngle(); Vector3D axisM2h = evoM2h.getAxis(); date = t0.shiftedBy(-h);//from w ww .ja v a2 s . c om Rotation evoM1h = FramesFactory.getEME2000().getTransformTo(itrf, date).getRotation().applyTo(r0.revert()); double alphaM1h = -evoM1h.getAngle(); Vector3D axisM1h = evoM1h.getAxis(); date = t0.shiftedBy(h); Rotation evoP1h = FramesFactory.getEME2000().getTransformTo(itrf, date).getRotation().applyTo(r0.revert()); double alphaP1h = evoP1h.getAngle(); Vector3D axisP1h = evoP1h.getAxis().negate(); date = t0.shiftedBy(2 * h); Rotation evoP2h = FramesFactory.getEME2000().getTransformTo(itrf, date).getRotation().applyTo(r0.revert()); double alphaP2h = evoP2h.getAngle(); Vector3D axisP2h = evoP2h.getAxis().negate(); double w = (8 * (alphaP1h - alphaM1h) - (alphaP2h - alphaM2h)) / (12 * h); Vector3D axis = axisM2h.add(axisM1h).add(axisP1h.add(axisP2h)).normalize(); Transform finiteDiffTransform = new Transform(t0, trans.getRotation(), new Vector3D(w, axis)); checkPV(pvRef, finiteDiffTransform.transformPVCoordinates(pvEME2000), 0.594, 1.78e-4); }
From source file:org.orekit.utils.AngularCoordinates.java
/** Estimate rotation rate between two orientations. * <p>Estimation is based on a simple fixed rate rotation * during the time interval between the two orientations.</p> * @param start start orientation// w w w .j a v a 2s. c om * @param end end orientation * @param dt time elapsed between the dates of the two orientations * @return rotation rate allowing to go from start to end orientations */ public static Vector3D estimateRate(final Rotation start, final Rotation end, final double dt) { final Rotation evolution = start.applyTo(end.revert()); return new Vector3D(evolution.getAngle() / dt, evolution.getAxis()); }