use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class FieldOfViewTest method testFOVPartiallyTruncatedAtLimb.
@Test
public void testFOVPartiallyTruncatedAtLimb() throws OrekitException {
Utils.setDataRoot("regular-data");
FieldOfView fov = new FieldOfView(Vector3D.PLUS_K, Vector3D.PLUS_I, FastMath.toRadians(40.0), 6, 0.0);
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
KeplerianOrbit orbit = new KeplerianOrbit(new PVCoordinates(new Vector3D(7.0e6, 1.0e6, 4.0e6), new Vector3D(-500.0, 8000.0, 1000.0)), FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new KeplerianPropagator(orbit);
propagator.setAttitudeProvider(new NadirPointing(orbit.getFrame(), earth));
SpacecraftState state = propagator.propagate(orbit.getDate().shiftedBy(1000.0));
Transform inertToBody = state.getFrame().getTransformTo(earth.getBodyFrame(), state.getDate());
Transform fovToBody = new Transform(state.getDate(), state.toTransform().getInverse(), inertToBody);
List<List<GeodeticPoint>> footprint = fov.getFootprint(fovToBody, earth, FastMath.toRadians(1.0));
Vector3D subSat = earth.projectToGround(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), state.getDate(), earth.getBodyFrame());
Assert.assertEquals(1, footprint.size());
List<GeodeticPoint> loop = footprint.get(0);
Assert.assertEquals(246, loop.size());
double minEl = Double.POSITIVE_INFINITY;
double maxEl = 0;
double minDist = Double.POSITIVE_INFINITY;
double maxDist = 0;
for (int i = 0; i < loop.size(); ++i) {
Assert.assertEquals(0.0, loop.get(i).getAltitude(), 3.0e-7);
TopocentricFrame topo = new TopocentricFrame(earth, loop.get(i), "atLimb");
final double elevation = topo.getElevation(state.getPVCoordinates().getPosition(), state.getFrame(), state.getDate());
minEl = FastMath.min(minEl, elevation);
maxEl = FastMath.max(maxEl, elevation);
final double dist = Vector3D.distance(subSat, earth.transform(loop.get(i)));
minDist = FastMath.min(minDist, dist);
maxDist = FastMath.max(maxDist, dist);
}
Assert.assertEquals(0.0, FastMath.toDegrees(minEl), 2.0e-12);
Assert.assertEquals(7.8897, FastMath.toDegrees(maxEl), 0.001);
Assert.assertEquals(4584829.6, minDist, 1.0);
Assert.assertEquals(5347029.8, maxDist, 1.0);
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class FootprintOverlapDetectorTest method checkEventPair.
private void checkEventPair(final LoggedEvent start, final LoggedEvent end, final double expectedStart, final double expectedDuration, final double spacecraftLatitude, final double spacecraftLongitude, final double fovCenterLatitude, final double fovCenterLongitude) throws OrekitException {
Assert.assertFalse(start.isIncreasing());
Assert.assertTrue(end.isIncreasing());
Assert.assertEquals(expectedStart, start.getState().getDate().durationFrom(initialOrbit.getDate()), 0.001);
Assert.assertEquals(expectedDuration, end.getState().getDate().durationFrom(start.getState().getDate()), 0.001);
SpacecraftState middle = start.getState().shiftedBy(0.5 * expectedDuration);
// sub-satellite point
Vector3D p = middle.getPVCoordinates().getPosition();
GeodeticPoint gpSat = earth.transform(p, middle.getFrame(), middle.getDate());
Assert.assertEquals(spacecraftLatitude, FastMath.toDegrees(gpSat.getLatitude()), 0.001);
Assert.assertEquals(spacecraftLongitude, FastMath.toDegrees(gpSat.getLongitude()), 0.001);
// point at center of Field Of View
final Transform scToInert = middle.toTransform().getInverse();
GeodeticPoint gpFOV = earth.getIntersectionPoint(new Line(p, scToInert.transformPosition(Vector3D.PLUS_K), 1.0e-6), middle.getPVCoordinates().getPosition(), middle.getFrame(), middle.getDate());
Assert.assertEquals(fovCenterLatitude, FastMath.toDegrees(gpFOV.getLatitude()), 0.001);
Assert.assertEquals(fovCenterLongitude, FastMath.toDegrees(gpFOV.getLongitude()), 0.001);
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class BackAndForthDetectorTest method testBackAndForth.
@Test
public void testBackAndForth() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final AbsoluteDate date0 = new AbsoluteDate(2006, 12, 27, 12, 0, 0.0, utc);
final AbsoluteDate date1 = new AbsoluteDate(2006, 12, 27, 22, 50, 0.0, utc);
final AbsoluteDate date2 = new AbsoluteDate(2006, 12, 27, 22, 58, 0.0, utc);
// Orbit
final double a = 7274000.;
final double e = 0.00127;
final double i = FastMath.toRadians(90.);
final double w = FastMath.toRadians(0.);
final double raan = FastMath.toRadians(12.5);
final double lM = FastMath.toRadians(60.);
Orbit iniOrb = new KeplerianOrbit(a, e, i, w, raan, lM, PositionAngle.MEAN, FramesFactory.getEME2000(), date0, Constants.WGS84_EARTH_MU);
// Propagator
KeplerianPropagator propagator = new KeplerianPropagator(iniOrb);
// Station
final GeodeticPoint stationPosition = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(100.), 110.);
final BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
final TopocentricFrame stationFrame = new TopocentricFrame(earth, stationPosition, "");
// Detector
final Visibility visi = new Visibility();
propagator.addEventDetector(new ElevationDetector(stationFrame).withConstantElevation(FastMath.toRadians(10.)).withHandler(visi));
// Forward propagation (AOS + LOS)
propagator.propagate(date1);
propagator.propagate(date2);
// Backward propagation (AOS + LOS)
propagator.propagate(date1);
propagator.propagate(date0);
Assert.assertEquals(4, visi.getVisiNb());
}
use of org.orekit.bodies.GeodeticPoint 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.bodies.GeodeticPoint 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());
}
Aggregations