use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class HolmesFeatherstoneAttractionModel method acceleration.
/**
* {@inheritDoc}
*/
public <T extends RealFieldElement<T>> FieldVector3D<T> acceleration(final FieldSpacecraftState<T> s, final T[] parameters) throws OrekitException {
final T mu = parameters[0];
// check for faster computation dedicated to derivatives with respect to state
if (isStateDerivative(s)) {
@SuppressWarnings("unchecked") final FieldVector3D<DerivativeStructure> p = (FieldVector3D<DerivativeStructure>) s.getPVCoordinates().getPosition();
@SuppressWarnings("unchecked") final FieldVector3D<T> a = (FieldVector3D<T>) accelerationWrtState(s.getDate().toAbsoluteDate(), s.getFrame(), p, (DerivativeStructure) mu);
return a;
}
// get the position in body frame
final FieldAbsoluteDate<T> date = s.getDate();
final Transform fromBodyFrame = bodyFrame.getTransformTo(s.getFrame(), date.toAbsoluteDate());
final Transform toBodyFrame = fromBodyFrame.getInverse();
final FieldVector3D<T> position = toBodyFrame.transformPosition(s.getPVCoordinates().getPosition());
// gradient of the non-central part of the gravity field
return fromBodyFrame.transformVector(new FieldVector3D<>(gradient(date, position, mu)));
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class HolmesFeatherstoneAttractionModel method acceleration.
/**
* {@inheritDoc}
*/
@Override
public Vector3D acceleration(final SpacecraftState s, final double[] parameters) throws OrekitException {
final double mu = parameters[0];
// get the position in body frame
final AbsoluteDate date = s.getDate();
final Transform fromBodyFrame = bodyFrame.getTransformTo(s.getFrame(), date);
final Transform toBodyFrame = fromBodyFrame.getInverse();
final Vector3D position = toBodyFrame.transformPosition(s.getPVCoordinates().getPosition());
// gradient of the non-central part of the gravity field
return fromBodyFrame.transformVector(new Vector3D(gradient(date, position, mu)));
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class Geoid method projectToGround.
@Override
public Vector3D projectToGround(final Vector3D point, final AbsoluteDate date, final Frame frame) throws OrekitException {
final GeodeticPoint gp = this.transform(point, frame, date);
final GeodeticPoint gpZero = new GeodeticPoint(gp.getLatitude(), gp.getLongitude(), 0);
final Transform bodyToFrame = this.getBodyFrame().getTransformTo(frame, date);
return bodyToFrame.transformPosition(this.transform(gpZero));
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class OEMParserTest method testParseOemMissingOptionalData.
@Test
public void testParseOemMissingOptionalData() throws OrekitException, IOException {
final String ex = "/ccsds/OEMExample6.txt";
final InputStream inEntry = getClass().getResourceAsStream(ex);
final OEMParser parser = new OEMParser().withMu(CelestialBodyFactory.getEarth().getGM()).withConventions(IERSConventions.IERS_2010);
final OEMFile file = parser.parse(inEntry);
Assert.assertEquals(CcsdsTimeScale.UTC, file.getEphemeridesBlocks().get(0).getMetaData().getTimeSystem());
Assert.assertEquals("MARS GLOBAL SURVEYOR", file.getEphemeridesBlocks().get(0).getMetaData().getObjectName());
Assert.assertEquals("1996-062A", file.getEphemeridesBlocks().get(0).getMetaData().getObjectID());
Assert.assertEquals(1, file.getSatellites().size());
Assert.assertEquals(true, file.getSatellites().containsKey("1996-062A"));
Assert.assertEquals(false, file.getSatellites().containsKey("MARS GLOBAL SURVEYOR"));
Assert.assertEquals(1, file.getSatellites().size());
Assert.assertEquals("1996-062A", file.getSatellites().values().iterator().next().getId());
Assert.assertEquals(new AbsoluteDate("2002-12-18T12:00:00.331", TimeScalesFactory.getUTC()), file.getEphemeridesBlocks().get(0).getStartTime());
OemSatelliteEphemeris satellite = file.getSatellites().get("1996-062A");
Assert.assertEquals(satellite.getId(), "1996-062A");
Assert.assertEquals(satellite.getMu(), file.getMuUsed(), 0);
EphemeridesBlock actualBlock = satellite.getSegments().get(0);
Assert.assertEquals(actualBlock.getMu(), file.getMuUsed(), 0);
FactoryManagedFrame eme2000 = FramesFactory.getEME2000();
Frame actualFrame = actualBlock.getFrame();
AbsoluteDate actualStart = satellite.getStart();
Transform actualTransform = eme2000.getTransformTo(actualFrame, actualStart);
CelestialBody mars = CelestialBodyFactory.getMars();
TimeStampedPVCoordinates marsPV = mars.getPVCoordinates(actualStart, eme2000);
Assert.assertEquals(actualTransform.getTranslation(), marsPV.getPosition());
Assert.assertEquals(actualTransform.getVelocity(), marsPV.getVelocity());
Assert.assertEquals(actualTransform.getAcceleration(), marsPV.getAcceleration());
Assert.assertEquals(Rotation.distance(actualTransform.getRotation(), Rotation.IDENTITY), 0.0, 0.0);
Assert.assertEquals(actualTransform.getRotationRate(), Vector3D.ZERO);
Assert.assertEquals(actualTransform.getRotationAcceleration(), Vector3D.ZERO);
Assert.assertEquals(actualFrame.getName(), "Mars/EME2000");
Assert.assertEquals(actualBlock.getFrameString(), "EME2000");
Assert.assertEquals(actualBlock.getTimeScaleString(), "UTC");
Assert.assertEquals(actualBlock.getTimeScale(), TimeScalesFactory.getUTC());
Assert.assertEquals(actualBlock.getAvailableDerivatives(), CartesianDerivativesFilter.USE_PV);
Assert.assertEquals(satellite.getSegments().get(0).getStartTime(), actualStart);
Assert.assertEquals(satellite.getSegments().get(2).getStopTime(), satellite.getStop());
final BoundedPropagator propagator = satellite.getPropagator();
Assert.assertEquals(propagator.getMinDate(), satellite.getStart());
Assert.assertEquals(propagator.getMinDate(), satellite.getSegments().get(0).getStart());
Assert.assertEquals(propagator.getMaxDate(), satellite.getStop());
Assert.assertEquals(propagator.getMaxDate(), satellite.getSegments().get(2).getStop());
final List<TimeStampedPVCoordinates> dataLines = new ArrayList<>();
for (EphemeridesBlock block : file.getEphemeridesBlocks()) {
for (TimeStampedPVCoordinates dataLine : block.getEphemeridesDataLines()) {
if (dataLine.getDate().compareTo(satellite.getStart()) >= 0) {
dataLines.add(dataLine);
}
}
}
final int ulps = 12;
for (TimeStampedPVCoordinates coord : dataLines) {
Assert.assertThat(propagator.getPVCoordinates(coord.getDate(), actualFrame), OrekitMatchers.pvCloseTo(coord, ulps));
Assert.assertThat(propagator.propagate(coord.getDate()).getPVCoordinates(), OrekitMatchers.pvCloseTo(coord, ulps));
}
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class AngularAzElMeasurementCreator method handleStep.
public void handleStep(final SpacecraftState currentState, final boolean isLast) throws OrekitException {
for (final GroundStation station : context.stations) {
final AbsoluteDate date = currentState.getDate();
final Frame inertial = currentState.getFrame();
final Vector3D position = currentState.getPVCoordinates().getPosition();
if (station.getBaseFrame().getElevation(position, inertial, date) > FastMath.toRadians(30.0)) {
final UnivariateSolver solver = new BracketingNthOrderBrentSolver(1.0e-12, 5);
final double downLinkDelay = solver.solve(1000, new UnivariateFunction() {
public double value(final double x) throws OrekitExceptionWrapper {
try {
final Transform t = station.getOffsetToInertial(inertial, date.shiftedBy(x));
final double d = Vector3D.distance(position, t.transformPosition(Vector3D.ZERO));
return d - x * Constants.SPEED_OF_LIGHT;
} catch (OrekitException oe) {
throw new OrekitExceptionWrapper(oe);
}
}
}, -1.0, 1.0);
// Satellite position at signal departure
final Vector3D satelliteAtDeparture = currentState.shiftedBy(-downLinkDelay).getPVCoordinates().getPosition();
// Initialize measurement
final double[] angular = new double[2];
final double[] sigma = { 1.0, 1.0 };
final double[] baseweight = { 10.0, 10.0 };
// Compute measurement
// Elevation
angular[1] = station.getBaseFrame().getElevation(satelliteAtDeparture, currentState.getFrame(), currentState.getDate());
// Azimuth
angular[0] = station.getBaseFrame().getAzimuth(satelliteAtDeparture, currentState.getFrame(), currentState.getDate());
addMeasurement(new AngularAzEl(station, date, angular, sigma, baseweight));
}
}
}
Aggregations