From ffe57cb7053075ac0c8ce3a096e598da921b1dc9 Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Wed, 3 Oct 2012 23:31:53 +0200 Subject: [PATCH] (re)enabled xplane hil (flightgear hil and xplane hil should both work) --- src/uas/UAS.cc | 21 +++++++++++++++++++-- src/uas/UAS.h | 4 +++- src/ui/uas/UASView.cc | 4 ++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index ccf5877b7..cfe62c783 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -97,7 +97,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), paramManager(NULL), attitudeStamped(false), lastAttitude(0), - simulation(new QGCFlightGearLink(this)), + simulation(new QGCXPlaneLink(this)), isLocalPositionKnown(false), isGlobalPositionKnown(false), systemIsArmed(false), @@ -2592,7 +2592,24 @@ bool UAS::emergencyKILL() /** * If enabled, connect the fligth gear link. */ -void UAS::enableHil(bool enable) +void UAS::enableHilFlightGear(bool enable) +{ + // Connect Flight Gear Link + if (enable) + { + simulation = new QGCFlightGearLink(this); + startHil(); + } + else + { + stopHil(); + } +} + +/** +* If enabled, connect the fligth gear link. +*/ +void UAS::enableHilXPlane(bool enable) { // Connect Flight Gear Link if (enable) diff --git a/src/uas/UAS.h b/src/uas/UAS.h index fe37b2c74..e56a58a6a 100644 --- a/src/uas/UAS.h +++ b/src/uas/UAS.h @@ -528,7 +528,9 @@ public slots: void go(); /** @brief Enable / disable HIL */ - void enableHil(bool enable); + void enableHilFlightGear(bool enable); + void enableHilXPlane(bool enable); + /** @brief Send the full HIL state to the MAV */ diff --git a/src/ui/uas/UASView.cc b/src/ui/uas/UASView.cc index 816dc416b..f1429795c 100644 --- a/src/ui/uas/UASView.cc +++ b/src/ui/uas/UASView.cc @@ -122,8 +122,8 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : connect(removeAction, SIGNAL(triggered()), this, SLOT(deleteLater())); connect(renameAction, SIGNAL(triggered()), this, SLOT(rename())); connect(selectAction, SIGNAL(triggered()), uas, SLOT(setSelected())); - connect(hilAction, SIGNAL(triggered(bool)), uas, SLOT(enableHil(bool))); - connect(hilXAction, SIGNAL(triggered(bool)), uas, SLOT(enableHil(bool))); + connect(hilAction, SIGNAL(triggered(bool)), uas, SLOT(enableHilFlightGear(bool))); + connect(hilXAction, SIGNAL(triggered(bool)), uas, SLOT(enableHilXPlane(bool))); connect(selectAirframeAction, SIGNAL(triggered()), this, SLOT(selectAirframe())); connect(setBatterySpecsAction, SIGNAL(triggered()), this, SLOT(setBatterySpecs())); connect(uas, SIGNAL(systemRemoved()), this, SLOT(deleteLater())); -- 2.22.0