Search in sources :

Example 41 with PVCoordinates

use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.

the class AltitudeDetector method g.

/**
 * Compute the value of the switching function.
 * This function measures the difference between the current altitude
 * and the threshold altitude.
 * @param s the current state information: date, kinematics, attitude
 * @return value of the switching function
 * @exception OrekitException if some specific error occurs
 */
public double g(final SpacecraftState s) throws OrekitException {
    final Frame bodyFrame = bodyShape.getBodyFrame();
    final PVCoordinates pvBody = s.getPVCoordinates(bodyFrame);
    final GeodeticPoint point = bodyShape.transform(pvBody.getPosition(), bodyFrame, s.getDate());
    return point.getAltitude() - altitude;
}
Also used : Frame(org.orekit.frames.Frame) PVCoordinates(org.orekit.utils.PVCoordinates) GeodeticPoint(org.orekit.bodies.GeodeticPoint)

Example 42 with PVCoordinates

use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.

the class CelestialBodyPointed method getAttitude.

/**
 * {@inheritDoc}
 */
public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException {
    final PVCoordinates satPV = pvProv.getPVCoordinates(date, celestialFrame);
    // compute celestial references at the specified date
    final PVCoordinates bodyPV = pointedBody.getPVCoordinates(date, celestialFrame);
    final PVCoordinates pointing = new PVCoordinates(satPV, bodyPV);
    final Vector3D pointingP = pointing.getPosition();
    final double r2 = Vector3D.dotProduct(pointingP, pointingP);
    // evaluate instant rotation axis due to sat and body motion only (no phasing yet)
    final Vector3D rotAxisCel = new Vector3D(1 / r2, Vector3D.crossProduct(pointingP, pointing.getVelocity()));
    // fix instant rotation to take phasing constraint into account
    // (adding a rotation around pointing axis ensuring the motion of the phasing axis
    // is constrained in the pointing-phasing plane)
    final Vector3D v1 = Vector3D.crossProduct(rotAxisCel, phasingCel);
    final Vector3D v2 = Vector3D.crossProduct(pointingP, phasingCel);
    final double compensation = -Vector3D.dotProduct(v1, v2) / v2.getNormSq();
    final Vector3D phasedRotAxisCel = new Vector3D(1.0, rotAxisCel, compensation, pointingP);
    // compute transform from celestial frame to satellite frame
    final Rotation celToSatRotation = new Rotation(pointingP, phasingCel, pointingSat, phasingSat);
    // build transform combining rotation and instant rotation axis
    Transform transform = new Transform(date, celToSatRotation, celToSatRotation.applyTo(phasedRotAxisCel));
    if (frame != celestialFrame) {
        // prepend transform from specified frame to celestial frame
        transform = new Transform(date, frame.getTransformTo(celestialFrame, date), transform);
    }
    // build the attitude
    return new Attitude(date, frame, transform.getRotation(), transform.getRotationRate(), transform.getRotationAcceleration());
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) Transform(org.orekit.frames.Transform) FieldTransform(org.orekit.frames.FieldTransform) FieldRotation(org.hipparchus.geometry.euclidean.threed.FieldRotation) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation)

Example 43 with PVCoordinates

use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.

the class LofOffset method getAttitude.

/**
 * {@inheritDoc}
 */
public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException {
    // construction of the local orbital frame, using PV from inertial frame
    final PVCoordinates pv = pvProv.getPVCoordinates(date, inertialFrame);
    final Transform inertialToLof = type.transformFromInertial(date, pv);
    // take into account the specified start frame (which may not be an inertial one)
    final Transform frameToInertial = frame.getTransformTo(inertialFrame, date);
    final Transform frameToLof = new Transform(date, frameToInertial, inertialToLof);
    // compose with offset rotation
    return new Attitude(date, frame, offset.compose(frameToLof.getRotation(), RotationConvention.VECTOR_OPERATOR), offset.applyTo(frameToLof.getRotationRate()), offset.applyTo(frameToLof.getRotationAcceleration()));
}
Also used : FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) Transform(org.orekit.frames.Transform) FieldTransform(org.orekit.frames.FieldTransform)

Example 44 with PVCoordinates

use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.

the class TabulatedLofOffset method getAttitude.

/**
 * {@inheritDoc}
 */
public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException {
    // get attitudes sample on which interpolation will be performed
    final List<TimeStampedAngularCoordinates> sample = table.getNeighbors(date).collect(Collectors.toList());
    // interpolate
    final TimeStampedAngularCoordinates interpolated = TimeStampedAngularCoordinates.interpolate(date, filter, sample);
    // construction of the local orbital frame, using PV from inertial frame
    final PVCoordinates pv = pvProv.getPVCoordinates(date, inertialFrame);
    final Transform inertialToLof = type.transformFromInertial(date, pv);
    // take into account the specified start frame (which may not be an inertial one)
    final Transform frameToInertial = frame.getTransformTo(inertialFrame, date);
    final Transform frameToLof = new Transform(date, frameToInertial, inertialToLof);
    // compose with interpolated rotation
    return new Attitude(date, frame, interpolated.addOffset(frameToLof.getAngular()));
}
Also used : FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) Transform(org.orekit.frames.Transform) FieldTransform(org.orekit.frames.FieldTransform) TimeStampedAngularCoordinates(org.orekit.utils.TimeStampedAngularCoordinates)

Example 45 with PVCoordinates

use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.

the class RelativityTest method testSmallEffectOnOrbit.

/**
 * check against example in Tapley, Schutz, and Born, p 65-66. They predict a
 * progression of perigee of 11 arcsec/year. To get the same results we must set the
 * propagation tolerances to 1e-5.
 *
 * @throws OrekitException on error
 */
@Test
public void testSmallEffectOnOrbit() throws OrekitException {
    // setup
    final double gm = Constants.EIGEN5C_EARTH_MU;
    Orbit orbit = new KeplerianOrbit(7500e3, 0.025, FastMath.toRadians(41.2), 0, 0, 0, PositionAngle.TRUE, frame, date, gm);
    double[][] tol = NumericalPropagator.tolerances(0.00001, orbit, OrbitType.CARTESIAN);
    AbstractIntegrator integrator = new DormandPrince853Integrator(1, 3600, tol[0], tol[1]);
    NumericalPropagator propagator = new NumericalPropagator(integrator);
    propagator.setOrbitType(OrbitType.CARTESIAN);
    propagator.addForceModel(new Relativity(gm));
    propagator.setInitialState(new SpacecraftState(orbit));
    // action: propagate a period
    AbsoluteDate end = orbit.getDate().shiftedBy(30 * Constants.JULIAN_DAY);
    PVCoordinates actual = propagator.getPVCoordinates(end, frame);
    // verify
    KeplerianOrbit endOrbit = new KeplerianOrbit(actual, frame, end, gm);
    KeplerianOrbit startOrbit = new KeplerianOrbit(orbit);
    double dp = endOrbit.getPerigeeArgument() - startOrbit.getPerigeeArgument();
    double dtYears = end.durationFrom(orbit.getDate()) / Constants.JULIAN_YEAR;
    double dpDeg = FastMath.toDegrees(dp);
    // change in argument of perigee in arcseconds per year
    double arcsecPerYear = dpDeg * 3600 / dtYears;
    Assert.assertEquals(11, arcsecPerYear, 0.5);
}
Also used : FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) AbstractIntegrator(org.hipparchus.ode.AbstractIntegrator) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Aggregations

PVCoordinates (org.orekit.utils.PVCoordinates)341 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)271 Test (org.junit.Test)242 AbsoluteDate (org.orekit.time.AbsoluteDate)189 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)159 SpacecraftState (org.orekit.propagation.SpacecraftState)95 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)76 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)73 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)71 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)67 Orbit (org.orekit.orbits.Orbit)65 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)57 Frame (org.orekit.frames.Frame)53 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)44 CartesianOrbit (org.orekit.orbits.CartesianOrbit)43 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)42 DateComponents (org.orekit.time.DateComponents)40 CircularOrbit (org.orekit.orbits.CircularOrbit)37 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)30 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)30