Fix Error Quaternion #883

Merged
meggert merged 3 commits from error-quat-fix into main 2024-04-10 11:38:36 +02:00
2 changed files with 6 additions and 2 deletions

View File

@ -27,6 +27,10 @@ will consitute of a breaking change warranting a new major release:
- PUS timeservice relative timeshift.
## Fixed
- Fixed wrong order in quaternion multiplication for computation of the error quaternion.
# [v7.7.4] 2024-03-21
## Changed

View File

@ -303,9 +303,9 @@ void Guidance::comparePtg(double currentQuat[4], double currentSatRotRate[3], do
// First calculate error quaternion between current and target orientation without reference
// quaternion
double errorQuatWoRef[4] = {0, 0, 0, 0};
QuaternionOperations::multiply(currentQuat, targetQuat, errorQuatWoRef);
QuaternionOperations::multiply(targetQuat, currentQuat, errorQuatWoRef);
// Then add rotation from reference quaternion
QuaternionOperations::multiply(refQuat, errorQuatWoRef, errorQuat);
QuaternionOperations::multiply(errorQuatWoRef, refQuat, errorQuat);
// Keep scalar part of quaternion positive
if (errorQuat[3] < 0) {
VectorOperations<double>::mulScalar(errorQuat, -1, errorQuat, 4);