1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

Increase accel bias samples to 60. Add debuging output if enabled during calibration. Add check for the possibility of multiple signals arriving before slot is disconnected and causing bias to be calculated incorrectly.

This commit is contained in:
David Carlson 2011-05-09 02:55:05 -07:00
parent b0baee3d17
commit b89909756c
2 changed files with 11 additions and 4 deletions

View File

@ -63,7 +63,9 @@ void ConfigCCAttitudeWidget::attitudeRawUpdated(UAVObject * obj) {
x_accum.append(field->getDouble(0));
y_accum.append(field->getDouble(1));
z_accum.append(field->getDouble(2));
} else {
qDebug("update %d: %f, %f, %f\n",updates,field->getDouble(0),field->getDouble(1),field->getDouble(2));
} else if ( updates == NUM_ACCEL_UPDATES ) {
updates++;
timer.stop();
disconnect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(attitudeRawUpdated(UAVObject*)));
disconnect(&timer,SIGNAL(timeout()),this,SLOT(timeout()));
@ -79,9 +81,14 @@ void ConfigCCAttitudeWidget::attitudeRawUpdated(UAVObject * obj) {
field->setDouble(field->getDouble(0) + x_bias,0);
field->setDouble(field->getDouble(1) + y_bias,1);
field->setDouble(field->getDouble(2) + z_bias,2);
qDebug("New X bias: %f\n", field->getDouble(0)+x_bias);
qDebug("New Y bias: %f\n", field->getDouble(1)+y_bias);
qDebug("New Z bias: %f\n", field->getDouble(2)+z_bias);
settings->updated();
ui->status->setText("Calibration done.");
} else {
// Possible to get here if weird threading stuff happens. Just ignore updates.
qDebug("Unexpected accel update received.");
}
}
@ -135,7 +142,7 @@ void ConfigCCAttitudeWidget::startAccelCalibration() {
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(attitudeRawUpdated(UAVObject*)));
// Set up timeout timer
timer.start(2000);
timer.start(10000);
connect(&timer,SIGNAL(timeout()),this,SLOT(timeout()));
// Speed up updates

View File

@ -64,7 +64,7 @@ private:
QList<double> x_accum, y_accum, z_accum;
static const int NUM_ACCEL_UPDATES = 10;
static const int NUM_ACCEL_UPDATES = 60;
static const float ACCEL_SCALE = 0.004f * 9.81f;
};