use of org.orekit.utils.TimeStampedPVCoordinates 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);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class NadirPointingTest method checkField.
private <T extends RealFieldElement<T>> void checkField(final Field<T> field, final GroundPointing provider, final Orbit orbit, final AbsoluteDate date, final Frame frame) throws OrekitException {
final Attitude attitudeD = provider.getAttitude(orbit, date, frame);
final FieldOrbit<T> orbitF = new FieldSpacecraftState<>(field, new SpacecraftState(orbit)).getOrbit();
final FieldAbsoluteDate<T> dateF = new FieldAbsoluteDate<>(field, date);
final FieldAttitude<T> attitudeF = provider.getAttitude(orbitF, dateF, frame);
Assert.assertEquals(0.0, Rotation.distance(attitudeD.getRotation(), attitudeF.getRotation().toRotation()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getSpin(), attitudeF.getSpin().toVector3D()), 2.0e-14);
Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getRotationAcceleration(), attitudeF.getRotationAcceleration().toVector3D()), 4.0e-12);
final TimeStampedPVCoordinates pvD = provider.getTargetPV(orbit, date, frame);
final TimeStampedFieldPVCoordinates<T> pvF = provider.getTargetPV(orbitF, dateF, frame);
Assert.assertEquals(0.0, Vector3D.distance(pvD.getPosition(), pvF.getPosition().toVector3D()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(pvD.getVelocity(), pvF.getVelocity().toVector3D()), 2.0e-8);
Assert.assertEquals(0.0, Vector3D.distance(pvD.getAcceleration(), pvF.getAcceleration().toVector3D()), 3.0e-5);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class NadirPointingTest method testSlidingDerivatives.
/**
* Test the derivatives of the sliding target
*/
@Test
public void testSlidingDerivatives() 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);
List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
for (double dt = -0.1; dt < 0.1; dt += 0.05) {
Orbit o = circ.shiftedBy(dt);
sample.add(nadirAttitudeLaw.getTargetPV(o, o.getDate(), o.getFrame()));
}
TimeStampedPVCoordinates reference = TimeStampedPVCoordinates.interpolate(circ.getDate(), CartesianDerivativesFilter.USE_P, sample);
TimeStampedPVCoordinates target = nadirAttitudeLaw.getTargetPV(circ, circ.getDate(), circ.getFrame());
Assert.assertEquals(0.0, Vector3D.distance(reference.getPosition(), target.getPosition()), 1.0e-15 * reference.getPosition().getNorm());
Assert.assertEquals(0.0, Vector3D.distance(reference.getVelocity(), target.getVelocity()), 3.0e-11 * reference.getVelocity().getNorm());
Assert.assertEquals(0.0, Vector3D.distance(reference.getAcceleration(), target.getAcceleration()), 1.3e-5 * reference.getAcceleration().getNorm());
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class BodyCenterPointingTest method testTarget.
/**
* Test if target is on Earth surface
*/
@Test
public void testTarget() throws OrekitException {
// Call get target method
TimeStampedPVCoordinates target = earthCenterAttitudeLaw.getTargetPV(circ, date, circ.getFrame());
// Check that target is on Earth surface
GeodeticPoint gp = earth.transform(target.getPosition(), circ.getFrame(), date);
Assert.assertEquals(0.0, gp.getAltitude(), 1.0e-10);
Assert.assertEquals(date, target.getDate());
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class YawSteeringTest method testTarget.
@Test
public void testTarget() throws OrekitException {
// Attitude laws
// **************
// Target pointing attitude provider 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);
// Check observed ground point
// *****************************
TimeStampedPVCoordinates noYawObserved = nadirLaw.getTargetPV(circOrbit, date, itrf);
// with yaw compensation
TimeStampedPVCoordinates yawObserved = yawCompensLaw.getTargetPV(circOrbit, date, itrf);
// Check difference
PVCoordinates observedDiff = new PVCoordinates(yawObserved, noYawObserved);
Assert.assertEquals(0.0, observedDiff.getPosition().getNorm(), Utils.epsilonTest);
Assert.assertEquals(0.0, observedDiff.getVelocity().getNorm(), Utils.epsilonTest);
Assert.assertEquals(0.0, observedDiff.getAcceleration().getNorm(), Utils.epsilonTest);
Assert.assertSame(nadirLaw, yawCompensLaw.getUnderlyingAttitudeProvider());
}
Aggregations