mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-01 18:29:16 +01:00
OP-38 Ground/Config Gadget : another try at making AHRS settings more intuitive. And the Object queue now works (...)
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1558 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
b5608ed2ac
commit
b53f19dc03
@ -182,31 +182,39 @@ Hint: run this with engines at cruising speed.</string>
|
||||
<string>Six Point Calibration instructions</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="homeLocation">
|
||||
<widget class="QRadioButton" name="homeLocationSet">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<x>480</x>
|
||||
<y>361</y>
|
||||
<width>201</width>
|
||||
<width>51</width>
|
||||
<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>
|
||||
successful.
|
||||
|
||||
Disabled if there is no GPS fix.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save Home Location to SD</string>
|
||||
<string>Set</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string>buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ahrsSettingsRequest">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<x>280</x>
|
||||
<y>430</y>
|
||||
<width>93</width>
|
||||
<height>27</height>
|
||||
@ -303,13 +311,13 @@ Only makes sense with the "INSGPS" algorithm.</string>
|
||||
<string>Indoor flight mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="ahrsSettingsSaveRAM">
|
||||
<widget class="QPushButton" name="ahrsSettingsSaveRAM">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>430</y>
|
||||
<width>111</width>
|
||||
<height>21</height>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
@ -321,17 +329,14 @@ specific calibration button on top of the screen.</string>
|
||||
<property name="text">
|
||||
<string>Save to RAM</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string>buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="ahrsSettingsSaveSD">
|
||||
<widget class="QPushButton" name="ahrsSettingsSaveSD">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>520</x>
|
||||
<y>430</y>
|
||||
<width>101</width>
|
||||
<height>21</height>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
@ -341,12 +346,46 @@ specific calibration button on top of the screen.</string>
|
||||
<string>Save to SD</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="homeLocationClear">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>550</x>
|
||||
<y>360</y>
|
||||
<width>71</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clears the HomeLocation: only makes sense if you save
|
||||
to SD. This will force the AHRS to use the next GPS fix as the
|
||||
new home location unless it is in indoor mode.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string>buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>360</y>
|
||||
<width>101</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Home Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
@ -188,13 +188,13 @@ ConfigAHRSWidget::ConfigAHRSWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
// 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()));
|
||||
@ -628,10 +628,6 @@ 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();
|
||||
@ -646,17 +642,12 @@ void ConfigAHRSWidget::ahrsSettingsRequest()
|
||||
m_ahrs->indoorFlight->setChecked(field->getValue().toBool());
|
||||
field = obj->getField(QString("Set"));
|
||||
if (field)
|
||||
m_ahrs->homeLocation->setEnabled(field->getValue().toBool());
|
||||
m_ahrs->homeLocationSet->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()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -666,8 +657,9 @@ void ConfigAHRSWidget::ahrsSettingsRequest()
|
||||
void ConfigAHRSWidget::enableHomeLocSave(UAVObject * obj)
|
||||
{
|
||||
UAVObjectField *field = obj->getField(QString("Set"));
|
||||
if (field)
|
||||
m_ahrs->homeLocation->setEnabled(field->getValue().toBool());
|
||||
if (field) {
|
||||
m_ahrs->homeLocationSet->setEnabled(field->getValue().toBool());
|
||||
}
|
||||
// While we're at it, ensure the 'indoor' flag is consistent:
|
||||
field = obj->getField(QString("Indoor"));
|
||||
if (field)
|
||||
@ -676,42 +668,40 @@ void ConfigAHRSWidget::enableHomeLocSave(UAVObject * obj)
|
||||
|
||||
|
||||
/**
|
||||
Save current settings to SD or RAM (depending on radio button)
|
||||
Save current settings to RAM
|
||||
*/
|
||||
void ConfigAHRSWidget::ahrsSettingsSave()
|
||||
void ConfigAHRSWidget::ahrsSettingsSaveRAM()
|
||||
{
|
||||
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"));
|
||||
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("HomeLocation")));
|
||||
field = obj->getField(QString("Indoor"));
|
||||
if (m_ahrs->indoorFlight->isChecked())
|
||||
field->setValue(QString("TRUE"));
|
||||
else
|
||||
field->setValue(QString("FALSE"));
|
||||
field = obj->getField(QString("Set"));
|
||||
if (m_ahrs->homeLocationSet->isChecked())
|
||||
field->setValue(QString("TRUE"));
|
||||
else
|
||||
field->setValue(QString("FALSE"));
|
||||
obj->updated();
|
||||
if (m_ahrs->ahrsSettingsSaveSD->isChecked())
|
||||
saveObjectToSD(obj);
|
||||
// updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Force save Home Location settings to SD
|
||||
Save AHRS Settings and home location to SD
|
||||
*/
|
||||
void ConfigAHRSWidget::homeLocationSaveSD()
|
||||
void ConfigAHRSWidget::ahrsSettingsSaveSD()
|
||||
{
|
||||
ahrsSettingsSaveRAM();
|
||||
UAVDataObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("HomeLocation")));
|
||||
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
|
||||
saveObjectToSD(obj);
|
||||
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSSettings")));
|
||||
saveObjectToSD(obj);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,9 +99,8 @@ private slots:
|
||||
void calibPhase2();
|
||||
void incrementProgress();
|
||||
void ahrsSettingsRequest();
|
||||
void ahrsSettingsSave();
|
||||
void homeLocationSave();
|
||||
void homeLocationSaveSD(); // forces save to SD
|
||||
void ahrsSettingsSaveRAM();
|
||||
void ahrsSettingsSaveSD();
|
||||
void savePositionData();
|
||||
void computeScaleBias();
|
||||
void sixPointCalibrationMode();
|
||||
|
@ -57,7 +57,7 @@ void ConfigTaskWidget::saveNextObject()
|
||||
return;
|
||||
}
|
||||
// Get next object from the queue
|
||||
UAVObject* obj = queue.dequeue();
|
||||
UAVObject* obj = queue.head();
|
||||
ObjectPersistence* objper = dynamic_cast<ObjectPersistence*>( getObjectManager()->getObject(ObjectPersistence::NAME) );
|
||||
connect(objper, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(transactionCompleted(UAVObject*,bool)));
|
||||
if (obj != NULL)
|
||||
@ -77,6 +77,7 @@ void ConfigTaskWidget::transactionCompleted(UAVObject* obj, bool success)
|
||||
Q_UNUSED(success);
|
||||
// Disconnect from sending object
|
||||
obj->disconnect(this);
|
||||
queue.dequeue(); // We can now remove the object, it's done.
|
||||
saveNextObject();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user