Angular velocity and acceleration

Hello! I use it:

// Create target point and target pointing law towards that point
final GeodeticPoint targetDef = new GeodeticPoint(FastMath.toRadians(5.), FastMath.toRadians(-40.), 0.);
final TargetPointing targetLaw = new TargetPointing(orbit.getFrame(), targetDef, earthSpheric);
// Get roll, pitch, yaw angles corresponding to this pointing law
final LofOffset lofAlignedLaw = new LofOffset(orbit.getFrame(), LOFType.VVLH);
final Rotation lofAlignedRot = lofAlignedLaw.getAttitude(orbit, date, orbit.getFrame()).getRotation();
final Attitude targetAttitude = targetLaw.getAttitude(orbit, date, orbit.getFrame());
final Rotation rollPitchYaw = targetAttitude.getRotation().applyTo(lofAlignedRot.revert()).revert();
final double angles = rollPitchYaw.getAngles(RotationOrder.ZYX);
final double yaw = angles[0];
final double pitch = angles[1];
final double roll = angles[2];

How to get the angular velocity and angular acceleration (rad/a, rad/s^2) Spacecraft corresponding to these angles?
AngularCoordinates I tried, but there is no axis setting or orientation system - And it calculate his shortest angles and speeds that I don’t need

You may try something like:

  final FieldRotation<UnivariateDerivative2> fr2 = targetAttitude.toUnivariateDerivative2Rotation();
  final FieldRotation<UnivariateDerivative2> rollPitchYaw = fr2.applyTo(lofAlignedRot.revert()).revert();
  final UnivariateDerivative2[] angles = rollPitchYaw.getAngles(RotationOrder.ZYX);

With this, the angles should also include the derivatives instead of only the values.

Thank you @luc, I’ll try it today and report the results :sparkles:

Would you like to supplement the AngularCoordinate class (I really liked it) - so that the angles, angular speed and angular acceleration can be considered not just .getAngle() or .getRate() - but with the orientation LOFType settings and rotation sequence of angles as in LofoffSet?

No, because the class is also used in many other contexts, for example inside the Transform class that is used for frame transforms between frames that are not related to orbits or to Euler/Cardan angles.

targetAttitude not have method “toUnivariateDerivative2Rotation()” :slight_smile:

I do this after I have calculated the angles: I build a law with the calculated angles:

LofOffset lofOffsetLaw = new LofOffset(s.getFrame(), LOFType.LVLH_CCSDS, RotationOrder.ZYX, yaw, pitch, roll);
LofOffsetPointing lofOffsetPtLaw = new LofOffsetPointing(s.getFrame(), earth, lofOffsetLaw, Vector3D.PLUS_K);

FieldVector3D pDot1 = lofOffsetPtLaw.getTargetPV(s.getOrbit(), s.getDate(), earth.getBodyFrame()).toUnivariateDerivative1Vector();

     double x = pDot1.getX().getFirstDerivative();
     double y = pDot1.getY().getFirstDerivative();
     double z = pDot1.getZ().getFirstDerivative();

But I get huge values ​​for angular velocities… as if they were linear velocities.

Yes, in fact, I got linear vector velosity. And I need angular velocity and angular acceleration to provide my angles…

Sorry, I missed an intermediate:


Here, you extract position/velocities of the target point, not angular coordinates of the spacecraft (and you just extract the first derivatives, not the acceleration).

Yes, thank you, this is what I need :star_struck: