Search in sources :

Example 41 with Transform

use of org.orekit.frames.Transform 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 42 with Transform

use of org.orekit.frames.Transform 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 43 with Transform

use of org.orekit.frames.Transform in project Orekit by CS-SI.

the class SpinStabilized method getAttitude.

/**
 * {@inheritDoc}
 */
public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException {
    // get attitude from underlying non-rotating law
    final Attitude base = nonRotatingLaw.getAttitude(pvProv, date, frame);
    final Transform baseTransform = new Transform(date, base.getOrientation());
    // compute spin transform due to spin from reference to current date
    final Transform spinInfluence = new Transform(date, new Rotation(axis, rate * date.durationFrom(start), RotationConvention.FRAME_TRANSFORM), spin);
    // combine the two transforms
    final Transform combined = new Transform(date, baseTransform, spinInfluence);
    // build the attitude
    return new Attitude(date, frame, combined.getRotation(), combined.getRotationRate(), combined.getRotationAcceleration());
}
Also used : 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 44 with Transform

use of org.orekit.frames.Transform 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)

Example 45 with Transform

use of org.orekit.frames.Transform in project Orekit by CS-SI.

the class YawCompensation method getAttitude.

/**
 * {@inheritDoc}
 */
@Override
public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException {
    final Transform bodyToRef = getBodyFrame().getTransformTo(frame, date);
    // compute sliding target ground point
    final PVCoordinates slidingRef = getTargetPV(pvProv, date, frame);
    final PVCoordinates slidingBody = bodyToRef.getInverse().transformPVCoordinates(slidingRef);
    // compute relative position of sliding ground point with respect to satellite
    final PVCoordinates relativePosition = new PVCoordinates(pvProv.getPVCoordinates(date, frame), slidingRef);
    // compute relative velocity of fixed ground point with respect to sliding ground point
    // the velocity part of the transformPVCoordinates for the sliding point ps
    // from body frame to reference frame is:
    // d(ps_ref)/dt = r(d(ps_body)/dt + dq/dt) - Ω ⨯ ps_ref
    // where r is the rotation part of the transform, Ω is the corresponding
    // angular rate, and dq/dt is the derivative of the translation part of the
    // transform (the translation itself, without derivative, is hidden in the
    // ps_ref part in the cross product).
    // The sliding point ps is co-located to a fixed ground point pf (i.e. they have the
    // same position at time of computation), but this fixed point as zero velocity
    // with respect to the ground. So the velocity part of the transformPVCoordinates
    // for this fixed point can be computed using the same formula as above:
    // from body frame to reference frame is:
    // d(pf_ref)/dt = r(0 + dq/dt) - Ω ⨯ pf_ref
    // so remembering that the two points are at the same location at computation time,
    // i.e. that at t=0 pf_ref=ps_ref, the relative velocity between the fixed point
    // and the sliding point is given by the simple expression:
    // d(ps_ref)/dt - d(pf_ref)/dt = r(d(ps_body)/dt)
    // the acceleration is computed by differentiating the expression, which gives:
    // d²(ps_ref)/dt² - d²(pf_ref)/dt² = r(d²(ps_body)/dt²) - Ω ⨯ [d(ps_ref)/dt - d(pf_ref)/dt]
    final Vector3D v = bodyToRef.getRotation().applyTo(slidingBody.getVelocity());
    final Vector3D a = new Vector3D(+1, bodyToRef.getRotation().applyTo(slidingBody.getAcceleration()), -1, Vector3D.crossProduct(bodyToRef.getRotationRate(), v));
    final PVCoordinates relativeVelocity = new PVCoordinates(v, a, Vector3D.ZERO);
    final PVCoordinates relativeNormal = PVCoordinates.crossProduct(relativePosition, relativeVelocity).normalize();
    // . target relative velocity is in (Z, X) plane, in the -X half plane part
    return new Attitude(frame, new TimeStampedAngularCoordinates(date, relativePosition.normalize(), relativeNormal.normalize(), PLUS_K, PLUS_J, 1.0e-9));
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) Transform(org.orekit.frames.Transform) FieldTransform(org.orekit.frames.FieldTransform) TimeStampedAngularCoordinates(org.orekit.utils.TimeStampedAngularCoordinates)

Aggregations

Transform (org.orekit.frames.Transform)75 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)56 AbsoluteDate (org.orekit.time.AbsoluteDate)33 Frame (org.orekit.frames.Frame)28 FieldTransform (org.orekit.frames.FieldTransform)26 SpacecraftState (org.orekit.propagation.SpacecraftState)26 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)25 PVCoordinates (org.orekit.utils.PVCoordinates)23 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)21 Test (org.junit.Test)20 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)18 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)17 GeodeticPoint (org.orekit.bodies.GeodeticPoint)13 TopocentricFrame (org.orekit.frames.TopocentricFrame)12 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)11 OrekitException (org.orekit.errors.OrekitException)11 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)10 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)10 FieldRotation (org.hipparchus.geometry.euclidean.threed.FieldRotation)8 CircularOrbit (org.orekit.orbits.CircularOrbit)8