Browse Source

Merge pull request #1647 from mavlink/hil_fixes

Hil fixes
QGC4.4
Don Gagne 10 years ago
parent
commit
d70464d857
  1. 2
      src/AutoPilotPlugins/AutoPilotPluginManager.cc
  2. 15
      src/comm/QGCXPlaneLink.cc
  3. 1
      src/uas/UASManager.cc
  4. 2
      src/uas/UASManagerInterface.h
  5. 9
      src/ui/MainWindow.cc
  6. 3
      src/ui/MainWindow.h
  7. 2
      src/ui/QGCHilConfiguration.cc

2
src/AutoPilotPlugins/AutoPilotPluginManager.cc

@ -40,7 +40,7 @@ AutoPilotPluginManager::AutoPilotPluginManager(QObject* parent) : @@ -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()

15
src/comm/QGCXPlaneLink.cc

@ -237,15 +237,16 @@ void QGCXPlaneLink::run() @@ -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

1
src/uas/UASManager.cc

@ -340,6 +340,7 @@ void UASManager::removeUAS(UASInterface* uas) @@ -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();
}
}

2
src/uas/UASManagerInterface.h

@ -98,6 +98,8 @@ signals: @@ -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 */

9
src/ui/MainWindow.cc

@ -796,6 +796,7 @@ void MainWindow::connectCommonActions() @@ -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) @@ -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)
{

3
src/ui/MainWindow.h

@ -146,6 +146,9 @@ public slots: @@ -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();

2
src/ui/QGCHilConfiguration.cc

@ -29,6 +29,8 @@ QGCHilConfiguration::QGCHilConfiguration(UAS *mav, QWidget *parent) : @@ -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)

Loading…
Cancel
Save