mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-09 17:38:32 -04:00
Copter: replace vehicle compass consistency check
This commit is contained in:
parent
8cfde42e15
commit
0f55b2a0eb
@ -313,11 +313,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// arming check's maximum acceptable vector difference between internal and external compass after vectors are normalized to field length of 1.0
|
|
||||||
#ifndef COMPASS_ACCEPTABLE_VECTOR_DIFF
|
|
||||||
#define COMPASS_ACCEPTABLE_VECTOR_DIFF 0.75f // pre arm compass check will fail if internal vs external compass direction differ by more than 45 degrees
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// OPTICAL_FLOW
|
// OPTICAL_FLOW
|
||||||
#ifndef OPTFLOW
|
#ifndef OPTFLOW
|
||||||
|
@ -373,25 +373,13 @@ bool Copter::pre_arm_checks(bool display_failure)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if COMPASS_MAX_INSTANCES > 1
|
|
||||||
// check all compasses point in roughly same direction
|
// check all compasses point in roughly same direction
|
||||||
if (compass.get_count() > 1) {
|
if (!compass.consistent()) {
|
||||||
Vector3f prime_mag_vec = compass.get_field_milligauss();
|
|
||||||
prime_mag_vec.normalize();
|
|
||||||
for(uint8_t i=0; i<compass.get_count(); i++) {
|
|
||||||
// get next compass
|
|
||||||
Vector3f mag_vec = compass.get_field_milligauss(i);
|
|
||||||
mag_vec.normalize();
|
|
||||||
Vector3f vec_diff = mag_vec - prime_mag_vec;
|
|
||||||
if (compass.use_for_yaw(i) && vec_diff.length() > COMPASS_ACCEPTABLE_VECTOR_DIFF) {
|
|
||||||
if (display_failure) {
|
if (display_failure) {
|
||||||
gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("PreArm: inconsistent compasses"));
|
gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("PreArm: inconsistent compasses"));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user