use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class FieldOfViewTest method testRollPitchYawHexagonalFootprint.
@Test
public void testRollPitchYawHexagonalFootprint() throws OrekitException {
Utils.setDataRoot("regular-data");
FieldOfView fov = new FieldOfView(Vector3D.PLUS_K, Vector3D.PLUS_I, FastMath.toRadians(3.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 LofOffset(orbit.getFrame(), LOFType.VVLH, RotationOrder.XYZ, FastMath.toRadians(10), FastMath.toRadians(20), FastMath.toRadians(5)));
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(0.1));
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(210, 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(), 1.0e-15);
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(48.0026, FastMath.toDegrees(minEl), 0.001);
Assert.assertEquals(60.1975, FastMath.toDegrees(maxEl), 0.001);
Assert.assertEquals(1221543.6, minDist, 1.0);
Assert.assertEquals(1804921.6, maxDist, 1.0);
}
use of org.orekit.frames.Transform 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.frames.Transform in project Orekit by CS-SI.
the class FieldOfViewTest method testFOVAwayFromEarth.
@Test
public void testFOVAwayFromEarth() throws OrekitException {
Utils.setDataRoot("regular-data");
FieldOfView fov = new FieldOfView(Vector3D.MINUS_K, Vector3D.PLUS_I, FastMath.toRadians(3.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));
Assert.assertEquals(0, footprint.size());
}
use of org.orekit.frames.Transform 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.frames.Transform in project Orekit by CS-SI.
the class SolarBodyTest method testFrameShift.
@Test
public void testFrameShift() throws OrekitException {
Utils.setDataRoot("regular-data");
final Frame moon = CelestialBodyFactory.getMoon().getBodyOrientedFrame();
final Frame earth = CelestialBodyFactory.getEarth().getBodyOrientedFrame();
final AbsoluteDate date0 = new AbsoluteDate(1969, 06, 25, TimeScalesFactory.getTDB());
for (double t = 0; t < Constants.JULIAN_DAY; t += 3600) {
final AbsoluteDate date = date0.shiftedBy(t);
final Transform transform = earth.getTransformTo(moon, date);
for (double dt = -10; dt < 10; dt += 0.125) {
final Transform shifted = transform.shiftedBy(dt);
final Transform computed = earth.getTransformTo(moon, transform.getDate().shiftedBy(dt));
final Transform error = new Transform(computed.getDate(), computed, shifted.getInverse());
Assert.assertEquals(0.0, error.getTranslation().getNorm(), 100.0);
Assert.assertEquals(0.0, error.getVelocity().getNorm(), 20.0);
Assert.assertEquals(0.0, error.getRotation().getAngle(), 4.0e-8);
Assert.assertEquals(0.0, error.getRotationRate().getNorm(), 8.0e-10);
}
}
}
Aggregations