mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-01 18:29:16 +01:00
OP-38 Ground/Config gadget: AHRS indoor mode works, as well as Home Location saving.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1554 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
c2e93aa810
commit
0af3d26981
@ -75,7 +75,7 @@ Tip: lower is better!</string>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Press to start a calibration procedure, takes 30 seconds max.
|
||||
<string>Press to start a calibration procedure, about 15 seconds.
|
||||
|
||||
Hint: run this with engines at cruising speed.</string>
|
||||
</property>
|
||||
@ -119,7 +119,9 @@ Hint: run this with engines at cruising speed.</string>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select the sensor integration algorithm here.</string>
|
||||
<string>Select the sensor integration algorithm here.
|
||||
"Simple" only uses accelerometer values
|
||||
"INSGPS" the full featured algorithm integrating all sensors</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGraphicsView" name="sixPointsHelp">
|
||||
@ -131,6 +133,9 @@ Hint: run this with engines at cruising speed.</string>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Nice paper plane, eh?</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
@ -157,6 +162,9 @@ Hint: run this with engines at cruising speed.</string>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Launch a sensor range and bias calibration.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
@ -170,62 +178,35 @@ Hint: run this with engines at cruising speed.</string>
|
||||
<height>121</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Six Point Calibration instructions</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="homeLocation">
|
||||
<widget class="QPushButton" name="homeLocation">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>370</y>
|
||||
<x>380</x>
|
||||
<y>361</y>
|
||||
<width>201</width>
|
||||
<height>22</height>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Saves the Home Location. This is only enabled
|
||||
if the Home Location is set, i.e. if the GPS fix is
|
||||
successful.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save Home Location to SD</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ahrsSettingsSaveRAM">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>430</x>
|
||||
<y>430</y>
|
||||
<width>93</width>
|
||||
<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>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ahrsSettingsSaveSD">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>430</y>
|
||||
<width>93</width>
|
||||
<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>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ahrsSettingsRequest">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<x>260</x>
|
||||
<y>430</y>
|
||||
<width>93</width>
|
||||
<height>27</height>
|
||||
@ -242,7 +223,7 @@ specific calibration button on top of the screen.</string>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>350</y>
|
||||
<y>340</y>
|
||||
<width>411</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
@ -298,6 +279,9 @@ specific calibration button on top of the screen.</string>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Save settings (only enabled when calibration is running)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save Position</string>
|
||||
</property>
|
||||
@ -305,18 +289,69 @@ specific calibration button on top of the screen.</string>
|
||||
<widget class="QCheckBox" name="indoorFlight">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<x>380</x>
|
||||
<y>400</y>
|
||||
<width>201</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Check this box if you are flying indoors and have no GPS fix.
|
||||
Only makes sense with the "INSGPS" algorithm.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Indoor flight mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="ahrsSettingsSaveRAM">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>430</y>
|
||||
<width>111</width>
|
||||
<height>21</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>
|
||||
<attribute name="buttonGroup">
|
||||
<string>buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="ahrsSettingsSaveSD">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>520</x>
|
||||
<y>430</y>
|
||||
<width>101</width>
|
||||
<height>21</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>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string>buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
@ -181,12 +181,20 @@ ConfigAHRSWidget::ConfigAHRSWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
UAVObjectField *field = obj->getField(QString("Algorithm"));
|
||||
m_ahrs->algorithm->addItems(field->getOptions());
|
||||
|
||||
// Register for Home Location state changes
|
||||
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("HomeLocation")));
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this , SLOT(enableHomeLocSave(UAVObject*)));
|
||||
|
||||
// Connect the signals
|
||||
connect(m_ahrs->ahrsCalibStart, SIGNAL(clicked()), this, SLOT(launchAHRSCalibration()));
|
||||
connect(m_ahrs->ahrsSettingsRequest, SIGNAL(clicked()), this, SLOT(ahrsSettingsRequest()));
|
||||
connect(m_ahrs->algorithm, SIGNAL(currentIndexChanged(int)), this, SLOT(ahrsSettingsSave()));
|
||||
connect(m_ahrs->indoorFlight, SIGNAL(stateChanged(int)), this, SLOT(homeLocationSave()));
|
||||
connect(m_ahrs->homeLocation, SIGNAL(clicked()), this, SLOT(homeLocationSaveSD()));
|
||||
/*
|
||||
connect(m_ahrs->ahrsSettingsSaveRAM, SIGNAL(clicked()), this, SLOT(ahrsSettingsSaveRAM()));
|
||||
connect(m_ahrs->ahrsSettingsSaveSD, SIGNAL(clicked()), this, SLOT(ahrsSettingsSaveSD()));
|
||||
*/
|
||||
connect(m_ahrs->sixPointsStart, SIGNAL(clicked()), this, SLOT(sixPointCalibrationMode()));
|
||||
connect(m_ahrs->sixPointsSave, SIGNAL(clicked()), this, SLOT(savePositionData()));
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(ahrsSettingsRequest()));
|
||||
@ -620,6 +628,11 @@ void ConfigAHRSWidget::drawVariancesGraph()
|
||||
*/
|
||||
void ConfigAHRSWidget::ahrsSettingsRequest()
|
||||
{
|
||||
// First of all, disconnect the autosave signals otherwise the GCS will save
|
||||
// the settings as soon as it gets them, which is stupid
|
||||
disconnect(m_ahrs->algorithm, SIGNAL(currentIndexChanged(int)), this, SLOT(ahrsSettingsSave()));
|
||||
disconnect(m_ahrs->indoorFlight, SIGNAL(stateChanged(int)), this, SLOT(homeLocationSave()));
|
||||
|
||||
UAVObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSSettings")));
|
||||
obj->requestUpdate();
|
||||
UAVObjectField *field = obj->getField(QString("Algorithm"));
|
||||
@ -629,38 +642,78 @@ void ConfigAHRSWidget::ahrsSettingsRequest()
|
||||
|
||||
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("HomeLocation")));
|
||||
field = obj->getField(QString("Indoor"));
|
||||
if (field)
|
||||
m_ahrs->indoorFlight->setChecked(field->getValue().toBool());
|
||||
field = obj->getField(QString("Set"));
|
||||
if (field)
|
||||
m_ahrs->homeLocation->setEnabled(field->getValue().toBool());
|
||||
|
||||
m_ahrs->ahrsCalibStart->setEnabled(true);
|
||||
m_ahrs->sixPointsStart->setEnabled(true);
|
||||
m_ahrs->calibInstructions->setText(QString("Press \"Start\" above to calibrate."));
|
||||
|
||||
// ... and reconnect
|
||||
connect(m_ahrs->algorithm, SIGNAL(currentIndexChanged(int)), this, SLOT(ahrsSettingsSave()));
|
||||
connect(m_ahrs->indoorFlight, SIGNAL(stateChanged(int)), this, SLOT(homeLocationSave()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Enables/disables the Home Location saving button depending on whether the
|
||||
home location is set-able
|
||||
*/
|
||||
void ConfigAHRSWidget::enableHomeLocSave(UAVObject * obj)
|
||||
{
|
||||
UAVObjectField *field = obj->getField(QString("Set"));
|
||||
if (field)
|
||||
m_ahrs->homeLocation->setEnabled(field->getValue().toBool());
|
||||
// While we're at it, ensure the 'indoor' flag is consistent:
|
||||
field = obj->getField(QString("Indoor"));
|
||||
if (field)
|
||||
m_ahrs->indoorFlight->setChecked(field->getValue().toBool());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Save current settings to RAM (besides the Calibration data)
|
||||
Save current settings to SD or RAM (depending on radio button)
|
||||
*/
|
||||
void ConfigAHRSWidget::ahrsSettingsSaveRAM()
|
||||
void ConfigAHRSWidget::ahrsSettingsSave()
|
||||
{
|
||||
UAVObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSSettings")));
|
||||
UAVDataObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSSettings")));
|
||||
UAVObjectField *field = obj->getField(QString("Algorithm"));
|
||||
field->setValue(m_ahrs->algorithm->currentText());
|
||||
obj->updated();
|
||||
|
||||
if (m_ahrs->ahrsSettingsSaveSD->isChecked())
|
||||
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
Save Home Location settings to SD or RAM (depending on radio button)
|
||||
*/
|
||||
void ConfigAHRSWidget::homeLocationSave()
|
||||
{
|
||||
UAVDataObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("HomeLocation")));
|
||||
UAVObjectField *field = obj->getField(QString("Indoor"));
|
||||
if (m_ahrs->indoorFlight->isChecked())
|
||||
field->setValue(QString("TRUE"));
|
||||
else
|
||||
field->setValue(QString("FALSE"));
|
||||
obj->updated();
|
||||
if (m_ahrs->ahrsSettingsSaveSD->isChecked())
|
||||
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
Save current settings to SD (besides the Calibration data)
|
||||
Force save Home Location settings to SD
|
||||
*/
|
||||
void ConfigAHRSWidget::ahrsSettingsSaveSD()
|
||||
void ConfigAHRSWidget::homeLocationSaveSD()
|
||||
{
|
||||
ahrsSettingsSaveRAM();
|
||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSSettings")));
|
||||
UAVDataObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("HomeLocation")));
|
||||
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@}
|
||||
@}
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
private:
|
||||
void drawVariancesGraph();
|
||||
void displayPlane(QString elementID);
|
||||
|
||||
Ui_AHRSWidget *m_ahrs;
|
||||
QGraphicsSvgItem *paperplane;
|
||||
QGraphicsSvgItem *ahrsbargraph;
|
||||
@ -90,14 +91,17 @@ private:
|
||||
QString initialUpdateFiltered;
|
||||
|
||||
double listMean(QList<double> list);
|
||||
|
||||
private slots:
|
||||
void enableHomeLocSave(UAVObject *obj);
|
||||
void launchAHRSCalibration();
|
||||
void saveAHRSCalibration();
|
||||
void calibPhase2();
|
||||
void incrementProgress();
|
||||
void ahrsSettingsRequest();
|
||||
void ahrsSettingsSaveRAM();
|
||||
void ahrsSettingsSaveSD();
|
||||
void ahrsSettingsSave();
|
||||
void homeLocationSave();
|
||||
void homeLocationSaveSD(); // forces save to SD
|
||||
void savePositionData();
|
||||
void computeScaleBias();
|
||||
void sixPointCalibrationMode();
|
||||
|
Loading…
x
Reference in New Issue
Block a user