mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 07:03:33 +08:00
delete ACCELIOCSELFTEST and GYROIOCSELFTEST
This commit is contained in:
committed by
Lorenz Meier
parent
31c08c7ffb
commit
568a5f1c4c
@@ -386,20 +386,6 @@ private:
|
||||
*/
|
||||
int self_test();
|
||||
|
||||
/**
|
||||
* Accel self test
|
||||
*
|
||||
* @return 0 on success, 1 on failure
|
||||
*/
|
||||
int accel_self_test();
|
||||
|
||||
/**
|
||||
* Gyro self test
|
||||
*
|
||||
* @return 0 on success, 1 on failure
|
||||
*/
|
||||
int gyro_self_test();
|
||||
|
||||
/*
|
||||
set low pass filter frequency
|
||||
*/
|
||||
@@ -1072,71 +1058,6 @@ MPU6000::self_test()
|
||||
return (perf_event_count(_sample_perf) > 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
int
|
||||
MPU6000::accel_self_test()
|
||||
{
|
||||
if (self_test()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
MPU6000::gyro_self_test()
|
||||
{
|
||||
if (self_test()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Maximum deviation of 20 degrees, according to
|
||||
* http://www.farnell.com/datasheets/1788002.pdf
|
||||
* Section 6.1, initial ZRO tolerance
|
||||
*
|
||||
* 20 dps (0.34 rad/s) initial offset
|
||||
* and 20 dps temperature drift, so 0.34 rad/s * 2
|
||||
*/
|
||||
const float max_offset = 2.0f * 0.34f;
|
||||
|
||||
/* 30% scale error is chosen to catch completely faulty units but
|
||||
* to let some slight scale error pass. Requires a rate table or correlation
|
||||
* with mag rotations + data fit to
|
||||
* calibrate properly and is not done by default.
|
||||
*/
|
||||
const float max_scale = 0.3f;
|
||||
|
||||
/* evaluate gyro offsets, complain if offset -> zero or larger than 20 dps. */
|
||||
if (fabsf(_gyro_scale.x_offset) > max_offset) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* evaluate gyro scale, complain if off by more than 30% */
|
||||
if (fabsf(_gyro_scale.x_scale - 1.0f) > max_scale) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fabsf(_gyro_scale.y_offset) > max_offset) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fabsf(_gyro_scale.y_scale - 1.0f) > max_scale) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fabsf(_gyro_scale.z_offset) > max_offset) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fabsf(_gyro_scale.z_scale - 1.0f) > max_scale) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
perform a self-test comparison to factory trim values. This takes
|
||||
about 200ms and will return OK if the current values are within 14%
|
||||
@@ -1485,9 +1406,6 @@ MPU6000::ioctl(struct file *filp, int cmd, unsigned long arg)
|
||||
case ACCELIOCGRANGE:
|
||||
return (unsigned long)((_accel_range_m_s2) / CONSTANTS_ONE_G + 0.5f);
|
||||
|
||||
case ACCELIOCSELFTEST:
|
||||
return accel_self_test();
|
||||
|
||||
case ACCELIOCGEXTERNAL:
|
||||
return _interface->ioctl(cmd, dummy);
|
||||
|
||||
@@ -1553,9 +1471,6 @@ MPU6000::gyro_ioctl(struct file *filp, int cmd, unsigned long arg)
|
||||
case GYROIOCGRANGE:
|
||||
return (unsigned long)(_gyro_range_rad_s * 180.0f / M_PI_F + 0.5f);
|
||||
|
||||
case GYROIOCSELFTEST:
|
||||
return gyro_self_test();
|
||||
|
||||
default:
|
||||
/* give it to the superclass */
|
||||
return CDev::ioctl(filp, cmd, arg);
|
||||
|
||||
Reference in New Issue
Block a user