use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class LofOffsetTest method testTarget.
/**
* Test is the target pointed is the one expected
*/
@Test
public void testTarget() throws OrekitException {
// 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().compose(lofAlignedRot.revert(), RotationConvention.VECTOR_OPERATOR).revert();
final double[] angles = rollPitchYaw.getAngles(RotationOrder.ZYX, RotationConvention.VECTOR_OPERATOR);
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);
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class LofOffsetTest method testOffset.
/**
* Test if the lof offset is the one expected
*/
@Test
public void testOffset() throws OrekitException {
// 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 geoTargetITRF = 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(), geoTargetITRF, 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.compose(lofAlignedRot.revert(), RotationConvention.VECTOR_OPERATOR).revert();
final double[] angles = rollPitchYaw.getAngles(RotationOrder.ZYX, RotationConvention.VECTOR_OPERATOR);
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.composeInverse(lofOffsetRot, RotationConvention.VECTOR_OPERATOR).getAngle();
Assert.assertEquals(0., angleCompo, Utils.epsilonAngle);
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class TargetPointingTest method testSlewedTarget.
/**
* Test the difference between pointing over two longitudes separated by 5°
*/
@Test
public void testSlewedTarget() throws OrekitException {
// Spheric earth shape
OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 0., itrf);
// Satellite position
// ********************
// Create satellite position as circular parameters
CircularOrbit circ = new CircularOrbit(42164000.0, 0.5e-8, -0.5e-8, 0., 0., FastMath.toRadians(5.300), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
// Create nadir pointing attitude provider
// **********************************
NadirPointing nadirAttitudeLaw = new NadirPointing(circ.getFrame(), earthShape);
// Get observed ground point from nadir pointing law
Vector3D pNadirObservedEME2000 = nadirAttitudeLaw.getTargetPV(circ, date, FramesFactory.getEME2000()).getPosition();
Vector3D pNadirObservedITRF = eme2000ToItrf.transformPosition(pNadirObservedEME2000);
GeodeticPoint geoNadirObserved = earthShape.transform(pNadirObservedITRF, itrf, date);
// Create target pointing attitude provider with target equal to nadir target
// *********************************************************************
TargetPointing targetLawRef = new TargetPointing(circ.getFrame(), itrf, pNadirObservedITRF);
// Get attitude rotation in EME2000
Rotation rotSatRefEME2000 = targetLawRef.getAttitude(circ, date, circ.getFrame()).getRotation();
// Create target pointing attitude provider with target 5° from nadir target
// ********************************************************************
GeodeticPoint geoTarget = new GeodeticPoint(geoNadirObserved.getLatitude(), geoNadirObserved.getLongitude() - FastMath.toRadians(5), geoNadirObserved.getAltitude());
Vector3D pTargetITRF = earthShape.transform(geoTarget);
TargetPointing targetLaw = new TargetPointing(circ.getFrame(), itrf, pTargetITRF);
// Get attitude rotation
Rotation rotSatEME2000 = targetLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
checkField(Decimal64Field.getInstance(), targetLaw, circ, circ.getDate(), circ.getFrame());
// Compute difference between both attitude providers
// *********************************************
// Difference between attitudes
// expected
double tanDeltaExpected = (6378136.460 / (42164000.0 - 6378136.460)) * FastMath.tan(FastMath.toRadians(5));
double deltaExpected = FastMath.atan(tanDeltaExpected);
// real
double deltaReal = Rotation.distance(rotSatEME2000, rotSatRefEME2000);
Assert.assertEquals(deltaReal, deltaExpected, 1.e-4);
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class TargetPointingTest method testSpin.
@Test
public void testSpin() throws OrekitException {
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
// Elliptic earth shape
OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
// Create target pointing attitude provider
GeodeticPoint geoTarget = new GeodeticPoint(FastMath.toRadians(43.36), FastMath.toRadians(1.26), 600.);
AttitudeProvider law = new TargetPointing(FramesFactory.getEME2000(), geoTarget, earthShape);
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-5 * 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-5 * 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.1e-10);
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class YawCompensationTest method testAlignment.
/**
* Test that pointed target motion is along -X sat axis
*/
@Test
public void testAlignment() throws OrekitException {
GroundPointing notCompensated = new NadirPointing(circOrbit.getFrame(), earthShape);
YawCompensation compensated = new YawCompensation(circOrbit.getFrame(), notCompensated);
Attitude att0 = compensated.getAttitude(circOrbit, circOrbit.getDate(), circOrbit.getFrame());
// ground point in satellite Z direction
Vector3D satInert = circOrbit.getPVCoordinates().getPosition();
Vector3D zInert = att0.getRotation().applyInverseTo(Vector3D.PLUS_K);
GeodeticPoint gp = earthShape.getIntersectionPoint(new Line(satInert, satInert.add(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, zInert), 1.0e-10), satInert, circOrbit.getFrame(), circOrbit.getDate());
PVCoordinates pEarth = new PVCoordinates(earthShape.transform(gp), Vector3D.ZERO, Vector3D.ZERO);
double minYWithoutCompensation = Double.POSITIVE_INFINITY;
double maxYWithoutCompensation = Double.NEGATIVE_INFINITY;
double minYDotWithoutCompensation = Double.POSITIVE_INFINITY;
double maxYDotWithoutCompensation = Double.NEGATIVE_INFINITY;
double minYWithCompensation = Double.POSITIVE_INFINITY;
double maxYWithCompensation = Double.NEGATIVE_INFINITY;
double minYDotWithCompensation = Double.POSITIVE_INFINITY;
double maxYDotWithCompensation = Double.NEGATIVE_INFINITY;
for (double dt = -0.2; dt < 0.2; dt += 0.002) {
PVCoordinates withoutCompensation = toSpacecraft(pEarth, circOrbit.shiftedBy(dt), notCompensated);
if (FastMath.abs(withoutCompensation.getPosition().getX()) <= 1000.0) {
minYWithoutCompensation = FastMath.min(minYWithoutCompensation, withoutCompensation.getPosition().getY());
maxYWithoutCompensation = FastMath.max(maxYWithoutCompensation, withoutCompensation.getPosition().getY());
minYDotWithoutCompensation = FastMath.min(minYDotWithoutCompensation, withoutCompensation.getVelocity().getY());
maxYDotWithoutCompensation = FastMath.max(maxYDotWithoutCompensation, withoutCompensation.getVelocity().getY());
}
PVCoordinates withCompensation = toSpacecraft(pEarth, circOrbit.shiftedBy(dt), compensated);
if (FastMath.abs(withCompensation.getPosition().getX()) <= 1000.0) {
minYWithCompensation = FastMath.min(minYWithCompensation, withCompensation.getPosition().getY());
maxYWithCompensation = FastMath.max(maxYWithCompensation, withCompensation.getPosition().getY());
minYDotWithCompensation = FastMath.min(minYDotWithCompensation, withCompensation.getVelocity().getY());
maxYDotWithCompensation = FastMath.max(maxYDotWithCompensation, withCompensation.getVelocity().getY());
}
}
// when the ground point is close to cross the push-broom line (i.e. when Δx decreases from +1000m to -1000m)
// it will drift along the Y axis if we don't apply compensation
// but will remain nearly at Δy=0 if we do apply compensation
// in fact, as the yaw compensation mode removes the linear drift,
// what remains is a parabola Δy = a uΔx²
Assert.assertEquals(-55.7056, minYWithoutCompensation, 0.0001);
Assert.assertEquals(+55.7056, maxYWithoutCompensation, 0.0001);
Assert.assertEquals(352.5667, minYDotWithoutCompensation, 0.0001);
Assert.assertEquals(352.5677, maxYDotWithoutCompensation, 0.0001);
Assert.assertEquals(0.0000, minYWithCompensation, 0.0001);
Assert.assertEquals(0.0008, maxYWithCompensation, 0.0001);
Assert.assertEquals(-0.0101, minYDotWithCompensation, 0.0001);
Assert.assertEquals(0.0102, maxYDotWithCompensation, 0.0001);
}
Aggregations