fixed quaternion multiplication bug
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
This commit is contained in:
parent
f0e551fa54
commit
6f3876d204
@ -192,10 +192,12 @@ void Guidance::targetRotationRate(const double timeDelta, double quatIX[4], doub
|
|||||||
void Guidance::comparePtg(double currentQuat[4], double currentSatRotRate[3], double targetQuat[4],
|
void Guidance::comparePtg(double currentQuat[4], double currentSatRotRate[3], double targetQuat[4],
|
||||||
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 without reference
|
||||||
QuaternionOperations::multiply(currentQuat, targetQuat, errorQuat);
|
// quaternion
|
||||||
// Last calculate add rotation from reference quaternion
|
double errorQuatWoRef[4] = {0, 0, 0, 0};
|
||||||
QuaternionOperations::multiply(refQuat, errorQuat, errorQuat);
|
QuaternionOperations::multiply(currentQuat, targetQuat, errorQuatWoRef);
|
||||||
|
// Then add rotation from reference quaternion
|
||||||
|
QuaternionOperations::multiply(refQuat, errorQuatWoRef, errorQuat);
|
||||||
// Keep scalar part of quaternion positive
|
// Keep scalar part of quaternion positive
|
||||||
if (errorQuat[3] < 0) {
|
if (errorQuat[3] < 0) {
|
||||||
VectorOperations<double>::mulScalar(errorQuat, -1, errorQuat, 4);
|
VectorOperations<double>::mulScalar(errorQuat, -1, errorQuat, 4);
|
||||||
|
Loading…
Reference in New Issue
Block a user