use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class BodyCenterPointingTest method doTestBodyCenterInPointingDirection.
private <T extends RealFieldElement<T>> void doTestBodyCenterInPointingDirection(final Field<T> field) throws OrekitException {
double mu = 3.9860047e14;
T zero = field.getZero();
// Satellite position as circular parameters
final T raan = zero.add(FastMath.toRadians(270.));
final T a = zero.add(7178000.0);
final T e = zero.add(7E-5);
final T i = zero.add(FastMath.toRadians(50.));
final T pa = zero.add(FastMath.toRadians(45.));
final T m = zero.add(FastMath.toRadians(5.300 - 270.));
// Computation date
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, new DateComponents(2008, 04, 07), TimeComponents.H00, TimeScalesFactory.getUTC());
// Orbit
FieldKeplerianOrbit<T> circ = new FieldKeplerianOrbit<>(a, e, i, pa, raan, m, PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
// WGS84 Earth model
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
// Transform from EME2000 to ITRF2008
Transform eme2000ToItrf = FramesFactory.getEME2000().getTransformTo(earth.getBodyFrame(), date.toAbsoluteDate());
// Earth center pointing attitude provider
BodyCenterPointing earthCenterAttitudeLaw = new BodyCenterPointing(circ.getFrame(), earth);
// Transform satellite position to position/velocity parameters in EME2000 frame
FieldPVCoordinates<T> pvSatEME2000 = circ.getPVCoordinates();
// Pointing direction
// ********************
// Get satellite attitude rotation, i.e rotation from EME2000 frame to satellite frame
FieldRotation<T> rotSatEME2000 = earthCenterAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
// checked this values with the bodycenterpointing test values
// Transform Z axis from satellite frame to EME2000
FieldVector3D<T> zSatEME2000 = rotSatEME2000.applyInverseTo(Vector3D.PLUS_K);
// Transform Z axis from EME2000 to ITRF2008
FieldVector3D<T> zSatITRF2008C = eme2000ToItrf.transformVector(zSatEME2000);
// Transform satellite position/velocity from EME2000 to ITRF2008
FieldPVCoordinates<T> pvSatITRF2008C = eme2000ToItrf.transformPVCoordinates(pvSatEME2000);
// Line containing satellite point and following pointing direction
Line pointingLine = new Line(pvSatITRF2008C.getPosition().toVector3D(), pvSatITRF2008C.getPosition().toVector3D().add(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, zSatITRF2008C.toVector3D()), 2.0e-8);
// Check that the line contains Earth center
Assert.assertTrue(pointingLine.contains(Vector3D.ZERO));
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class TimeStampedPVCoordinates method toTaylorProvider.
/**
* Create a local provider using simply Taylor expansion through {@link #shiftedBy(double)}.
* <p>
* The time evolution is based on a simple Taylor expansion. It is <em>not</em> intended as a
* replacement for proper orbit propagation (it is not even Keplerian!) but should be sufficient
* for either small time shifts or coarse accuracy.
* </p>
* @param instanceFrame frame in which the instance is defined
* @return provider based on Taylor expansion, for small time shifts around instance date
*/
public PVCoordinatesProvider toTaylorProvider(final Frame instanceFrame) {
return new PVCoordinatesProvider() {
/**
* {@inheritDoc}
*/
public TimeStampedPVCoordinates getPVCoordinates(final AbsoluteDate d, final Frame f) throws OrekitException {
final TimeStampedPVCoordinates shifted = shiftedBy(d.durationFrom(date));
final Transform transform = instanceFrame.getTransformTo(f, d);
return transform.transformPVCoordinates(shifted);
}
};
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class YawCompensationTest method toSpacecraft.
PVCoordinates toSpacecraft(PVCoordinates groundPoint, Orbit orbit, AttitudeProvider attitudeProvider) throws OrekitException {
SpacecraftState state = new SpacecraftState(orbit, attitudeProvider.getAttitude(orbit, orbit.getDate(), orbit.getFrame()));
Transform earthToSc = new Transform(orbit.getDate(), earthShape.getBodyFrame().getTransformTo(orbit.getFrame(), orbit.getDate()), state.toTransform());
return earthToSc.transformPVCoordinates(groundPoint);
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testNonSerializableStateProvider.
@Test
public void testNonSerializableStateProvider() throws OrekitException, IOException {
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
Frame eme2000 = FramesFactory.getEME2000();
Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, provider);
// this serialization should work
new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(propagator);
propagator.addAdditionalStateProvider(new AdditionalStateProvider() {
public String getName() {
return "not serializable";
}
public double[] getAdditionalState(SpacecraftState state) {
return new double[] { 0 };
}
});
try {
// this serialization should not work
new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(propagator);
Assert.fail("an exception should have been thrown");
} catch (NotSerializableException nse) {
// expected
}
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testIssue224Backward.
@Test
public void testIssue224Backward() throws OrekitException, IOException, ClassNotFoundException {
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
Frame eme2000 = FramesFactory.getEME2000();
Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, new LofOffset(poleAligned, LOFType.VVLH), 1000.0, provider);
propagator.addAdditionalStateProvider(new SevenProvider());
propagator.setEphemerisMode();
// Impulsive burns
final AbsoluteDate burn1Date = initial.getDate().shiftedBy(-200);
ImpulseManeuver<DateDetector> impulsiveBurn1 = new ImpulseManeuver<DateDetector>(new DateDetector(burn1Date), new Vector3D(0.0, 500.0, 0.0), 320);
propagator.addEventDetector(impulsiveBurn1);
final AbsoluteDate burn2Date = initial.getDate().shiftedBy(-300);
ImpulseManeuver<DateDetector> impulsiveBurn2 = new ImpulseManeuver<DateDetector>(new DateDetector(burn2Date), new Vector3D(0.0, 500.0, 0.0), 320);
propagator.addEventDetector(impulsiveBurn2);
propagator.propagate(initial.getDate().shiftedBy(-400));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(propagator.getGeneratedEphemeris());
Assert.assertTrue(bos.size() > 2950);
Assert.assertTrue(bos.size() < 3050);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
BoundedPropagator ephemeris = (BoundedPropagator) ois.readObject();
ephemeris.setMasterMode(10, new OrekitFixedStepHandler() {
public void handleStep(SpacecraftState currentState, boolean isLast) {
if (currentState.getDate().durationFrom(burn1Date) > 0.001) {
Assert.assertEquals(97.402, FastMath.toDegrees(currentState.getI()), 1.0e-3);
} else if (currentState.getDate().durationFrom(burn1Date) < -0.001 && currentState.getDate().durationFrom(burn2Date) > 0.001) {
Assert.assertEquals(98.164, FastMath.toDegrees(currentState.getI()), 1.0e-3);
} else if (currentState.getDate().durationFrom(burn2Date) < -0.001) {
Assert.assertEquals(99.273, FastMath.toDegrees(currentState.getI()), 1.0e-3);
}
}
});
ephemeris.propagate(ephemeris.getMinDate());
}
Aggregations