diff --git a/src/main/java/org/orekit/rugged/api/Rugged.java b/src/main/java/org/orekit/rugged/api/Rugged.java index d00b6d23b9d0904ebff4864ecb2cdd3656b1ed91..62c04bd87ea66e1838961560c67b4937a2138975 100644 --- a/src/main/java/org/orekit/rugged/api/Rugged.java +++ b/src/main/java/org/orekit/rugged/api/Rugged.java @@ -19,7 +19,11 @@ package org.orekit.rugged.api; import java.io.File; import java.util.List; +import org.apache.commons.math3.geometry.euclidean.threed.Rotation; +import org.apache.commons.math3.util.Pair; import org.orekit.bodies.GeodeticPoint; +import org.orekit.time.AbsoluteDate; +import org.orekit.utils.PVCoordinates; /** Main interface to Rugged library. * @author Luc Maisonobe @@ -124,11 +128,11 @@ public interface Rugged { * @param aInterpolationOrder order to use for attitude interpolation * @exception RuggedException if data needed for some frame cannot be loaded */ - void setGeneralContext(File orekitDataDir, String referenceDate, + void setGeneralContext(AbsoluteDate referenceDate, Algorithm algorithmID, Ellipsoid ellipsoidID, InertialFrame inertialFrameID, BodyRotatingFrame bodyRotatingFrameID, - List<SatellitePV> positionsVelocities, int pvInterpolationOrder, - List<SatelliteQ> quaternions, int aInterpolationOrder) + List<Pair<AbsoluteDate, PVCoordinates>> positionsVelocities, int pvInterpolationOrder, + List<Pair<AbsoluteDate, Rotation>> quaternions, int aInterpolationOrder) throws RuggedException; /** Set up the tiles management. diff --git a/src/main/java/org/orekit/rugged/api/SatellitePV.java b/src/main/java/org/orekit/rugged/api/SatellitePV.java deleted file mode 100644 index 5469a6bbb9cbdf9185f39c7fec92882bce946cf5..0000000000000000000000000000000000000000 --- a/src/main/java/org/orekit/rugged/api/SatellitePV.java +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright 2013-2014 CS Systèmes d'Information - * Licensed to CS Systèmes d'Information (CS) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * CS licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.orekit.rugged.api; - -import java.io.Serializable; - -/** Container for satellite position and velocity. - * <p> - * Instances of this class are guaranteed to be immutable. - * </p> - * @author Luc Maisonobe - */ -public class SatellitePV implements Serializable { - - /** Serializable UID. */ - private static final long serialVersionUID = 20140309L; - - /** Date offset from reference (s). */ - private final double date; - - /** Position along x axis(m). */ - private final double px; - - /** Position along y axis(m). */ - private final double py; - - /** Position along z axis(m). */ - private final double pz; - - /** Velocity along x axis (m/s). */ - private final double vx; - - /** Velocity along y axis (m/s). */ - private final double vy; - - /** Velocity along z axis (m/s). */ - private final double vz; - - /** - * Build a new instance. - * - * @param date date offset from reference (s) - * @param px position along x axis (m) - * @param py position along y axis (m) - * @param pz position along z axis (m) - * @param vx velocity along x axis (m/s) - * @param vy velocity along y axis (m/s) - * @param vz velocity along z axis (m/s) - */ - public SatellitePV(final double date, - final double px, final double py, final double pz, - final double vx, final double vy, final double vz) { - this.date = date; - this.px = px; - this.py = py; - this.pz = pz; - this.vx = vx; - this.vy = vy; - this.vz = vz; - } - - /** Get the date offset from reference. - * @return date offset from reference - */ - public double getDate() { - return date; - } - - /** Get the position along x axis. - * @return position along x axis - */ - public double getPx() { - return px; - } - - /** Get the position along y axis. - * @return position along y axis - */ - public double getPy() { - return py; - } - - /** Get the position along z axis. - * @return position along z axis - */ - public double getPz() { - return pz; - } - - /** Get the velocity along x axis. - * @return velocity along x axis - */ - public double getVx() { - return vx; - } - - /** Get the velocity along y axis. - * @return velocity along y axis - */ - public double getVy() { - return vy; - } - - /** Get the velocity along z axis. - * @return velocity along z axis - */ - public double getVz() { - return vz; - } - -} diff --git a/src/main/java/org/orekit/rugged/api/SatelliteQ.java b/src/main/java/org/orekit/rugged/api/SatelliteQ.java deleted file mode 100644 index 9eb40246f665749ae976e5b330c80f8b91a8bba6..0000000000000000000000000000000000000000 --- a/src/main/java/org/orekit/rugged/api/SatelliteQ.java +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 2013-2014 CS Systèmes d'Information - * Licensed to CS Systèmes d'Information (CS) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * CS licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.orekit.rugged.api; - -import java.io.Serializable; - -/** Container for satellite quaternion. - * <p> - * Instances of this class are guaranteed to be immutable. - * </p> - * @author Luc Maisonobe - */ -public class SatelliteQ implements Serializable { - - /** Serializable UID. */ - private static final long serialVersionUID = 20140309L; - - /** Date offset from reference (s). */ - private final double date; - - /** Scalar component. */ - private final double q0; - - /** First vectorial component. */ - private final double q1; - - /** Second vectorial component. */ - private final double q2; - - /** Third vectorial component. */ - private final double q3; - - /** - * Build a new instance. - * - * @param date date offset from reference (s) - * @param q0 scalar component - * @param q1 first vectorial component - * @param q2 second vectorial component - * @param q3 third vectorial component - */ - public SatelliteQ(final double date, - final double q0, final double q1, final double q2, final double q3) { - this.date = date; - this.q0 = q0; - this.q1 = q1; - this.q2 = q2; - this.q3 = q3; - } - - /** Get the date offset from reference. - * @return date offset from reference - */ - public double getDate() { - return date; - } - - /** Get the scalar component. - * @return scalar component - */ - public double getQ0() { - return q0; - } - - /** Get the first vectorial component. - * @return first vectorial component - */ - public double getQ1() { - return q1; - } - - /** Get the second vectorial component. - * @return second vectorial component - */ - public double getQ2() { - return q2; - } - - /** Get the third vectorial component. - * @return third vectorial component - */ - public double getQ3() { - return q3; - } - -} diff --git a/src/main/java/org/orekit/rugged/core/RuggedImpl.java b/src/main/java/org/orekit/rugged/core/RuggedImpl.java index c9bc91dd5f1e5c5f4ec752998c8b73d452063c04..02596c5bc130d7256e4f761acdb129bd355f41e7 100644 --- a/src/main/java/org/orekit/rugged/core/RuggedImpl.java +++ b/src/main/java/org/orekit/rugged/core/RuggedImpl.java @@ -16,7 +16,6 @@ */ package org.orekit.rugged.core; -import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -24,12 +23,11 @@ import java.util.Map; import org.apache.commons.math3.geometry.euclidean.threed.Rotation; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; +import org.apache.commons.math3.util.Pair; import org.orekit.attitudes.Attitude; import org.orekit.attitudes.AttitudeProvider; import org.orekit.attitudes.TabulatedProvider; import org.orekit.bodies.GeodeticPoint; -import org.orekit.data.DataProvidersManager; -import org.orekit.data.DirectoryCrawler; import org.orekit.errors.OrekitException; import org.orekit.frames.Frame; import org.orekit.frames.FramesFactory; @@ -42,15 +40,11 @@ import org.orekit.rugged.api.PixelLOS; import org.orekit.rugged.api.Rugged; import org.orekit.rugged.api.RuggedException; import org.orekit.rugged.api.RuggedMessages; -import org.orekit.rugged.api.SatellitePV; -import org.orekit.rugged.api.SatelliteQ; import org.orekit.rugged.api.SensorPixel; import org.orekit.rugged.api.TileUpdater; import org.orekit.rugged.core.duvenhage.DuvenhageAlgorithm; import org.orekit.rugged.core.raster.IntersectionAlgorithm; import org.orekit.time.AbsoluteDate; -import org.orekit.time.TimeScale; -import org.orekit.time.TimeScalesFactory; import org.orekit.utils.Constants; import org.orekit.utils.IERSConventions; import org.orekit.utils.ImmutableTimeStampedCache; @@ -62,9 +56,6 @@ import org.orekit.utils.PVCoordinatesProvider; */ public class RuggedImpl implements Rugged { - /** UTC time scale. */ - private TimeScale utc; - /** Reference date. */ private AbsoluteDate referenceDate; @@ -91,18 +82,17 @@ public class RuggedImpl implements Rugged { /** {@inheritDoc} */ @Override - public void setGeneralContext(final File orekitDataDir, final String newReferenceDate, + public void setGeneralContext(final AbsoluteDate newReferenceDate, final Algorithm algorithmID, final Ellipsoid ellipsoidID, final InertialFrame inertialFrameID, final BodyRotatingFrame bodyRotatingFrameID, - final List<SatellitePV> positionsVelocities, final int pvInterpolationOrder, - final List<SatelliteQ> quaternions, final int aInterpolationOrder) + final List<Pair<AbsoluteDate, PVCoordinates>> positionsVelocities, final int pvInterpolationOrder, + final List<Pair<AbsoluteDate, Rotation>> quaternions, final int aInterpolationOrder) throws RuggedException { try { // time reference - utc = selectTimeScale(orekitDataDir); - this.referenceDate = new AbsoluteDate(newReferenceDate, utc); + this.referenceDate = newReferenceDate; // space reference frame = selectInertialFrame(inertialFrameID); @@ -126,7 +116,6 @@ public class RuggedImpl implements Rugged { * This method is the first one that must be called, otherwise the * other methods will fail due to uninitialized context. * </p> - * @param orekitDataDir top directory for Orekit data * @param newReferenceDate reference date from which all other dates are computed * @param algorithmID identifier of algorithm to use for Digital Elevation Model intersection * @param ellipsoidID identifier of reference ellipsoid @@ -135,7 +124,7 @@ public class RuggedImpl implements Rugged { * @param propagator global propagator * @exception RuggedException if data needed for some frame cannot be loaded */ - public void setGeneralContext(final File orekitDataDir, final AbsoluteDate newReferenceDate, + public void setGeneralContext(final AbsoluteDate newReferenceDate, final Algorithm algorithmID, final Ellipsoid ellipsoidID, final InertialFrame inertialFrameID, final BodyRotatingFrame bodyRotatingFrameID, @@ -144,7 +133,6 @@ public class RuggedImpl implements Rugged { try { // time reference - utc = selectTimeScale(orekitDataDir); this.referenceDate = newReferenceDate; // space reference @@ -189,23 +177,6 @@ public class RuggedImpl implements Rugged { sensors.put(sensor.getName(), sensor); } - /** Select time scale Orekit data. - * @param orekitDataDir top directory for Orekit data (if null, Orekit has already been configured) - * @return utc time scale - * @exception OrekitException if data needed for some frame cannot be loaded - */ - private TimeScale selectTimeScale(final File orekitDataDir) - throws OrekitException { - - if (orekitDataDir != null) { - // set up Orekit data - DataProvidersManager.getInstance().addProvider(new DirectoryCrawler(orekitDataDir)); - } - - return TimeScalesFactory.getUTC(); - - } - /** Select inertial frame. * @param inertialFrame inertial frame identifier * @return inertial frame @@ -290,16 +261,14 @@ public class RuggedImpl implements Rugged { * @return selected attitude provider * @exception OrekitException if data needed for some frame cannot be loaded */ - private AttitudeProvider selectAttitudeProvider(final List<SatelliteQ> quaternions, + private AttitudeProvider selectAttitudeProvider(final List<Pair<AbsoluteDate, Rotation>> quaternions, final int interpolationOrder) throws OrekitException { // set up the attitude provider final List<Attitude> attitudes = new ArrayList<Attitude>(quaternions.size()); - for (final SatelliteQ sq : quaternions) { - final AbsoluteDate date = referenceDate.shiftedBy(sq.getDate()); - final Rotation rotation = new Rotation(sq.getQ0(), sq.getQ1(), sq.getQ2(), sq.getQ3(), true); - attitudes.add(new Attitude(date, frame, rotation, Vector3D.ZERO)); + for (final Pair<AbsoluteDate, Rotation> q : quaternions) { + attitudes.add(new Attitude(q.getFirst(), frame, q.getSecond(), Vector3D.ZERO)); } return new TabulatedProvider(attitudes, interpolationOrder, false); @@ -311,18 +280,14 @@ public class RuggedImpl implements Rugged { * @return selected position/velocity provider * @exception OrekitException if data needed for some frame cannot be loaded */ - private PVCoordinatesProvider selectPVCoordinatesProvider(final List<SatellitePV> positionsVelocities, + private PVCoordinatesProvider selectPVCoordinatesProvider(final List<Pair<AbsoluteDate, PVCoordinates>> positionsVelocities, final int interpolationOrder) throws OrekitException { // set up the ephemeris final List<Orbit> orbits = new ArrayList<Orbit>(positionsVelocities.size()); - for (final SatellitePV pv : positionsVelocities) { - final AbsoluteDate date = referenceDate.shiftedBy(pv.getDate()); - final Vector3D position = new Vector3D(pv.getPx(), pv.getPy(), pv.getPz()); - final Vector3D velocity = new Vector3D(pv.getVx(), pv.getVy(), pv.getVz()); - final CartesianOrbit orbit = new CartesianOrbit(new PVCoordinates(position, velocity), - frame, date, Constants.EIGEN5C_EARTH_MU); + for (final Pair<AbsoluteDate, PVCoordinates> pv : positionsVelocities) { + final CartesianOrbit orbit = new CartesianOrbit(pv.getSecond(), frame, pv.getFirst(), Constants.EIGEN5C_EARTH_MU); orbits.add(orbit); } diff --git a/src/test/java/org/orekit/rugged/core/RuggedImplTest.java b/src/test/java/org/orekit/rugged/core/RuggedImplTest.java index 3f3929a054ed5d52e5ce4dd3bcba16d73b94b826..30d0732106116ce9d1bf8d707a19759a0de51f6c 100644 --- a/src/test/java/org/orekit/rugged/core/RuggedImplTest.java +++ b/src/test/java/org/orekit/rugged/core/RuggedImplTest.java @@ -32,6 +32,7 @@ import org.apache.commons.math3.geometry.euclidean.threed.Rotation; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator; import org.apache.commons.math3.util.FastMath; +import org.apache.commons.math3.util.Pair; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; @@ -64,14 +65,13 @@ import org.orekit.rugged.api.LinearLineDatation; import org.orekit.rugged.api.PixelLOS; import org.orekit.rugged.api.Rugged; import org.orekit.rugged.api.RuggedException; -import org.orekit.rugged.api.SatellitePV; -import org.orekit.rugged.api.SatelliteQ; import org.orekit.rugged.core.raster.CliffsElevationUpdater; import org.orekit.rugged.core.raster.VolcanicConeElevationUpdater; import org.orekit.time.AbsoluteDate; import org.orekit.time.TimeScalesFactory; import org.orekit.utils.Constants; import org.orekit.utils.IERSConventions; +import org.orekit.utils.PVCoordinates; public class RuggedImplTest { @@ -79,57 +79,63 @@ public class RuggedImplTest { public TemporaryFolder tempFolder = new TemporaryFolder(); @Test - public void testSetContextWithoutOrekit() + public void testSetContextWithEphemerides() throws RuggedException, OrekitException, URISyntaxException { - List<SatellitePV> pv = Arrays.asList( - new SatellitePV( 0.000, -1545168.478, -7001985.361, 0.000, -1095.152224, 231.344922, -7372.851944), - new SatellitePV( 1.000, -1546262.794, -7001750.226, -7372.851, -1093.478904, 238.925123, -7372.847995), - new SatellitePV( 2.000, -1547355.435, -7001507.511, -14745.693, -1091.804408, 246.505033, -7372.836044), - new SatellitePV( 3.000, -1548446.402, -7001257.216, -22118.520, -1090.128736, 254.084644, -7372.816090), - new SatellitePV( 4.000, -1549535.693, -7000999.342, -29491.323, -1088.451892, 261.663949, -7372.788133), - new SatellitePV( 5.000, -1550623.306, -7000733.888, -36864.094, -1086.773876, 269.242938, -7372.752175), - new SatellitePV( 6.000, -1551709.240, -7000460.856, -44236.825, -1085.094690, 276.821604, -7372.708214), - new SatellitePV( 7.000, -1552793.495, -7000180.245, -51609.507, -1083.414336, 284.399938, -7372.656251), - new SatellitePV( 8.000, -1553876.068, -6999892.056, -58982.134, -1081.732817, 291.977932, -7372.596287), - new SatellitePV( 9.000, -1554956.960, -6999596.289, -66354.697, -1080.050134, 299.555578, -7372.528320), - new SatellitePV(10.000, -1556036.168, -6999292.945, -73727.188, -1078.366288, 307.132868, -7372.452352), - new SatellitePV(11.000, -1557113.692, -6998982.024, -81099.599, -1076.681282, 314.709792, -7372.368382), - new SatellitePV(12.000, -1558189.530, -6998663.526, -88471.922, -1074.995118, 322.286344, -7372.276411), - new SatellitePV(13.000, -1559263.682, -6998337.451, -95844.150, -1073.307797, 329.862513, -7372.176439), - new SatellitePV(14.000, -1560336.145, -6998003.801, -103216.273, -1071.619321, 337.438294, -7372.068466), - new SatellitePV(15.000, -1561406.920, -6997662.575, -110588.284, -1069.929692, 345.013676, -7371.952492), - new SatellitePV(16.000, -1562476.004, -6997313.774, -117960.175, -1068.238912, 352.588652, -7371.828517), - new SatellitePV(17.000, -1563543.398, -6996957.398, -125331.938, -1066.546983, 360.163213, -7371.696542), - new SatellitePV(18.000, -1564609.098, -6996593.447, -132703.565, -1064.853906, 367.737352, -7371.556566), - new SatellitePV(19.000, -1565673.105, -6996221.923, -140075.049, -1063.159684, 375.311060, -7371.408591), - new SatellitePV(20.000, -1566735.417, -6995842.825, -147446.380, -1061.464319, 382.884328, -7371.252616)); - List<SatelliteQ> q = Arrays.asList( - new SatelliteQ( 0.000, 0.516354347549, -0.400120145429, 0.583012133139, 0.483093065155), - new SatelliteQ( 1.000, 0.516659035405, -0.399867643627, 0.582741754688, 0.483302551263), - new SatelliteQ( 2.000, 0.516963581177, -0.399615033309, 0.582471217473, 0.483511904409), - new SatelliteQ( 3.000, 0.517267984776, -0.399362314553, 0.582200521577, 0.483721124530), - new SatelliteQ( 4.000, 0.517572246112, -0.399109487434, 0.581929667081, 0.483930211565), - new SatelliteQ( 5.000, 0.517876365096, -0.398856552030, 0.581658654071, 0.484139165451), - new SatelliteQ( 6.000, 0.518180341637, -0.398603508416, 0.581387482627, 0.484347986126), - new SatelliteQ( 7.000, 0.518484175647, -0.398350356669, 0.581116152834, 0.484556673529), - new SatelliteQ( 8.000, 0.518787867035, -0.398097096866, 0.580844664773, 0.484765227599), - new SatelliteQ( 9.000, 0.519091415713, -0.397843729083, 0.580573018530, 0.484973648272), - new SatelliteQ(10.000, 0.519394821590, -0.397590253397, 0.580301214186, 0.485181935488), - new SatelliteQ(11.000, 0.519698084578, -0.397336669885, 0.580029251825, 0.485390089185), - new SatelliteQ(12.000, 0.520001204587, -0.397082978623, 0.579757131530, 0.485598109301), - new SatelliteQ(13.000, 0.520304181527, -0.396829179688, 0.579484853385, 0.485805995775), - new SatelliteQ(14.000, 0.520607015311, -0.396575273158, 0.579212417473, 0.486013748545), - new SatelliteQ(15.000, 0.520909705847, -0.396321259108, 0.578939823877, 0.486221367550), - new SatelliteQ(16.000, 0.521212253049, -0.396067137616, 0.578667072681, 0.486428852729), - new SatelliteQ(17.000, 0.521514656825, -0.395812908759, 0.578394163969, 0.486636204020), - new SatelliteQ(18.000, 0.521816917089, -0.395558572613, 0.578121097824, 0.486843421362), - new SatelliteQ(19.000, 0.522119033749, -0.395304129256, 0.577847874330, 0.487050504694), - new SatelliteQ(20.000, 0.522421006719, -0.395049578765, 0.577574493570, 0.487257453954)); String path = getClass().getClassLoader().getResource("orekit-data").toURI().getPath(); + DataProvidersManager.getInstance().addProvider(new DirectoryCrawler(new File(path))); + AbsoluteDate t0 = new AbsoluteDate("2012-01-01T00:00:00", TimeScalesFactory.getUTC()); + + @SuppressWarnings("unchecked") + List<Pair<AbsoluteDate, PVCoordinates>> pv = Arrays.asList( + createPV(t0, 0.000, -1545168.478, -7001985.361, 0.000, -1095.152224, 231.344922, -7372.851944), + createPV(t0, 1.000, -1546262.794, -7001750.226, -7372.851, -1093.478904, 238.925123, -7372.847995), + createPV(t0, 2.000, -1547355.435, -7001507.511, -14745.693, -1091.804408, 246.505033, -7372.836044), + createPV(t0, 3.000, -1548446.402, -7001257.216, -22118.520, -1090.128736, 254.084644, -7372.816090), + createPV(t0, 4.000, -1549535.693, -7000999.342, -29491.323, -1088.451892, 261.663949, -7372.788133), + createPV(t0, 5.000, -1550623.306, -7000733.888, -36864.094, -1086.773876, 269.242938, -7372.752175), + createPV(t0, 6.000, -1551709.240, -7000460.856, -44236.825, -1085.094690, 276.821604, -7372.708214), + createPV(t0, 7.000, -1552793.495, -7000180.245, -51609.507, -1083.414336, 284.399938, -7372.656251), + createPV(t0, 8.000, -1553876.068, -6999892.056, -58982.134, -1081.732817, 291.977932, -7372.596287), + createPV(t0, 9.000, -1554956.960, -6999596.289, -66354.697, -1080.050134, 299.555578, -7372.528320), + createPV(t0,10.000, -1556036.168, -6999292.945, -73727.188, -1078.366288, 307.132868, -7372.452352), + createPV(t0,11.000, -1557113.692, -6998982.024, -81099.599, -1076.681282, 314.709792, -7372.368382), + createPV(t0,12.000, -1558189.530, -6998663.526, -88471.922, -1074.995118, 322.286344, -7372.276411), + createPV(t0,13.000, -1559263.682, -6998337.451, -95844.150, -1073.307797, 329.862513, -7372.176439), + createPV(t0,14.000, -1560336.145, -6998003.801, -103216.273, -1071.619321, 337.438294, -7372.068466), + createPV(t0,15.000, -1561406.920, -6997662.575, -110588.284, -1069.929692, 345.013676, -7371.952492), + createPV(t0,16.000, -1562476.004, -6997313.774, -117960.175, -1068.238912, 352.588652, -7371.828517), + createPV(t0,17.000, -1563543.398, -6996957.398, -125331.938, -1066.546983, 360.163213, -7371.696542), + createPV(t0,18.000, -1564609.098, -6996593.447, -132703.565, -1064.853906, 367.737352, -7371.556566), + createPV(t0,19.000, -1565673.105, -6996221.923, -140075.049, -1063.159684, 375.311060, -7371.408591), + createPV(t0,20.000, -1566735.417, -6995842.825, -147446.380, -1061.464319, 382.884328, -7371.252616)); + + @SuppressWarnings("unchecked") + List<Pair<AbsoluteDate, Rotation>> q = Arrays.asList( + createQ(t0, 0.000, 0.516354347549, -0.400120145429, 0.583012133139, 0.483093065155), + createQ(t0, 1.000, 0.516659035405, -0.399867643627, 0.582741754688, 0.483302551263), + createQ(t0, 2.000, 0.516963581177, -0.399615033309, 0.582471217473, 0.483511904409), + createQ(t0, 3.000, 0.517267984776, -0.399362314553, 0.582200521577, 0.483721124530), + createQ(t0, 4.000, 0.517572246112, -0.399109487434, 0.581929667081, 0.483930211565), + createQ(t0, 5.000, 0.517876365096, -0.398856552030, 0.581658654071, 0.484139165451), + createQ(t0, 6.000, 0.518180341637, -0.398603508416, 0.581387482627, 0.484347986126), + createQ(t0, 7.000, 0.518484175647, -0.398350356669, 0.581116152834, 0.484556673529), + createQ(t0, 8.000, 0.518787867035, -0.398097096866, 0.580844664773, 0.484765227599), + createQ(t0, 9.000, 0.519091415713, -0.397843729083, 0.580573018530, 0.484973648272), + createQ(t0,10.000, 0.519394821590, -0.397590253397, 0.580301214186, 0.485181935488), + createQ(t0,11.000, 0.519698084578, -0.397336669885, 0.580029251825, 0.485390089185), + createQ(t0,12.000, 0.520001204587, -0.397082978623, 0.579757131530, 0.485598109301), + createQ(t0,13.000, 0.520304181527, -0.396829179688, 0.579484853385, 0.485805995775), + createQ(t0,14.000, 0.520607015311, -0.396575273158, 0.579212417473, 0.486013748545), + createQ(t0,15.000, 0.520909705847, -0.396321259108, 0.578939823877, 0.486221367550), + createQ(t0,16.000, 0.521212253049, -0.396067137616, 0.578667072681, 0.486428852729), + createQ(t0,17.000, 0.521514656825, -0.395812908759, 0.578394163969, 0.486636204020), + createQ(t0,18.000, 0.521816917089, -0.395558572613, 0.578121097824, 0.486843421362), + createQ(t0,19.000, 0.522119033749, -0.395304129256, 0.577847874330, 0.487050504694), + createQ(t0,20.000, 0.522421006719, -0.395049578765, 0.577574493570, 0.487257453954)); + RuggedImpl rugged = new RuggedImpl(); - rugged.setGeneralContext(new File(path), - "2012-01-01T00:00:00", + rugged.setGeneralContext(t0, Rugged.Algorithm.DUVENHAGE, Rugged.Ellipsoid.WGS84, Rugged.InertialFrame.EME2000, @@ -142,7 +148,7 @@ public class RuggedImplTest { } @Test - public void testSetContextWithOrekit() + public void testSetContextWithPropagator() throws RuggedException, OrekitException, URISyntaxException { String path = getClass().getClassLoader().getResource("orekit-data").toURI().getPath(); @@ -153,8 +159,7 @@ public class RuggedImplTest { Propagator propagator = createPropagator(earth, gravityField, orbit); RuggedImpl rugged = new RuggedImpl(); - rugged.setGeneralContext(null, - propagator.getInitialState().getDate(), + rugged.setGeneralContext(propagator.getInitialState().getDate(), Rugged.Algorithm.DUVENHAGE, Rugged.Ellipsoid.WGS84, Rugged.InertialFrame.EME2000, @@ -205,8 +210,7 @@ public class RuggedImplTest { Propagator ephemeris = propagator.getGeneratedEphemeris(); RuggedImpl rugged = new RuggedImpl(); - rugged.setGeneralContext(null, - crossing, + rugged.setGeneralContext(crossing, Rugged.Algorithm.DUVENHAGE, Rugged.Ellipsoid.WGS84, Rugged.InertialFrame.EME2000, @@ -360,5 +364,18 @@ public class RuggedImplTest { return list; } + private Pair<AbsoluteDate, PVCoordinates> createPV(AbsoluteDate t0, double dt, + double px, double py, double pz, + double vx, double vy, double vz) { + return new Pair<AbsoluteDate, PVCoordinates>(t0.shiftedBy(dt), + new PVCoordinates(new Vector3D(px, py, pz), + new Vector3D(vx, vy, vz))); + } + + private Pair<AbsoluteDate, Rotation> createQ(AbsoluteDate t0, double dt, + double q0, double q1, double q2, double q3) { + return new Pair<AbsoluteDate, Rotation>(t0.shiftedBy(dt), new Rotation(q0, q1, q2, q3, true)); + } + }