use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class TargetPointingTest method testConstructors.
/**
* Test if both constructors are equivalent
*/
@Test
public void testConstructors() throws OrekitException {
// Satellite position
// ********************
CircularOrbit circ = 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);
// Attitude laws
// ***************
// Elliptic earth shape
OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
// Target definition as a geodetic point AND as a position/velocity vector
GeodeticPoint geoTargetITRF = new GeodeticPoint(FastMath.toRadians(43.36), FastMath.toRadians(1.26), 600.);
Vector3D pTargetITRF = earthShape.transform(geoTargetITRF);
// Attitude law definition from geodetic point target
TargetPointing geoTargetAttitudeLaw = new TargetPointing(circ.getFrame(), geoTargetITRF, earthShape);
// Attitude law definition from position/velocity target
TargetPointing pvTargetAttitudeLaw = new TargetPointing(circ.getFrame(), itrf, pTargetITRF);
// Check that both attitude are the same
// Get satellite rotation for target pointing law
Rotation rotPv = pvTargetAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
// Get satellite rotation for nadir pointing law
Rotation rotGeo = geoTargetAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
// Rotations composition
Rotation rotCompo = rotGeo.composeInverse(rotPv, RotationConvention.VECTOR_OPERATOR);
double angle = rotCompo.getAngle();
Assert.assertEquals(angle, 0.0, Utils.epsilonAngle);
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class TargetPointingTest method testTargetInPointingDirection.
/**
* Test if defined target belongs to the direction pointed by the satellite
*/
@Test
public void testTargetInPointingDirection() throws OrekitException {
// Create computation date
AbsoluteDate date = new AbsoluteDate(new DateComponents(2008, 04, 07), TimeComponents.H00, TimeScalesFactory.getUTC());
// Reference frame = ITRF
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.);
TargetPointing targetAttitudeLaw = new TargetPointing(FramesFactory.getEME2000(), geoTarget, earthShape);
// Satellite position
// ********************
// Create satellite position as circular parameters
CircularOrbit circ = 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);
// Transform satellite position to position/velocity parameters in EME2000 frame
PVCoordinates pvSatEME2000 = circ.getPVCoordinates();
// Pointing direction
// ********************
// Get satellite attitude rotation, i.e rotation from EME2000 frame to satellite frame
Rotation rotSatEME2000 = targetAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
// Transform Z axis from satellite frame to EME2000
Vector3D zSatEME2000 = rotSatEME2000.applyInverseTo(Vector3D.PLUS_K);
// Line containing satellite point and following pointing direction
Vector3D p = eme2000ToItrf.transformPosition(pvSatEME2000.getPosition());
Line pointingLine = new Line(p, p.add(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, eme2000ToItrf.transformVector(zSatEME2000)), 1.0e-10);
// Check that the line contains earth center
double distance = pointingLine.distance(earthShape.transform(geoTarget));
Assert.assertEquals(0, distance, 1.e-7);
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class TargetPointingTest method testGeodeticConstructor.
/**
* Test if geodetic constructor works
*/
@Test
public void testGeodeticConstructor() throws OrekitException {
// Satellite position
// ********************
CircularOrbit circ = 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);
// Attitude law
// **************
// Elliptic earth shape
OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
// Target definition as a geodetic point
GeodeticPoint geoTargetITRF = new GeodeticPoint(FastMath.toRadians(43.36), FastMath.toRadians(1.26), 600.);
// Attitude law definition
TargetPointing geoTargetAttitudeLaw = new TargetPointing(circ.getFrame(), geoTargetITRF, earthShape);
// Check that observed ground point is the same as defined target
Vector3D pObservedEME2000 = geoTargetAttitudeLaw.getTargetPV(circ, date, FramesFactory.getEME2000()).getPosition();
GeodeticPoint geoObserved = earthShape.transform(pObservedEME2000, FramesFactory.getEME2000(), date);
Assert.assertEquals(geoObserved.getLongitude(), geoTargetITRF.getLongitude(), Utils.epsilonAngle);
Assert.assertEquals(geoObserved.getLatitude(), geoTargetITRF.getLatitude(), Utils.epsilonAngle);
Assert.assertEquals(geoObserved.getAltitude(), geoTargetITRF.getAltitude(), 1.1e-8);
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class TargetPointingTest method testNadirTarget.
/**
* Test with nadir target : Check that when the target is the same as nadir target at date,
* satellite attitude is the same as nadir attitude at the same date, but different at a different date.
*/
@Test
public void testNadirTarget() throws OrekitException {
// Elliptic earth shape
OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
// Satellite on any position
CircularOrbit circOrbit = new CircularOrbit(7178000.0, 1.e-5, 0., FastMath.toRadians(50.), 0., FastMath.toRadians(90.), PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
// Target attitude provider with target under satellite nadir
// *******************************************************
// Definition of nadir target
// Create nadir pointing attitude provider
NadirPointing nadirAttitudeLaw = new NadirPointing(circOrbit.getFrame(), earthShape);
// Check nadir target
Vector3D pNadirTarget = nadirAttitudeLaw.getTargetPV(circOrbit, date, itrf).getPosition();
GeodeticPoint geoNadirTarget = earthShape.transform(pNadirTarget, itrf, date);
// Create target attitude provider
TargetPointing targetAttitudeLaw = new TargetPointing(circOrbit.getFrame(), geoNadirTarget, earthShape);
// 1/ Test that attitudes are the same at date
// *********************************************
// i.e the composition of inverse earth pointing rotation
// with nadir pointing rotation shall be identity.
// Get satellite rotation from target pointing law at date
Rotation rotTarget = targetAttitudeLaw.getAttitude(circOrbit, date, circOrbit.getFrame()).getRotation();
// Get satellite rotation from nadir pointing law at date
Rotation rotNadir = nadirAttitudeLaw.getAttitude(circOrbit, date, circOrbit.getFrame()).getRotation();
// Compose attitude rotations
Rotation rotCompo = rotTarget.composeInverse(rotNadir, RotationConvention.VECTOR_OPERATOR);
double angle = rotCompo.getAngle();
Assert.assertEquals(angle, 0.0, Utils.epsilonAngle);
// 2/ Test that attitudes are different at a different date
// **********************************************************
// Extrapolation one minute later
KeplerianPropagator extrapolator = new KeplerianPropagator(circOrbit);
// extrapolation duration in seconds
double delta_t = 60.0;
AbsoluteDate extrapDate = date.shiftedBy(delta_t);
Orbit extrapOrbit = extrapolator.propagate(extrapDate).getOrbit();
// Get satellite rotation from target pointing law at date + 1min
Rotation extrapRotTarget = targetAttitudeLaw.getAttitude(extrapOrbit, extrapDate, extrapOrbit.getFrame()).getRotation();
// Get satellite rotation from nadir pointing law at date
Rotation extrapRotNadir = nadirAttitudeLaw.getAttitude(extrapOrbit, extrapDate, extrapOrbit.getFrame()).getRotation();
// Compose attitude rotations
Rotation extrapRotCompo = extrapRotTarget.composeInverse(extrapRotNadir, RotationConvention.VECTOR_OPERATOR);
double extrapAngle = extrapRotCompo.getAngle();
Assert.assertEquals(extrapAngle, FastMath.toRadians(24.684793905118823), Utils.epsilonAngle);
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class TargetPointingTest method testIssue115.
@Test
public void testIssue115() throws OrekitException {
// Satellite position
// ********************
CircularOrbit circ = 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);
// Attitude law
// **************
// Elliptic earth shape
OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
// Target definition as a geodetic point
GeodeticPoint geoTargetITRF = new GeodeticPoint(FastMath.toRadians(43.36), FastMath.toRadians(1.26), 600.);
// Attitude law definition
TargetPointing geoTargetAttitudeLaw = new TargetPointing(circ.getFrame(), geoTargetITRF, earthShape);
// Check that observed ground point is the same as defined target
Frame cirf = FramesFactory.getCIRF(IERSConventions.IERS_2010, true);
Attitude att1 = geoTargetAttitudeLaw.getAttitude(circ, date, cirf);
Attitude att2 = geoTargetAttitudeLaw.getAttitude(circ, date, itrf);
Attitude att3 = att2.withReferenceFrame(cirf);
Assert.assertEquals(0.0, Rotation.distance(att3.getRotation(), att1.getRotation()), 1.0e-15);
}
Aggregations