forked from Archive/PX4-Autopilot
Fix warnings, use more efficient atan2f where it can be safely used
This commit is contained in:
parent
d4785d4b65
commit
ad1be765bf
|
@ -2250,21 +2250,21 @@ bool AttPosEKF::StatesNaN(struct ekf_status_report *err_report) {
|
||||||
// check all integrators
|
// check all integrators
|
||||||
if (!isfinite(summedDelAng.x) || !isfinite(summedDelAng.y) || !isfinite(summedDelAng.z)) {
|
if (!isfinite(summedDelAng.x) || !isfinite(summedDelAng.y) || !isfinite(summedDelAng.z)) {
|
||||||
err_report->statesNaN = true;
|
err_report->statesNaN = true;
|
||||||
ekf_debug("summedDelAng NaN: x: %f y: %f z: %f", summedDelAng.x, summedDelAng.y, summedDelAng.z);
|
ekf_debug("summedDelAng NaN: x: %f y: %f z: %f", (double)summedDelAng.x, (double)summedDelAng.y, (double)summedDelAng.z);
|
||||||
err = true;
|
err = true;
|
||||||
goto out;
|
goto out;
|
||||||
} // delta angles
|
} // delta angles
|
||||||
|
|
||||||
if (!isfinite(correctedDelAng.x) || !isfinite(correctedDelAng.y) || !isfinite(correctedDelAng.z)) {
|
if (!isfinite(correctedDelAng.x) || !isfinite(correctedDelAng.y) || !isfinite(correctedDelAng.z)) {
|
||||||
err_report->statesNaN = true;
|
err_report->statesNaN = true;
|
||||||
ekf_debug("correctedDelAng NaN: x: %f y: %f z: %f", correctedDelAng.x, correctedDelAng.y, correctedDelAng.z);
|
ekf_debug("correctedDelAng NaN: x: %f y: %f z: %f", (double)correctedDelAng.x, (double)correctedDelAng.y, (double)correctedDelAng.z);
|
||||||
err = true;
|
err = true;
|
||||||
goto out;
|
goto out;
|
||||||
} // delta angles
|
} // delta angles
|
||||||
|
|
||||||
if (!isfinite(summedDelVel.x) || !isfinite(summedDelVel.y) || !isfinite(summedDelVel.z)) {
|
if (!isfinite(summedDelVel.x) || !isfinite(summedDelVel.y) || !isfinite(summedDelVel.z)) {
|
||||||
err_report->statesNaN = true;
|
err_report->statesNaN = true;
|
||||||
ekf_debug("summedDelVel NaN: x: %f y: %f z: %f", summedDelVel.x, summedDelVel.y, summedDelVel.z);
|
ekf_debug("summedDelVel NaN: x: %f y: %f z: %f", (double)summedDelVel.x, (double)summedDelVel.y, (double)summedDelVel.z);
|
||||||
err = true;
|
err = true;
|
||||||
goto out;
|
goto out;
|
||||||
} // delta velocities
|
} // delta velocities
|
||||||
|
@ -2381,8 +2381,8 @@ void AttPosEKF::AttitudeInit(float ax, float ay, float az, float mx, float my, f
|
||||||
float magX, magY;
|
float magX, magY;
|
||||||
float initialHdg, cosHeading, sinHeading;
|
float initialHdg, cosHeading, sinHeading;
|
||||||
|
|
||||||
initialRoll = atan2(-ay, -az);
|
initialRoll = atan2f(-ay, -az);
|
||||||
initialPitch = atan2(ax, -az);
|
initialPitch = atan2f(ax, -az);
|
||||||
|
|
||||||
cosRoll = cosf(initialRoll);
|
cosRoll = cosf(initialRoll);
|
||||||
sinRoll = sinf(initialRoll);
|
sinRoll = sinf(initialRoll);
|
||||||
|
|
Loading…
Reference in New Issue