Target Quaternion Fix #847
@ -418,8 +418,9 @@ void Guidance::comparePtg(double currentQuat[4], double currentSatRotRate[3], do
|
|||||||
double targetSatRotRate[3], double refQuat[4], double refSatRotRate[3],
|
double targetSatRotRate[3], double refQuat[4], double refSatRotRate[3],
|
||||||
double errorQuat[4], double errorSatRotRate[3], double &errorAngle) {
|
double errorQuat[4], double errorSatRotRate[3], double &errorAngle) {
|
||||||
// First calculate error quaternion between current and target orientation
|
// First calculate error quaternion between current and target orientation
|
||||||
QuaternionOperations::inverse(targetQuat, targetQuat);
|
double invTargetQuat[4] = {0, 0, 0, 0};
|
||||||
QuaternionOperations::multiply(currentQuat, targetQuat, errorQuat);
|
QuaternionOperations::inverse(targetQuat, invTargetQuat);
|
||||||
|
QuaternionOperations::multiply(currentQuat, invTargetQuat, errorQuat);
|
||||||
// Last calculate add rotation from reference quaternion
|
// Last calculate add rotation from reference quaternion
|
||||||
QuaternionOperations::multiply(refQuat, errorQuat, errorQuat);
|
QuaternionOperations::multiply(refQuat, errorQuat, errorQuat);
|
||||||
// Keep scalar part of quaternion positive
|
// Keep scalar part of quaternion positive
|
||||||
|
Loading…
Reference in New Issue
Block a user