use of org.orekit.utils.TimeStampedAngularCoordinates 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));
}
use of org.orekit.utils.TimeStampedAngularCoordinates in project Orekit by CS-SI.
the class YawSteering method getAttitude.
/**
* {@inheritDoc}
*/
@Override
public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException {
// attitude from base attitude provider
final Attitude base = getBaseState(pvProv, date, frame);
// Compensation rotation definition :
// . Z satellite axis is unchanged
// . phasing axis shall be aligned to sun direction
final PVCoordinates sunDirection = new PVCoordinates(pvProv.getPVCoordinates(date, frame), sun.getPVCoordinates(date, frame));
final PVCoordinates sunNormal = PVCoordinates.crossProduct(PLUS_Z, base.getOrientation().applyTo(sunDirection));
final TimeStampedAngularCoordinates compensation = new TimeStampedAngularCoordinates(date, PLUS_Z, sunNormal.normalize(), PLUS_Z, phasingNormal, 1.0e-9);
// add compensation
return new Attitude(frame, compensation.addOffset(base.getOrientation()));
}
use of org.orekit.utils.TimeStampedAngularCoordinates in project Orekit by CS-SI.
the class Transform method interpolate.
/**
* Interpolate a transform from a sample set of existing transforms.
* <p>
* Note that even if first time derivatives (velocities and rotation rates)
* from sample can be ignored, the interpolated instance always includes
* interpolated derivatives. This feature can be used explicitly to
* compute these derivatives when it would be too complex to compute them
* from an analytical formula: just compute a few sample points from the
* explicit formula and set the derivatives to zero in these sample points,
* then use interpolation to add derivatives consistent with the positions
* and rotations.
* </p>
* <p>
* As this implementation of interpolation is polynomial, it should be used only
* with small samples (about 10-20 points) in order to avoid <a
* href="http://en.wikipedia.org/wiki/Runge%27s_phenomenon">Runge's phenomenon</a>
* and numerical problems (including NaN appearing).
* </p>
* @param date interpolation date
* @param cFilter filter for derivatives from the sample to use in interpolation
* @param aFilter filter for derivatives from the sample to use in interpolation
* @param sample sample points on which interpolation should be done
* @return a new instance, interpolated at specified date
* @exception OrekitException if the number of point is too small for interpolating
* @since 7.0
*/
public static Transform interpolate(final AbsoluteDate date, final CartesianDerivativesFilter cFilter, final AngularDerivativesFilter aFilter, final Collection<Transform> sample) throws OrekitException {
final List<TimeStampedPVCoordinates> datedPV = new ArrayList<TimeStampedPVCoordinates>(sample.size());
final List<TimeStampedAngularCoordinates> datedAC = new ArrayList<TimeStampedAngularCoordinates>(sample.size());
for (final Transform t : sample) {
datedPV.add(new TimeStampedPVCoordinates(t.getDate(), t.getTranslation(), t.getVelocity(), t.getAcceleration()));
datedAC.add(new TimeStampedAngularCoordinates(t.getDate(), t.getRotation(), t.getRotationRate(), t.getRotationAcceleration()));
}
final TimeStampedPVCoordinates interpolatedPV = TimeStampedPVCoordinates.interpolate(date, cFilter, datedPV);
final TimeStampedAngularCoordinates interpolatedAC = TimeStampedAngularCoordinates.interpolate(date, aFilter, datedAC);
return new Transform(date, interpolatedPV, interpolatedAC);
}
use of org.orekit.utils.TimeStampedAngularCoordinates in project Orekit by CS-SI.
the class TabulatedLofOffsetTest method testConstantOffset.
@Test
public void testConstantOffset() throws OrekitException {
RandomGenerator random = new Well19937a(0x1199d4bb8f53d2b6l);
for (LOFType type : LOFType.values()) {
for (int i = 0; i < 100; ++i) {
double a1 = random.nextDouble() * MathUtils.TWO_PI;
double a2 = random.nextDouble() * MathUtils.TWO_PI;
double a3 = random.nextDouble() * MathUtils.TWO_PI;
LofOffset law = new LofOffset(orbit.getFrame(), type, RotationOrder.XYZ, a1, a2, a3);
Rotation offsetAtt = law.getAttitude(orbit, orbit.getDate(), orbit.getFrame()).getRotation();
LofOffset aligned = new LofOffset(orbit.getFrame(), type);
Rotation alignedAtt = aligned.getAttitude(orbit, orbit.getDate(), orbit.getFrame()).getRotation();
Rotation offsetProper = offsetAtt.compose(alignedAtt.revert(), RotationConvention.VECTOR_OPERATOR);
TabulatedLofOffset tabulated = new TabulatedLofOffset(orbit.getFrame(), type, Arrays.asList(new TimeStampedAngularCoordinates(orbit.getDate().shiftedBy(-10), offsetProper, Vector3D.ZERO, Vector3D.ZERO), new TimeStampedAngularCoordinates(orbit.getDate().shiftedBy(0), offsetProper, Vector3D.ZERO, Vector3D.ZERO), new TimeStampedAngularCoordinates(orbit.getDate().shiftedBy(+10), offsetProper, Vector3D.ZERO, Vector3D.ZERO)), 2, AngularDerivativesFilter.USE_R);
Rotation rebuilt = tabulated.getAttitude(orbit, orbit.getDate(), orbit.getFrame()).getRotation();
Assert.assertEquals(0.0, Rotation.distance(offsetAtt, rebuilt), 1.2e-15);
}
}
}
Aggregations