From 6ba529958d572d0a59449a4141df27f2ab726917 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 24 May 2014 18:50:41 +0200 Subject: [PATCH] Threading fixes --- src/uas/UAS.cc | 24 ++++++++++-------------- src/ui/MainWindow.cc | 3 ++- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index c018e4f95..a338d43cb 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -138,7 +138,7 @@ UAS::UAS(MAVLinkProtocol* protocol, QThread* thread, int id) : UASInterface(), airSpeed(std::numeric_limits::quiet_NaN()), groundSpeed(std::numeric_limits::quiet_NaN()), - waypointManager(), + waypointManager(this), attitudeKnown(false), attitudeStamped(false), @@ -153,7 +153,7 @@ UAS::UAS(MAVLinkProtocol* protocol, QThread* thread, int id) : UASInterface(), paramsOnceRequested(false), - paramMgr(), + paramMgr(this), simulation(0), // The protected members. @@ -168,9 +168,6 @@ UAS::UAS(MAVLinkProtocol* protocol, QThread* thread, int id) : UASInterface(), _thread(thread) { moveToThread(thread); - waypointManager.moveToThread(thread); - paramMgr.moveToThread(thread); - statusTimeout.moveToThread(thread); for (unsigned int i = 0; i<255;++i) { @@ -196,42 +193,42 @@ UAS::UAS(MAVLinkProtocol* protocol, QThread* thread, int id) : UASInterface(), connect(newAction, SIGNAL(triggered()), this, SLOT(toggleAutonomy())); actions.append(newAction); - newAction = new QAction(tr("Go home"), this); + newAction = new QAction(tr("Go home"), thread); newAction->setToolTip(tr("Command the UAS to return to its home position")); connect(newAction, SIGNAL(triggered()), this, SLOT(home())); actions.append(newAction); - newAction = new QAction(tr("Land"), this); + newAction = new QAction(tr("Land"), thread); newAction->setToolTip(tr("Command the UAS to land")); connect(newAction, SIGNAL(triggered()), this, SLOT(land())); actions.append(newAction); - newAction = new QAction(tr("Launch"), this); + newAction = new QAction(tr("Launch"), thread); newAction->setToolTip(tr("Command the UAS to launch itself and begin its mission")); connect(newAction, SIGNAL(triggered()), this, SLOT(launch())); actions.append(newAction); - newAction = new QAction(tr("Resume"), this); + newAction = new QAction(tr("Resume"), thread); newAction->setToolTip(tr("Command the UAS to continue its mission")); connect(newAction, SIGNAL(triggered()), this, SLOT(go())); actions.append(newAction); - newAction = new QAction(tr("Stop"), this); + newAction = new QAction(tr("Stop"), thread); newAction->setToolTip(tr("Command the UAS to halt and hold position")); connect(newAction, SIGNAL(triggered()), this, SLOT(halt())); actions.append(newAction); - newAction = new QAction(tr("Go autonomous"), this); + newAction = new QAction(tr("Go autonomous"), thread); newAction->setToolTip(tr("Set the UAS into an autonomous control mode")); connect(newAction, SIGNAL(triggered()), this, SLOT(goAutonomous())); actions.append(newAction); - newAction = new QAction(tr("Go manual"), this); + newAction = new QAction(tr("Go manual"), thread); newAction->setToolTip(tr("Set the UAS into a manual control mode")); connect(newAction, SIGNAL(triggered()), this, SLOT(goManual())); actions.append(newAction); - newAction = new QAction(tr("Toggle autonomy"), this); + newAction = new QAction(tr("Toggle autonomy"), thread); newAction->setToolTip(tr("Toggle between manual and full-autonomy")); connect(newAction, SIGNAL(triggered()), this, SLOT(toggleAutonomy())); actions.append(newAction); @@ -373,7 +370,6 @@ void UAS::updateState() GAudioOutput::instance()->notifyNegative(); } } - qDebug() << "UPDATE STATE:" << (heartbeatInterval / 1000) << "milliseconds, LOST:" << connectionLost; } /** diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 70a7e9a0e..da0a84964 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -760,6 +760,7 @@ void MainWindow::loadDockWidget(const QString& name) { if(menuActionHelper->containsDockWidget(currentView, name)) return; + if (name.startsWith("HIL_CONFIG")) { //It's a HIL widget. @@ -826,7 +827,7 @@ void MainWindow::loadDockWidget(const QString& name) } else if (name == "HEAD_UP_DISPLAY_DOCKWIDGET") { - createDockWidget(centerStack->currentWidget(),new HUD(320,240,this),tr("Head Up Display"),"HEAD_UP_DISPLAY_DOCKWIDGET",currentView,Qt::RightDockWidgetArea); + createDockWidget(centerStack->currentWidget(),new HUD(320,240,this),tr("Video Downlink"),"HEAD_UP_DISPLAY_DOCKWIDGET",currentView,Qt::RightDockWidgetArea); } else if (name == "UAS_INFO_QUICKVIEW_DOCKWIDGET") { -- 2.22.0