mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-13 07:20:36 +08:00
Use isAllFinite() in all places that check finiteness on entire vectors or matrices
This commit is contained in:
@@ -111,7 +111,7 @@ void Accelerometer::SensorCorrectionsUpdate(bool force)
|
||||
bool Accelerometer::set_offset(const Vector3f &offset)
|
||||
{
|
||||
if (Vector3f(_offset - offset).longerThan(0.01f)) {
|
||||
if (PX4_ISFINITE(offset(0)) && PX4_ISFINITE(offset(1)) && PX4_ISFINITE(offset(2))) {
|
||||
if (offset.isAllFinite()) {
|
||||
_offset = offset;
|
||||
_calibration_count++;
|
||||
return true;
|
||||
@@ -124,9 +124,7 @@ bool Accelerometer::set_offset(const Vector3f &offset)
|
||||
bool Accelerometer::set_scale(const Vector3f &scale)
|
||||
{
|
||||
if (Vector3f(_scale - scale).longerThan(0.01f)) {
|
||||
if ((scale(0) > 0.f) && (scale(1) > 0.f) && (scale(2) > 0.f) &&
|
||||
PX4_ISFINITE(scale(0)) && PX4_ISFINITE(scale(1)) && PX4_ISFINITE(scale(2))) {
|
||||
|
||||
if (scale.isAllFinite() && (scale(0) > 0.f) && (scale(1) > 0.f) && (scale(2) > 0.f)) {
|
||||
_scale = scale;
|
||||
_calibration_count++;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user