mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
OP-38 All current AHRS settings are now implemented in the config gadget. Made calibration procedure as foolproof as possible.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1423 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
fd9c4a8265
commit
e504ce0491
@ -59,13 +59,16 @@ Tip: lower is better!</string>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Press "Start" above to calibrate.</string>
|
||||
<string>Telemetry link not established.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ahrsCalibStart">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<x>440</x>
|
||||
<y>40</y>
|
||||
<width>93</width>
|
||||
<height>27</height>
|
||||
@ -115,6 +118,9 @@ Takes about 30 seconds max.</string>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select the sensor integration algorithm here.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
@ -153,6 +159,9 @@ Takes about 30 seconds max.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
@ -166,6 +175,9 @@ Takes about 30 seconds max.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
@ -179,6 +191,9 @@ Takes about 30 seconds max.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_6">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
@ -202,6 +217,9 @@ Takes about 30 seconds max.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
@ -223,6 +241,12 @@ Takes about 30 seconds max.</string>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Save settings to the OP board (RAM only).
|
||||
|
||||
This does not save the calibration settings, this is done using the
|
||||
specific calibration button on top of the screen.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save to RAM</string>
|
||||
</property>
|
||||
@ -236,6 +260,9 @@ Takes about 30 seconds max.</string>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Send settings to OP board, and save to the microSD card.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save to SD</string>
|
||||
</property>
|
||||
@ -249,6 +276,9 @@ Takes about 30 seconds max.</string>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Refresh this screen with current values from the board.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Request</string>
|
||||
</property>
|
||||
@ -279,25 +309,6 @@ Takes about 30 seconds max.</string>
|
||||
<string>Sensors calibration</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ahrsCalibSave">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>500</x>
|
||||
<y>40</y>
|
||||
<width>93</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Save is only enabled once the calibration is done ("Start" on the left)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="calibProgress">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <QtGui/QPushButton>
|
||||
|
||||
const double ConfigAHRSWidget::maxVarValue = 0.1;
|
||||
const int ConfigAHRSWidget::calibrationDelay = 15; // Time to wait for the AHRS to do its calibration
|
||||
|
||||
ConfigAHRSWidget::ConfigAHRSWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
{
|
||||
@ -172,7 +173,6 @@ ConfigAHRSWidget::ConfigAHRSWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
|
||||
// Connect the signals
|
||||
connect(m_ahrs->ahrsCalibStart, SIGNAL(clicked()), this, SLOT(launchAHRSCalibration()));
|
||||
connect(m_ahrs->ahrsCalibSave, SIGNAL(clicked()), this, SLOT(saveAHRSCalibration()));
|
||||
connect(m_ahrs->ahrsSettingsRequest, SIGNAL(clicked()), this, SLOT(ahrsSettingsRequest()));
|
||||
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(ahrsSettingsRequest()));
|
||||
@ -202,14 +202,14 @@ void ConfigAHRSWidget::launchAHRSCalibration()
|
||||
{
|
||||
m_ahrs->calibInstructions->setText("Calibration launched...");
|
||||
m_ahrs->ahrsCalibStart->setEnabled(false);
|
||||
m_ahrs->ahrsCalibSave->setEnabled(false);
|
||||
|
||||
UAVObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSCalibration")));
|
||||
UAVObjectField *field = obj->getField(QString("measure_var"));
|
||||
field->setValue("TRUE");
|
||||
obj->updated();
|
||||
|
||||
QTimer::singleShot(15000, this, SLOT(calibPhase2()));
|
||||
QTimer::singleShot(calibrationDelay*1000, this, SLOT(calibPhase2()));
|
||||
m_ahrs->calibProgress->setRange(0,calibrationDelay);
|
||||
phaseCounter = 0;
|
||||
progressBarIndex = 0;
|
||||
connect(&progressBarTimer, SIGNAL(timeout()), this, SLOT(incrementProgress()));
|
||||
@ -262,17 +262,17 @@ void ConfigAHRSWidget::calibPhase2()
|
||||
drawVariancesGraph();
|
||||
|
||||
// Now wait 15 more seconds before re-enabling the "Save" button
|
||||
QTimer::singleShot(15000, this, SLOT(calibPhase2()));
|
||||
m_ahrs->calibInstructions->setText(QString("Please review the results..."));
|
||||
QTimer::singleShot(calibrationDelay*1000, this, SLOT(calibPhase2()));
|
||||
m_ahrs->calibInstructions->setText(QString("Saving the results..."));
|
||||
progressBarIndex = 0;
|
||||
phaseCounter++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: // This step re-enables the "Save" button
|
||||
m_ahrs->calibInstructions->setText(QString("Press \"Save\" if OK."));
|
||||
case 3: // This step saves the configuration.
|
||||
saveAHRSCalibration();
|
||||
m_ahrs->calibInstructions->setText(QString("Calibration saved."));
|
||||
m_ahrs->ahrsCalibStart->setEnabled(true);
|
||||
m_ahrs->ahrsCalibSave->setEnabled(true);
|
||||
break;
|
||||
|
||||
}
|
||||
@ -280,7 +280,7 @@ void ConfigAHRSWidget::calibPhase2()
|
||||
}
|
||||
|
||||
/**
|
||||
Saves the AHRS sensors calibration (to RAM only)
|
||||
Saves the AHRS sensors calibration (to RAM and SD)
|
||||
*/
|
||||
void ConfigAHRSWidget::saveAHRSCalibration()
|
||||
{
|
||||
@ -288,6 +288,7 @@ void ConfigAHRSWidget::saveAHRSCalibration()
|
||||
UAVObjectField *field = obj->getField(QString("measure_var"));
|
||||
field->setValue("FALSE");
|
||||
obj->updated();
|
||||
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
|
||||
|
||||
}
|
||||
|
||||
@ -337,6 +338,8 @@ void ConfigAHRSWidget::ahrsSettingsRequest()
|
||||
UAVObjectField *field = obj->getField(QString("Algorithm"));
|
||||
m_ahrs->algorithm->setCurrentIndex(m_ahrs->algorithm->findText(field->getValue().toString()));
|
||||
drawVariancesGraph();
|
||||
m_ahrs->ahrsCalibStart->setEnabled(true);
|
||||
m_ahrs->calibInstructions->setText(QString("Press \"Start\" above to calibrate."));
|
||||
}
|
||||
|
||||
|
||||
@ -345,6 +348,10 @@ void ConfigAHRSWidget::ahrsSettingsRequest()
|
||||
*/
|
||||
void ConfigAHRSWidget::ahrsSettingsSaveRAM()
|
||||
{
|
||||
UAVObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSSettings")));
|
||||
UAVObjectField *field = obj->getField(QString("Algorithm"));
|
||||
field->setValue(m_ahrs->algorithm->currentText());
|
||||
obj->updated();
|
||||
|
||||
}
|
||||
|
||||
@ -354,5 +361,12 @@ void ConfigAHRSWidget::ahrsSettingsSaveRAM()
|
||||
*/
|
||||
void ConfigAHRSWidget::ahrsSettingsSaveSD()
|
||||
{
|
||||
|
||||
ahrsSettingsSaveRAM();
|
||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSSettings")));
|
||||
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
@}
|
||||
@}
|
||||
*/
|
||||
|
@ -64,6 +64,7 @@ private:
|
||||
int progressBarIndex;
|
||||
QTimer progressBarTimer;
|
||||
const static double maxVarValue;
|
||||
const static int calibrationDelay;
|
||||
|
||||
private slots:
|
||||
void launchAHRSCalibration();
|
||||
|
Loading…
x
Reference in New Issue
Block a user