List of usage examples for org.apache.commons.math3.geometry.euclidean.threed RotationOrder XYX
RotationOrder XYX
To view the source code for org.apache.commons.math3.geometry.euclidean.threed RotationOrder XYX.
Click Source Link
From source file:org.orekit.attitudes.LofOffsetPointingTest.java
@Test public void testMiss() throws OrekitException { 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);/* w ww. j a v a 2 s .c om*/ final LofOffset upsideDown = new LofOffset(circ.getFrame(), LOFType.VVLH, RotationOrder.XYX, FastMath.PI, 0, 0); final LofOffsetPointing pointing = new LofOffsetPointing(circ.getFrame(), earthSpheric, upsideDown, Vector3D.PLUS_K); try { pointing.getTargetPV(circ, date, circ.getFrame()); Assert.fail("an exception should have been thrown"); } catch (OrekitException oe) { Assert.assertEquals(OrekitMessages.ATTITUDE_POINTING_LAW_DOES_NOT_POINT_TO_GROUND, oe.getSpecifier()); } }
From source file:org.orekit.attitudes.LofOffsetPointingTest.java
@Test public void testSpin() throws OrekitException { 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); final AttitudeProvider law = new LofOffsetPointing(orbit.getFrame(), earthSpheric, new LofOffset(orbit.getFrame(), LOFType.VVLH, RotationOrder.XYX, 0.1, 0.2, 0.3), Vector3D.PLUS_K); Propagator propagator = new KeplerianPropagator(orbit, law); double h = 0.01; 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); Vector3D spin0 = s0.getAttitude().getSpin(); Vector3D reference = AngularCoordinates.estimateRate(sMinus.getAttitude().getRotation(), sPlus.getAttitude().getRotation(), 2 * h); Assert.assertTrue(spin0.getNorm() > 1.0e-3); Assert.assertEquals(0.0, spin0.subtract(reference).getNorm(), 1.0e-10); }
From source file:org.orekit.attitudes.LofOffsetTest.java
@Test public void testSpin() throws OrekitException { final AttitudeProvider law = new LofOffset(orbit.getFrame(), LOFType.VVLH, RotationOrder.XYX, 0.1, 0.2, 0.3);//from w w w . j av a2 s . c o m 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); Propagator propagator = new KeplerianPropagator(orbit, law); double h = 0.01; 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); Vector3D spin0 = s0.getAttitude().getSpin(); Vector3D reference = AngularCoordinates.estimateRate(sMinus.getAttitude().getRotation(), sPlus.getAttitude().getRotation(), 2 * h); Assert.assertEquals(0.0, spin0.subtract(reference).getNorm(), 1.0e-10); }
From source file:org.orekit.forces.maneuvers.ImpulseManeuverTest.java
@Test public void testInertialManeuver() throws OrekitException { final double mu = CelestialBodyFactory.getEarth().getGM(); final double initialX = 7100e3; final double initialY = 0.0; final double initialZ = 1300e3; final double initialVx = 0; final double initialVy = 8000; final double initialVz = 1000; final Vector3D position = new Vector3D(initialX, initialY, initialZ); final Vector3D velocity = new Vector3D(initialVx, initialVy, initialVz); final AbsoluteDate epoch = new AbsoluteDate(2010, 1, 1, 0, 0, 0, TimeScalesFactory.getUTC()); final TimeStampedPVCoordinates state = new TimeStampedPVCoordinates(epoch, position, velocity, Vector3D.ZERO);/*w w w . j av a 2 s . c o m*/ final Orbit initialOrbit = new CartesianOrbit(state, FramesFactory.getEME2000(), mu); final double totalPropagationTime = 0.00001; final double driftTimeInSec = totalPropagationTime / 2.0; final double deltaX = 0.01; final double deltaY = 0.02; final double deltaZ = 0.03; final double isp = 300; final Vector3D deltaV = new Vector3D(deltaX, deltaY, deltaZ); KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, new LofOffset(initialOrbit.getFrame(), LOFType.VNC)); DateDetector dateDetector = new DateDetector(epoch.shiftedBy(driftTimeInSec)); InertialProvider attitudeOverride = new InertialProvider(new Rotation(RotationOrder.XYX, 0, 0, 0)); ImpulseManeuver<DateDetector> burnAtEpoch = new ImpulseManeuver<DateDetector>(dateDetector, attitudeOverride, deltaV, isp).withThreshold(driftTimeInSec / 4); propagator.addEventDetector(burnAtEpoch); SpacecraftState finalState = propagator.propagate(epoch.shiftedBy(totalPropagationTime)); final double finalVxExpected = initialVx + deltaX; final double finalVyExpected = initialVy + deltaY; final double finalVzExpected = initialVz + deltaZ; final double maneuverTolerance = 1e-4; final Vector3D finalVelocity = finalState.getPVCoordinates().getVelocity(); Assert.assertEquals(finalVxExpected, finalVelocity.getX(), maneuverTolerance); Assert.assertEquals(finalVyExpected, finalVelocity.getY(), maneuverTolerance); Assert.assertEquals(finalVzExpected, finalVelocity.getZ(), maneuverTolerance); }