1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

OP-1150: second order polynomial for all gyro axis.

This commit is contained in:
Alessio Morale 2014-02-06 00:59:42 +01:00
parent df2bb8eb84
commit 8a3e737cd8
4 changed files with 14 additions and 8 deletions

View File

@ -99,7 +99,9 @@ bool ThermalCalibration::GyroscopeCalibration(Eigen::VectorXf samplesX, Eigen::V
if (!CalibrationUtils::PolynomialCalibration(&temperature, &samplesX, GYRO_X_POLY_DEGREE, solution, GYRO_X_MAX_REL_ERROR)) {
return false;
}
result[0] = solution[1];
result[1] = solution[2];
solution[0] = 0;
ComputeStats(&temperature, &samplesX, &solution, &inputSigma[0], &calibratedSigma[0]);
@ -108,7 +110,8 @@ bool ThermalCalibration::GyroscopeCalibration(Eigen::VectorXf samplesX, Eigen::V
if (!CalibrationUtils::PolynomialCalibration(&temperature, &samplesY, GYRO_Y_POLY_DEGREE, solution, GYRO_Y_MAX_REL_ERROR)) {
return false;
}
result[1] = solution[1];
result[2] = solution[1];
result[3] = solution[2];
solution[0] = 0;
ComputeStats(&temperature, &samplesY, &solution, &inputSigma[1], &calibratedSigma[1]);
@ -116,8 +119,8 @@ bool ThermalCalibration::GyroscopeCalibration(Eigen::VectorXf samplesX, Eigen::V
if (!CalibrationUtils::PolynomialCalibration(&temperature, &samplesZ, GYRO_Z_POLY_DEGREE, solution, GYRO_Z_MAX_REL_ERROR)) {
return false;
}
result[2] = solution[1];
result[3] = solution[2];
result[4] = solution[1];
result[5] = solution[2];
solution[0] = 0;
std::cout << solution << std::endl;
ComputeStats(&temperature, &samplesZ, &solution, &inputSigma[2], &calibratedSigma[2]);

View File

@ -31,8 +31,8 @@
namespace OpenPilot {
class ThermalCalibration {
static const int GYRO_X_POLY_DEGREE = 1;
static const int GYRO_Y_POLY_DEGREE = 1;
static const int GYRO_X_POLY_DEGREE = 2;
static const int GYRO_Y_POLY_DEGREE = 2;
static const int GYRO_Z_POLY_DEGREE = 2;
static const int ACCEL_X_POLY_DEGREE = 1;

View File

@ -383,8 +383,9 @@ void ThermalCalibrationHelper::calculate()
str += QStringLiteral("INFO::Baro cal {%1, %2, %3, %4}; initial variance: %5; Calibrated variance %6")
.arg(m_results.baro[0]).arg(m_results.baro[1]).arg(m_results.baro[2]).arg(m_results.baro[3])
.arg(m_results.baroInSigma).arg(m_results.baroOutSigma) + QChar::CarriageReturn;
str += QStringLiteral("INFO::Gyro cal x{%1} y{%2} z{%3, %4}; initial variance: {%5, %6, %7}; Calibrated variance {%8, %9, %10}")
.arg(m_results.gyro[0]).arg(m_results.gyro[1]).arg(m_results.gyro[2]).arg(m_results.baro[3])
str += QStringLiteral("INFO::Gyro cal x{%1, %2} y{%3, %4} z{%5, %6}; initial variance: {%7, %8, %9}; Calibrated variance {%10, %11, %12}")
.arg(m_results.gyro[0]).arg(m_results.gyro[1]).arg(m_results.gyro[2])
.arg(m_results.gyro[3]).arg(m_results.gyro[4]).arg(m_results.gyro[5])
.arg(m_results.gyroInSigma[0]).arg(m_results.gyroInSigma[1]).arg(m_results.gyroInSigma[2])
.arg(m_results.gyroOutSigma[0]).arg(m_results.gyroOutSigma[1]).arg(m_results.gyroOutSigma[2]) + QChar::CarriageReturn;
str += QStringLiteral("INFO::Accel cal x{%1} y{%2} z{%3}; initial variance: {%4, %5, %6}; Calibrated variance {%7, %8, %9}")
@ -557,6 +558,8 @@ void ThermalCalibrationHelper::copyResultToSettings()
data.gyro_temp_coeff[1] = m_results.gyro[1];
data.gyro_temp_coeff[2] = m_results.gyro[2];
data.gyro_temp_coeff[3] = m_results.gyro[3];
data.gyro_temp_coeff[4] = m_results.gyro[4];
data.gyro_temp_coeff[5] = m_results.gyro[5];
}
if (m_results.accelCalibrated) {

View File

@ -70,7 +70,7 @@ typedef struct {
bool accelCalibrated;
float accel[3];
bool gyroCalibrated;
float gyro[4];
float gyro[6];
float baroInSigma;
float baroOutSigma;