Fix NaN for Limiting Rotation Rates #872
@ -273,7 +273,11 @@ void Guidance::limitReferenceRotation(const double xAxisIX[3], double quatIX[4])
|
|||||||
QuaternionOperations::multiply(quatIXtilde, quatXI, quatXXtilde);
|
QuaternionOperations::multiply(quatIXtilde, quatXI, quatXXtilde);
|
||||||
|
|
||||||
double phiResidual = 0, phiResidualVec[3] = {0, 0, 0};
|
double phiResidual = 0, phiResidualVec[3] = {0, 0, 0};
|
||||||
phiResidual = std::sqrt((phiMax * phiMax) - (phiX * phiX));
|
if ((phiX * phiX) > (phiMax * phiMax)) {
|
||||||
|
phiResidual = 0;
|
||||||
|
} else {
|
||||||
|
phiResidual = std::sqrt((phiMax * phiMax) - (phiX * phiX));
|
||||||
|
}
|
||||||
std::memcpy(phiResidualVec, quatXXtilde, sizeof(phiResidualVec));
|
std::memcpy(phiResidualVec, quatXXtilde, sizeof(phiResidualVec));
|
||||||
VectorOperations<double>::normalize(phiResidualVec, phiResidualVec, 3);
|
VectorOperations<double>::normalize(phiResidualVec, phiResidualVec, 3);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user