Commit d70464d8 authored by Don Gagne's avatar Don Gagne

Merge pull request #1647 from mavlink/hil_fixes

Hil fixes
parents 87326b17 c6bf0de6
......@@ -40,7 +40,7 @@ AutoPilotPluginManager::AutoPilotPluginManager(QObject* parent) :
// We need to track uas coming and going so that we can instantiate plugins for each uas
connect(uasMgr, &UASManagerInterface::UASCreated, this, &AutoPilotPluginManager::_uasCreated);
connect(uasMgr, &UASManagerInterface::UASDeleted, this, &AutoPilotPluginManager::_uasDeleted);
connect(uasMgr, SIGNAL(UASDeleted(UASInterface*)), this, SLOT(_uasDeleted(UASInterface*)));
}
AutoPilotPluginManager::~AutoPilotPluginManager()
......
......@@ -237,15 +237,16 @@ void QGCXPlaneLink::run()
QGC::SLEEP::msleep(5);
}
if (mav)
uas = dynamic_cast<UAS*>(mav);
if (uas)
{
disconnect(mav, SIGNAL(hilControlsChanged(quint64, float, float, float, float, quint8, quint8)), this, SLOT(updateControls(quint64,float,float,float,float,quint8,quint8)));
disconnect(mav, SIGNAL(hilActuatorsChanged(quint64, float, float, float, float, float, float, float, float)), this, SLOT(updateActuators(quint64,float,float,float,float,float,float,float,float)));
disconnect(uas, SIGNAL(hilControlsChanged(quint64, float, float, float, float, quint8, quint8)), this, SLOT(updateControls(quint64,float,float,float,float,quint8,quint8)));
disconnect(uas, SIGNAL(hilActuatorsChanged(quint64, float, float, float, float, float, float, float, float)), this, SLOT(updateActuators(quint64,float,float,float,float,float,float,float,float)));
disconnect(this, SIGNAL(hilGroundTruthChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), mav, SLOT(sendHilGroundTruth(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)));
disconnect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)));
disconnect(this, SIGNAL(sensorHilGpsChanged(quint64,double,double,double,int,float,float,float,float,float,float,float,int)), mav, SLOT(sendHilGps(quint64,double,double,double,int,float,float,float,float,float,float,float,int)));
disconnect(this, SIGNAL(sensorHilRawImuChanged(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint32)), mav, SLOT(sendHilSensors(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint32)));
disconnect(this, SIGNAL(hilGroundTruthChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), uas, SLOT(sendHilGroundTruth(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)));
disconnect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), uas, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)));
disconnect(this, SIGNAL(sensorHilGpsChanged(quint64,double,double,double,int,float,float,float,float,float,float,float,int)), uas, SLOT(sendHilGps(quint64,double,double,double,int,float,float,float,float,float,float,float,int)));
disconnect(this, SIGNAL(sensorHilRawImuChanged(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint32)), uas, SLOT(sendHilSensors(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint32)));
// Do not toggle HIL state on the UAS - this is not the job of this link, but of the
// UAS object
......
......@@ -340,6 +340,7 @@ void UASManager::removeUAS(UASInterface* uas)
// Notify other UI elements that a UAS is being deleted before finally deleting it.
qDebug() << "Deleting UAS object: " << uas->getUASName();
emit UASDeleted(uas);
emit UASDeleted(uas->getUASID());
uas->deleteLater();
}
}
......
......@@ -98,6 +98,8 @@ signals:
void UASCreated(UASInterface* UAS);
/** A system was deleted */
void UASDeleted(UASInterface* UAS);
/** A system was deleted */
void UASDeleted(int systemId);
/** @brief The UAS currently under main operator control changed */
void activeUASSet(UASInterface* UAS);
/** @brief The UAS currently under main operator control changed */
......
......@@ -796,6 +796,7 @@ void MainWindow::connectCommonActions()
// Connect internal actions
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(UASCreated(UASInterface*)));
connect(UASManager::instance(), SIGNAL(UASDeleted(int)), this, SLOT(UASDeleted(int)));
// Unmanned System controls
connect(_ui.actionLiftoff, SIGNAL(triggered()), UASManager::instance(), SLOT(launchActiveUAS()));
......@@ -909,6 +910,14 @@ void MainWindow::UASCreated(UASInterface* uas)
}
}
void MainWindow::UASDeleted(int uasId)
{
if (_mapUasId2HilDockWidget.contains(uasId)) {
_mapUasId2HilDockWidget[uasId]->deleteLater();
_mapUasId2HilDockWidget.remove(uasId);
}
}
/// Stores the state of the toolbar, status bar and widgets associated with the current view
void MainWindow::_storeCurrentViewState(void)
{
......
......@@ -146,6 +146,9 @@ public slots:
/** @brief Add a new UAS */
void UASCreated(UASInterface* uas);
/** @brief Remove an old UAS */
void UASDeleted(int uasID);
void handleMisconfiguration(UASInterface* uas);
/** @brief Load configuration views */
void loadSetupView();
......
......@@ -29,6 +29,8 @@ QGCHilConfiguration::QGCHilConfiguration(UAS *mav, QWidget *parent) :
}
settings.endGroup();
connect(mav, SIGNAL(destroyed()), this, SLOT(deleteLater()));
}
void QGCHilConfiguration::receiveStatusMessage(const QString& message)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment