use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class YawSteeringTest method setUp.
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data");
// Computation date
date = new AbsoluteDate(new DateComponents(1970, 04, 07), TimeComponents.H00, TimeScalesFactory.getUTC());
// Body mu
final double mu = 3.9860047e14;
// Reference frame = ITRF
itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
// Satellite position
circOrbit = 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);
// Elliptic earth shape
earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
} catch (OrekitException oe) {
Assert.fail(oe.getMessage());
}
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class LofOffsetPointingTest method testMiss.
@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);
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());
}
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class AttitudeTest method testInterpolation.
@Test
public void testInterpolation() throws OrekitException {
Utils.setDataRoot("regular-data");
final double ehMu = 3.9860047e14;
final double ae = 6.378137e6;
final double c20 = -1.08263e-3;
final double c30 = 2.54e-6;
final double c40 = 1.62e-6;
final double c50 = 2.3e-7;
final double c60 = -5.5e-7;
final AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(584.);
final Vector3D position = new Vector3D(3220103., 69623., 6449822.);
final Vector3D velocity = new Vector3D(6414.7, -2006., -3180.);
final CircularOrbit initialOrbit = new CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, ehMu);
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initialOrbit, ae, ehMu, c20, c30, c40, c50, c60);
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
propagator.setAttitudeProvider(new BodyCenterPointing(initialOrbit.getFrame(), earth));
final Attitude initialAttitude = propagator.propagate(initialOrbit.getDate()).getAttitude();
// set up a 5 points sample
List<Attitude> sample = new ArrayList<Attitude>();
for (double dt = 0; dt < 251.0; dt += 60.0) {
sample.add(propagator.propagate(date.shiftedBy(dt)).getAttitude());
}
// well inside the sample, interpolation should be better than quadratic shift
double maxShiftAngleError = 0;
double maxInterpolationAngleError = 0;
double maxShiftRateError = 0;
double maxInterpolationRateError = 0;
for (double dt = 0; dt < 240.0; dt += 1.0) {
AbsoluteDate t = initialOrbit.getDate().shiftedBy(dt);
Attitude propagated = propagator.propagate(t).getAttitude();
double shiftAngleError = Rotation.distance(propagated.getRotation(), initialAttitude.shiftedBy(dt).getRotation());
double interpolationAngleError = Rotation.distance(propagated.getRotation(), initialAttitude.interpolate(t, sample).getRotation());
double shiftRateError = Vector3D.distance(propagated.getSpin(), initialAttitude.shiftedBy(dt).getSpin());
double interpolationRateError = Vector3D.distance(propagated.getSpin(), initialAttitude.interpolate(t, sample).getSpin());
maxShiftAngleError = FastMath.max(maxShiftAngleError, shiftAngleError);
maxInterpolationAngleError = FastMath.max(maxInterpolationAngleError, interpolationAngleError);
maxShiftRateError = FastMath.max(maxShiftRateError, shiftRateError);
maxInterpolationRateError = FastMath.max(maxInterpolationRateError, interpolationRateError);
}
Assert.assertTrue(maxShiftAngleError > 4.0e-6);
Assert.assertTrue(maxInterpolationAngleError < 1.5e-13);
Assert.assertTrue(maxShiftRateError > 6.0e-8);
Assert.assertTrue(maxInterpolationRateError < 2.5e-14);
// past sample end, interpolation error should increase, but still be far better than quadratic shift
maxShiftAngleError = 0;
maxInterpolationAngleError = 0;
maxShiftRateError = 0;
maxInterpolationRateError = 0;
for (double dt = 250.0; dt < 300.0; dt += 1.0) {
AbsoluteDate t = initialOrbit.getDate().shiftedBy(dt);
Attitude propagated = propagator.propagate(t).getAttitude();
double shiftAngleError = Rotation.distance(propagated.getRotation(), initialAttitude.shiftedBy(dt).getRotation());
double interpolationAngleError = Rotation.distance(propagated.getRotation(), initialAttitude.interpolate(t, sample).getRotation());
double shiftRateError = Vector3D.distance(propagated.getSpin(), initialAttitude.shiftedBy(dt).getSpin());
double interpolationRateError = Vector3D.distance(propagated.getSpin(), initialAttitude.interpolate(t, sample).getSpin());
maxShiftAngleError = FastMath.max(maxShiftAngleError, shiftAngleError);
maxInterpolationAngleError = FastMath.max(maxInterpolationAngleError, interpolationAngleError);
maxShiftRateError = FastMath.max(maxShiftRateError, shiftRateError);
maxInterpolationRateError = FastMath.max(maxInterpolationRateError, interpolationRateError);
}
Assert.assertTrue(maxShiftAngleError > 9.0e-6);
Assert.assertTrue(maxInterpolationAngleError < 6.0e-11);
Assert.assertTrue(maxShiftRateError > 9.0e-8);
Assert.assertTrue(maxInterpolationRateError < 4.0e-12);
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class BodyCenterPointingTest method testQDot.
@Test
public void testQDot() throws OrekitException {
Utils.setDataRoot("regular-data");
final double ehMu = 3.9860047e14;
final double ae = 6.378137e6;
final double c20 = -1.08263e-3;
final double c30 = 2.54e-6;
final double c40 = 1.62e-6;
final double c50 = 2.3e-7;
final double c60 = -5.5e-7;
final AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(584.);
final Vector3D position = new Vector3D(3220103., 69623., 6449822.);
final Vector3D velocity = new Vector3D(6414.7, -2006., -3180.);
final CircularOrbit initialOrbit = new CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, ehMu);
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initialOrbit, ae, ehMu, c20, c30, c40, c50, c60);
propagator.setAttitudeProvider(earthCenterAttitudeLaw);
List<WeightedObservedPoint> w0 = new ArrayList<WeightedObservedPoint>();
List<WeightedObservedPoint> w1 = new ArrayList<WeightedObservedPoint>();
List<WeightedObservedPoint> w2 = new ArrayList<WeightedObservedPoint>();
List<WeightedObservedPoint> w3 = new ArrayList<WeightedObservedPoint>();
for (double dt = -1; dt < 1; dt += 0.01) {
Rotation rP = propagator.propagate(date.shiftedBy(dt)).getAttitude().getRotation();
w0.add(new WeightedObservedPoint(1, dt, rP.getQ0()));
w1.add(new WeightedObservedPoint(1, dt, rP.getQ1()));
w2.add(new WeightedObservedPoint(1, dt, rP.getQ2()));
w3.add(new WeightedObservedPoint(1, dt, rP.getQ3()));
}
double q0DotRef = PolynomialCurveFitter.create(2).fit(w0)[1];
double q1DotRef = PolynomialCurveFitter.create(2).fit(w1)[1];
double q2DotRef = PolynomialCurveFitter.create(2).fit(w2)[1];
double q3DotRef = PolynomialCurveFitter.create(2).fit(w3)[1];
Attitude a0 = propagator.propagate(date).getAttitude();
double q0 = a0.getRotation().getQ0();
double q1 = a0.getRotation().getQ1();
double q2 = a0.getRotation().getQ2();
double q3 = a0.getRotation().getQ3();
double oX = a0.getSpin().getX();
double oY = a0.getSpin().getY();
double oZ = a0.getSpin().getZ();
// first time-derivatives of the quaternion
double q0Dot = 0.5 * MathArrays.linearCombination(-q1, oX, -q2, oY, -q3, oZ);
double q1Dot = 0.5 * MathArrays.linearCombination(q0, oX, -q3, oY, q2, oZ);
double q2Dot = 0.5 * MathArrays.linearCombination(q3, oX, q0, oY, -q1, oZ);
double q3Dot = 0.5 * MathArrays.linearCombination(-q2, oX, q1, oY, q0, oZ);
Assert.assertEquals(q0DotRef, q0Dot, 5.0e-9);
Assert.assertEquals(q1DotRef, q1Dot, 5.0e-9);
Assert.assertEquals(q2DotRef, q2Dot, 5.0e-9);
Assert.assertEquals(q3DotRef, q3Dot, 5.0e-9);
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class BodyCenterPointingTest method testSpin.
@Test
public void testSpin() throws OrekitException {
Utils.setDataRoot("regular-data");
final double ehMu = 3.9860047e14;
final double ae = 6.378137e6;
final double c20 = -1.08263e-3;
final double c30 = 2.54e-6;
final double c40 = 1.62e-6;
final double c50 = 2.3e-7;
final double c60 = -5.5e-7;
final AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(584.);
final Vector3D position = new Vector3D(3220103., 69623., 6449822.);
final Vector3D velocity = new Vector3D(6414.7, -2006., -3180.);
final CircularOrbit initialOrbit = new CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, ehMu);
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initialOrbit, ae, ehMu, c20, c30, c40, c50, c60);
propagator.setAttitudeProvider(earthCenterAttitudeLaw);
double h = 0.01;
SpacecraftState s0 = propagator.propagate(date);
SpacecraftState sMinus = propagator.propagate(date.shiftedBy(-h));
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-13);
}
Aggregations