1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

OP-1351 add more helpful instruction to thermal calibration (end condition, estimated time, ...)

This commit is contained in:
Philippe Renon 2014-06-14 18:11:43 +02:00
parent 1e0028cc2f
commit 51bfb49e8c
4 changed files with 33 additions and 13 deletions

View File

@ -59,7 +59,12 @@ public slots:
{
m_helper->setProgressMax(0);
m_helper->setProgress(0);
m_helper->addInstructions(tr("Please wait during samples acquisition. This can take several minutes..."), WizardModel::Prompt);
m_helper->addInstructions(tr("Acquisition will run until the rate of temperature change is less than %1°C/min.").arg(ThermalCalibrationHelper::TargetGradient, 4, 'f', 2));
m_helper->addInstructions(tr("For the calibration to be valid, the temperature span during acquisition must be greater than %1°C.").arg(ThermalCalibrationHelper::TargetTempDelta, 4, 'f', 2));
m_helper->addInstructions(tr("Estimating calibration duration..."));
m_helper->initAcquisition();
}

View File

@ -44,7 +44,7 @@ ThermalCalibrationHelper::ThermalCalibrationHelper(QObject *parent) :
m_memento = Memento();
m_memento.statusSaved = false;
m_results = thermalCalibrationResults();
m_results = Results();
m_results.accelCalibrated = false;
m_results.gyroCalibrated = false;
m_results.baroCalibrated = false;
@ -199,6 +199,8 @@ void ThermalCalibrationHelper::initAcquisition()
m_targetduration = 0;
m_rangeReached = false;
m_forceStopAcquisition = false;
m_acquiring = true;
@ -311,8 +313,11 @@ void ThermalCalibrationHelper::calculate()
m_results.baroCalibrated = ThermalCalibration::BarometerCalibration(datax, datat, m_results.baro,
&m_results.baroInSigma, &m_results.baroOutSigma);
if (!m_results.baroCalibrated) {
if (m_results.baroCalibrated) {
addInstructions(tr("Barometer calibrated."), WizardModel::Warn);
} else {
qDebug() << "Failed to calibrate baro!";
addInstructions(tr("Failed to calibrate barometer!"), WizardModel::Warn);
}
m_results.baroTempMin = datat.array().minCoeff();
@ -334,8 +339,11 @@ void ThermalCalibrationHelper::calculate()
m_results.gyroCalibrated = ThermalCalibration::GyroscopeCalibration(datax, datay, dataz, datat, m_results.gyro,
m_results.gyroInSigma, m_results.gyroOutSigma);
if (!m_results.gyroCalibrated) {
if (m_results.gyroCalibrated) {
addInstructions(tr("Gyro calibrated."), WizardModel::Warn);
} else {
qDebug() << "Failed to calibrate gyro!";
addInstructions(tr("Failed to calibrate gyro!"), WizardModel::Warn);
}
// accel
@ -396,6 +404,10 @@ void ThermalCalibrationHelper::updateTemperature(float temp)
if (m_temperature > m_maxTemperature) {
m_maxTemperature = m_temperature;
}
if (!m_rangeReached && (range() >= TargetTempDelta)) {
m_rangeReached = true;
addInstructions(tr("Target temperature span has been acquired. You may now end acquisition or continue."));
}
emit temperatureRangeChanged(range());
if (secondsSinceLastCheck > TimeBetweenCheckpoints) {
@ -426,8 +438,8 @@ void ThermalCalibrationHelper::updateTemperature(float temp)
setProgressMax(100);
QTime time = QTime(0, 0).addSecs(m_targetduration);
QString timeString = time.toString(tr("m'''s''''"));
addInstructions(tr("Estimated duration: %1").arg(timeString));
QString timeString = time.toString(tr("m''''s'''''"));
addInstructions(tr("Estimated acquisition duration is %1.").arg(timeString));
QString str = QStringLiteral("INFO::Trace gradient : %1, elapsed : %2 initial gradient : %3, target : %4")
.arg(m_gradient).arg(elapsed).arg(m_initialGradient).arg(m_targetduration);

View File

@ -86,12 +86,15 @@ typedef struct {
float baroTempMax;
float accelGyroTempMin;
float accelGyroTempMax;
} thermalCalibrationResults;
} Results;
class ThermalCalibrationHelper : public QObject {
Q_OBJECT
public:
const static float TargetGradient = 0.20f;
const static float TargetTempDelta = 10.0f;
explicit ThermalCalibrationHelper(QObject *parent = 0);
float temperature()
@ -243,12 +246,11 @@ private:
int m_targetduration;
bool m_rangeReached;
int m_progress;
int m_progressMax;
const static float TargetGradient = 0.20f;
const static float TargetTempDelta = 10.0f;
// convenience pointers
AccelSensor *accelSensor;
GyroSensor *gyroSensor;
@ -270,7 +272,7 @@ private:
m_memento.statusSaved = false;
}
Memento m_memento;
thermalCalibrationResults m_results;
Results m_results;
void setMetadataForCalibration(UAVDataObject *uavo);
UAVObjectManager *getObjectManager();

View File

@ -271,6 +271,7 @@ void ConfigRevoWidget::clearInstructions()
void ConfigRevoWidget::addInstructions(QString text, WizardModel::MessageType type)
{
QString msg;
switch (type) {
case WizardModel::Debug:
#ifdef DEBUG
@ -318,17 +319,17 @@ static QString format(float v)
void ConfigRevoWidget::displayTemperature(float temperature)
{
m_ui->temperatureLabel->setText(tr("Temperature: %1 °C").arg(format(temperature)));
m_ui->temperatureLabel->setText(tr("Temperature: %1°C").arg(format(temperature)));
}
void ConfigRevoWidget::displayTemperatureGradient(float temperatureGradient)
{
m_ui->temperatureGradientLabel->setText(tr("Variance: %1 °C/min").arg(format(temperatureGradient)));
m_ui->temperatureGradientLabel->setText(tr("Variance: %1°C/min").arg(format(temperatureGradient)));
}
void ConfigRevoWidget::displayTemperatureRange(float temperatureRange)
{
m_ui->temperatureRangeLabel->setText(tr("Acquisition range: %1 °C").arg(format(temperatureRange)));
m_ui->temperatureRangeLabel->setText(tr("Sampled range: %1°C").arg(format(temperatureRange)));
}
/**