Search in sources :

Example 61 with TimeStampedPVCoordinates

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

the class JPLCelestialBody method getPVCoordinates.

/**
 * {@inheritDoc}
 */
public TimeStampedPVCoordinates getPVCoordinates(final AbsoluteDate date, final Frame frame) throws OrekitException {
    // apply the scale factor to raw position-velocity
    final PVCoordinates rawPV = rawPVProvider.getRawPV(date);
    final TimeStampedPVCoordinates scaledPV = new TimeStampedPVCoordinates(date, scale, rawPV);
    // the raw PV are relative to the parent of the body centered inertially oriented frame
    final Transform transform = getInertiallyOrientedFrame().getParent().getTransformTo(frame, date);
    // convert to requested frame
    return transform.transformPVCoordinates(scaledPV);
}
Also used : TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) Transform(org.orekit.frames.Transform) FieldTransform(org.orekit.frames.FieldTransform)

Example 62 with TimeStampedPVCoordinates

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

the class OneAxisEllipsoid method transform.

/**
 * Transform a Cartesian point to a surface-relative point.
 * @param point Cartesian point
 * @param frame frame in which Cartesian point is expressed
 * @param date date of the computation (used for frames conversions)
 * @return point at the same location but as a surface-relative point,
 * using time as the single derivation parameter
 * @exception OrekitException if point cannot be converted to body frame
 */
public FieldGeodeticPoint<DerivativeStructure> transform(final PVCoordinates point, final Frame frame, final AbsoluteDate date) throws OrekitException {
    // transform point to body frame
    final Transform toBody = frame.getTransformTo(bodyFrame, date);
    final PVCoordinates pointInBodyFrame = toBody.transformPVCoordinates(point);
    final FieldVector3D<DerivativeStructure> p = pointInBodyFrame.toDerivativeStructureVector(2);
    final DerivativeStructure pr2 = p.getX().multiply(p.getX()).add(p.getY().multiply(p.getY()));
    final DerivativeStructure pr = pr2.sqrt();
    final DerivativeStructure pz = p.getZ();
    // project point on the ellipsoid surface
    final TimeStampedPVCoordinates groundPoint = projectToGround(new TimeStampedPVCoordinates(date, pointInBodyFrame), bodyFrame);
    final FieldVector3D<DerivativeStructure> gp = groundPoint.toDerivativeStructureVector(2);
    final DerivativeStructure gpr2 = gp.getX().multiply(gp.getX()).add(gp.getY().multiply(gp.getY()));
    final DerivativeStructure gpr = gpr2.sqrt();
    final DerivativeStructure gpz = gp.getZ();
    // relative position of test point with respect to its ellipse sub-point
    final DerivativeStructure dr = pr.subtract(gpr);
    final DerivativeStructure dz = pz.subtract(gpz);
    final double insideIfNegative = g2 * (pr2.getReal() - ae2) + pz.getReal() * pz.getReal();
    return new FieldGeodeticPoint<>(DerivativeStructure.atan2(gpz, gpr.multiply(g2)), DerivativeStructure.atan2(p.getY(), p.getX()), DerivativeStructure.hypot(dr, dz).copySign(insideIfNegative));
}
Also used : DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) Transform(org.orekit.frames.Transform) FieldTransform(org.orekit.frames.FieldTransform) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates)

Example 63 with TimeStampedPVCoordinates

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

the class GroundPointing method getAttitude.

/**
 * {@inheritDoc}
 */
public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException {
    // satellite-target relative vector
    final PVCoordinates pva = pvProv.getPVCoordinates(date, inertialFrame);
    final TimeStampedPVCoordinates delta = new TimeStampedPVCoordinates(date, pva, getTargetPV(pvProv, date, inertialFrame));
    // spacecraft and target should be away from each other to define a pointing direction
    if (delta.getPosition().getNorm() == 0.0) {
        throw new OrekitException(OrekitMessages.SATELLITE_COLLIDED_WITH_TARGET);
    }
    // attitude definition:
    // line of sight    -> +z satellite axis,
    // orbital velocity -> (z, +x) half plane
    final Vector3D p = pva.getPosition();
    final Vector3D v = pva.getVelocity();
    final Vector3D a = pva.getAcceleration();
    final double r2 = p.getNormSq();
    final double r = FastMath.sqrt(r2);
    final Vector3D keplerianJerk = new Vector3D(-3 * Vector3D.dotProduct(p, v) / r2, a, -a.getNorm() / r, v);
    final PVCoordinates velocity = new PVCoordinates(v, a, keplerianJerk);
    final PVCoordinates los = delta.normalize();
    final PVCoordinates normal = PVCoordinates.crossProduct(delta, velocity).normalize();
    AngularCoordinates ac = new AngularCoordinates(los, normal, PLUS_K, PLUS_J, 1.0e-9);
    if (frame != inertialFrame) {
        // prepend transform from specified frame to inertial frame
        ac = ac.addOffset(frame.getTransformTo(inertialFrame, date).getAngular());
    }
    // build the attitude
    return new Attitude(date, frame, ac);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) AngularCoordinates(org.orekit.utils.AngularCoordinates) FieldAngularCoordinates(org.orekit.utils.FieldAngularCoordinates) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) OrekitException(org.orekit.errors.OrekitException) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates)

Example 64 with TimeStampedPVCoordinates

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

the class LofOffsetPointing method losIntersectionWithBody.

/**
 * Compute line of sight intersection with body.
 * @param scToBody transform from spacecraft frame to body frame
 * @return intersection point in body frame (only the position is set!)
 * @exception OrekitException if line of sight does not intersect body
 */
private TimeStampedPVCoordinates losIntersectionWithBody(final Transform scToBody) throws OrekitException {
    // compute satellite pointing axis and position/velocity in body frame
    final Vector3D pointingBodyFrame = scToBody.transformVector(satPointingVector);
    final Vector3D pBodyFrame = scToBody.transformPosition(Vector3D.ZERO);
    // Line from satellite following pointing direction
    // we use arbitrarily the Earth radius as a scaling factor, it could be anything else
    final Line pointingLine = new Line(pBodyFrame, pBodyFrame.add(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, pointingBodyFrame), 1.0e-10);
    // Intersection with body shape
    final GeodeticPoint gpIntersection = shape.getIntersectionPoint(pointingLine, pBodyFrame, shape.getBodyFrame(), scToBody.getDate());
    final Vector3D pIntersection = (gpIntersection == null) ? null : shape.transform(gpIntersection);
    // Check there is an intersection and it is not in the reverse pointing direction
    if ((pIntersection == null) || (Vector3D.dotProduct(pIntersection.subtract(pBodyFrame), pointingBodyFrame) < 0)) {
        throw new OrekitException(OrekitMessages.ATTITUDE_POINTING_LAW_DOES_NOT_POINT_TO_GROUND);
    }
    return new TimeStampedPVCoordinates(scToBody.getDate(), pIntersection, Vector3D.ZERO, Vector3D.ZERO);
}
Also used : Line(org.hipparchus.geometry.euclidean.threed.Line) FieldLine(org.hipparchus.geometry.euclidean.threed.FieldLine) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates)

Example 65 with TimeStampedPVCoordinates

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

the class TargetPointing method getTargetPV.

/**
 * {@inheritDoc}
 */
@Override
public TimeStampedPVCoordinates getTargetPV(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException {
    final Transform t = getBodyFrame().getTransformTo(frame, date);
    final TimeStampedPVCoordinates pv = new TimeStampedPVCoordinates(date, target, Vector3D.ZERO, Vector3D.ZERO);
    return t.transformPVCoordinates(pv);
}
Also used : Transform(org.orekit.frames.Transform) FieldTransform(org.orekit.frames.FieldTransform) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates)

Aggregations

TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)103 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)64 Test (org.junit.Test)50 AbsoluteDate (org.orekit.time.AbsoluteDate)48 SpacecraftState (org.orekit.propagation.SpacecraftState)36 Frame (org.orekit.frames.Frame)27 ArrayList (java.util.ArrayList)24 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)23 Transform (org.orekit.frames.Transform)22 CartesianOrbit (org.orekit.orbits.CartesianOrbit)20 Orbit (org.orekit.orbits.Orbit)19 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)18 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)17 PVCoordinates (org.orekit.utils.PVCoordinates)17 OrekitException (org.orekit.errors.OrekitException)15 BoundedPropagator (org.orekit.propagation.BoundedPropagator)12 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)11 CircularOrbit (org.orekit.orbits.CircularOrbit)11 Propagator (org.orekit.propagation.Propagator)11 FieldTransform (org.orekit.frames.FieldTransform)10