From af1056d593fdc48052883256c943fca992c655bd Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Sat, 23 Aug 2014 18:43:39 +0200 Subject: [PATCH] handle wgs84 altitude correctly also adds AMSL output in ft --- src/uas/UAS.cc | 16 ++++++++------- src/uas/UAS.h | 31 +++++++++++++++++++++++++++-- src/uas/UASInterface.h | 4 ++-- src/uas/UASWaypointManager.cc | 7 ++++--- src/uas/UASWaypointManager.h | 2 +- src/uas/senseSoarMAV.cpp | 2 +- src/ui/HSIDisplay.cc | 11 +++++----- src/ui/HSIDisplay.h | 2 +- src/ui/HUD.cc | 9 +++++---- src/ui/HUD.h | 2 +- src/ui/PrimaryFlightDisplay.cc | 14 +++++++++---- src/ui/PrimaryFlightDisplay.h | 3 ++- src/ui/QGCToolBar.cc | 8 ++++---- src/ui/QGCToolBar.h | 2 +- src/ui/map/QGCMapWidget.cc | 2 +- src/ui/map3D/QGCGoogleEarthView.cc | 2 +- src/ui/uas/UASControlParameters.cpp | 2 +- src/ui/uas/UASQuickView.cc | 2 ++ src/ui/uas/UASView.cc | 2 +- 19 files changed, 82 insertions(+), 41 deletions(-) diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index f4e25b4bf..8e049480a 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -109,6 +109,8 @@ UAS::UAS(MAVLinkProtocol* protocol, QThread* thread, int id) : UASInterface(), latitude(0.0), longitude(0.0), altitudeAMSL(0.0), + altitudeAMSLFT(0.0), + altitudeWGS84(0.0), altitudeRelative(0.0), globalEstimatorActive(false), @@ -820,7 +822,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) if (!isnan(hud.airspeed)) setAirSpeed(hud.airspeed); speedZ = -hud.climb; - emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time); + emit altitudeChanged(this, altitudeAMSL, altitudeWGS84, altitudeRelative, -speedZ, time); emit speedChanged(this, groundSpeed, airSpeed, time); } break; @@ -879,7 +881,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) setLatitude(pos.lat/(double)1E7); setLongitude(pos.lon/(double)1E7); - setAltitudeAMSL(pos.alt/1000.0); + setAltitudeWGS84(pos.alt/1000.0); setAltitudeRelative(pos.relative_alt/1000.0); globalEstimatorActive = true; @@ -888,8 +890,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) speedY = pos.vy/100.0; speedZ = pos.vz/100.0; - emit globalPositionChanged(this, getLatitude(), getLongitude(), getAltitudeAMSL(), time); - emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time); + emit globalPositionChanged(this, getLatitude(), getLongitude(), getAltitudeAMSL(), getAltitudeWGS84(), time); + emit altitudeChanged(this, altitudeAMSL, altitudeWGS84, altitudeRelative, -speedZ, time); // We had some frame mess here, global and local axes were mixed. emit velocityChanged_NED(this, speedX, speedY, speedZ, time); @@ -938,9 +940,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) if (!globalEstimatorActive) { setLatitude(latitude_gps); setLongitude(longitude_gps); - setAltitudeAMSL(altitude_gps); - emit globalPositionChanged(this, getLatitude(), getLongitude(), getAltitudeAMSL(), time); - emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time); + setAltitudeWGS84(altitude_gps); + emit globalPositionChanged(this, getLatitude(), getLongitude(), getAltitudeAMSL(), getAltitudeWGS84(), time); + emit altitudeChanged(this, altitudeAMSL, altitudeWGS84, altitudeRelative, -speedZ, time); float vel = pos.vel/100.0f; // Smaller than threshold and not NaN diff --git a/src/uas/UAS.h b/src/uas/UAS.h index 0c623e3a7..8124847a2 100644 --- a/src/uas/UAS.h +++ b/src/uas/UAS.h @@ -110,6 +110,8 @@ public: Q_PROPERTY(double groundSpeed READ getGroundSpeed WRITE setGroundSpeed NOTIFY groundSpeedChanged) Q_PROPERTY(double bearingToWaypoint READ getBearingToWaypoint WRITE setBearingToWaypoint NOTIFY bearingToWaypointChanged) Q_PROPERTY(double altitudeAMSL READ getAltitudeAMSL WRITE setAltitudeAMSL NOTIFY altitudeAMSLChanged) + Q_PROPERTY(double altitudeAMSLFT READ getAltitudeAMSLFT NOTIFY altitudeAMSLFTChanged) + Q_PROPERTY(double altitudeWGS84 READ getAltitudeWGS84 WRITE setAltitudeWGS84 NOTIFY altitudeWGS84Changed) Q_PROPERTY(double altitudeRelative READ getAltitudeRelative WRITE setAltitudeRelative NOTIFY altitudeRelativeChanged) void setGroundSpeed(double val) @@ -197,7 +199,10 @@ public: { altitudeAMSL = val; emit altitudeAMSLChanged(val, "altitudeAMSL"); - emit valueChanged(this->uasId,"altitudeAMSL","m",QVariant(val),getUnixTime()); + emit valueChanged(this->uasId,"altitudeAMSL","m",QVariant(altitudeAMSL),getUnixTime()); + altitudeAMSLFT = 3.28084 * altitudeAMSL; + emit altitudeAMSLFTChanged(val, "altitudeAMSLFT"); + emit valueChanged(this->uasId,"altitudeAMSLFT","m",QVariant(altitudeAMSLFT),getUnixTime()); } double getAltitudeAMSL() const @@ -205,6 +210,24 @@ public: return altitudeAMSL; } + double getAltitudeAMSLFT() const + { + return altitudeAMSLFT; + } + + void setAltitudeWGS84(double val) + { + altitudeWGS84 = val; + emit altitudeWGS84Changed(val, "altitudeWGS84"); + emit valueChanged(this->uasId,"altitudeWGS84","m",QVariant(val),getUnixTime()); + } + + double getAltitudeWGS84() const + { + return altitudeWGS84; + } + + void setAltitudeRelative(double val) { altitudeRelative = val; @@ -453,7 +476,9 @@ protected: //COMMENTS FOR TEST UNIT double latitude; ///< Global latitude as estimated by position estimator double longitude; ///< Global longitude as estimated by position estimator - double altitudeAMSL; ///< Global altitude as estimated by position estimator + double altitudeAMSL; ///< Global altitude as estimated by position estimator, AMSL + double altitudeAMSLFT; ///< Global altitude as estimated by position estimator, AMSL + double altitudeWGS84; ///< Global altitude as estimated by position estimator, WGS84 double altitudeRelative; ///< Altitude above home as estimated by position estimator double satelliteCount; ///< Number of satellites visible to raw GPS @@ -963,6 +988,8 @@ signals: void longitudeChanged(double val,QString name); void latitudeChanged(double val,QString name); void altitudeAMSLChanged(double val,QString name); + void altitudeAMSLFTChanged(double val,QString name); + void altitudeWGS84Changed(double val,QString name); void altitudeRelativeChanged(double val,QString name); void rollChanged(double val,QString name); void pitchChanged(double val,QString name); diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index 973dfbf69..0064229d6 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -525,8 +525,8 @@ signals: void userPositionSetPointsChanged(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired); void localPositionChanged(UASInterface*, double x, double y, double z, quint64 usec); void localPositionChanged(UASInterface*, int component, double x, double y, double z, quint64 usec); - void globalPositionChanged(UASInterface*, double lat, double lon, double alt, quint64 usec); - void altitudeChanged(UASInterface*, double altitudeAMSL, double altitudeRelative, double climbRate, quint64 usec); + void globalPositionChanged(UASInterface*, double lat, double lon, double altAMSL, double altWGS84, quint64 usec); + void altitudeChanged(UASInterface*, double altitudeAMSL, double altitudeWGS84, double altitudeRelative, double climbRate, quint64 usec); /** @brief Update the status of one satellite used for localization */ void gpsSatelliteStatusChanged(int uasid, int satid, float azimuth, float direction, float snr, bool used); diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 5c57745dd..5bb0e8915 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -55,7 +55,7 @@ UASWaypointManager::UASWaypointManager(UAS* _uas) uasid = uas->getUASID(); connect(&protocol_timer, SIGNAL(timeout()), this, SLOT(timeout())); connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(handleLocalPositionChanged(UASInterface*,double,double,double,quint64))); - connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(handleGlobalPositionChanged(UASInterface*,double,double,double,quint64))); + connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(handleGlobalPositionChanged(UASInterface*,double,double,double,double,double,quint64))); } else { @@ -119,11 +119,12 @@ void UASWaypointManager::handleLocalPositionChanged(UASInterface* mav, double x, } } -void UASWaypointManager::handleGlobalPositionChanged(UASInterface* mav, double lat, double lon, double alt, quint64 time) +void UASWaypointManager::handleGlobalPositionChanged(UASInterface* mav, double lat, double lon, double altAMSL, double altWGS84, quint64 time) { Q_UNUSED(mav); Q_UNUSED(time); - Q_UNUSED(alt); + Q_UNUSED(altAMSL); + Q_UNUSED(altWGS84); Q_UNUSED(lon); Q_UNUSED(lat); if (waypointsEditable.count() > 0 && currentWaypointEditable && (currentWaypointEditable->getFrame() == MAV_FRAME_GLOBAL || currentWaypointEditable->getFrame() == MAV_FRAME_GLOBAL_RELATIVE_ALT)) diff --git a/src/uas/UASWaypointManager.h b/src/uas/UASWaypointManager.h index 15b8b6326..f2eb7cb4f 100644 --- a/src/uas/UASWaypointManager.h +++ b/src/uas/UASWaypointManager.h @@ -145,7 +145,7 @@ public slots: void notifyOfChangeViewOnly(Waypoint* wp); ///< Notifies manager to changes to a viewonly waypoint, e.g. some widget wants to change "current" /*@}*/ void handleLocalPositionChanged(UASInterface* mav, double x, double y, double z, quint64 time); - void handleGlobalPositionChanged(UASInterface* mav, double lat, double lon, double alt, quint64 time); + void handleGlobalPositionChanged(UASInterface* mav, double lat, double lon, double altAMSL, double altWGS84, quint64 time); signals: void waypointEditableListChanged(void); ///< emits signal that the list of editable waypoints has been changed diff --git a/src/uas/senseSoarMAV.cpp b/src/uas/senseSoarMAV.cpp index 234a16be0..9796b55aa 100644 --- a/src/uas/senseSoarMAV.cpp +++ b/src/uas/senseSoarMAV.cpp @@ -115,7 +115,7 @@ void senseSoarMAV::receiveMessage(LinkInterface *link, mavlink_message_t message emit valueChanged(uasId, "latitude", "deg", this->latitude, time); emit valueChanged(uasId, "longitude", "deg", this->longitude, time); emit valueChanged(uasId, "altitude", "m", this->altitude, time); - emit globalPositionChanged(this, this->latitude, this->longitude, this->altitude, time); + emit globalPositionChanged(this, this->latitude, this->longitude, this->altitude, this->altitude, time); break; } case MAVLINK_MSG_ID_OBS_QFF: diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index c944d05ef..bcdbae698 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -920,7 +920,7 @@ void HSIDisplay::setActiveUAS(UASInterface* uas) if (this->uas != NULL) { disconnect(this->uas, SIGNAL(gpsSatelliteStatusChanged(int,int,float,float,float,bool)), this, SLOT(updateSatellite(int,int,float,float,float,bool))); disconnect(this->uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); - disconnect(this->uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); + disconnect(this->uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,double,quint64))); disconnect(this->uas, SIGNAL(attitudeThrustSetPointChanged(UASInterface*,float,float,float,float,quint64)), this, SLOT(updateAttitudeSetpoints(UASInterface*,float,float,float,float,quint64))); disconnect(this->uas, SIGNAL(positionSetPointsChanged(int,float,float,float,float,quint64)), this, SLOT(updatePositionSetpoints(int,float,float,float,float,quint64))); disconnect(uas, SIGNAL(userPositionSetPointsChanged(int,float,float,float,float)), this, SLOT(updateUserPositionSetpoints(int,float,float,float,float))); @@ -955,8 +955,8 @@ void HSIDisplay::setActiveUAS(UASInterface* uas) this, SLOT(updateSatellite(int,int,float,float,float,bool))); connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); - connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), - this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); + connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), + this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,double,quint64))); connect(uas, SIGNAL(attitudeThrustSetPointChanged(UASInterface*,float,float,float,float,quint64)), this, SLOT(updateAttitudeSetpoints(UASInterface*,float,float,float,float,quint64))); connect(uas, SIGNAL(positionSetPointsChanged(int,float,float,float,float,quint64)), @@ -1161,11 +1161,12 @@ void HSIDisplay::updateLocalPosition(UASInterface*, double x, double y, double z localAvailable = usec; } -void HSIDisplay::updateGlobalPosition(UASInterface*, double lat, double lon, double alt, quint64 usec) +void HSIDisplay::updateGlobalPosition(UASInterface*, double lat, double lon, double altAMSL, double altWGS84, quint64 usec) { + Q_UNUSED(altAMSL); this->lat = lat; this->lon = lon; - this->alt = alt; + this->alt = altWGS84; globalAvailable = usec; } diff --git a/src/ui/HSIDisplay.h b/src/ui/HSIDisplay.h index e97a7717c..4185db79e 100644 --- a/src/ui/HSIDisplay.h +++ b/src/ui/HSIDisplay.h @@ -60,7 +60,7 @@ public slots: void updateUserPositionSetpoints(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired); void updatePositionSetpoints(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired, quint64 usec); void updateLocalPosition(UASInterface*, double x, double y, double z, quint64 usec); - void updateGlobalPosition(UASInterface*, double lat, double lon, double alt, quint64 usec); + void updateGlobalPosition(UASInterface*, double lat, double lon, double altAMSL, double altWGS84, quint64 usec); void updateSpeed(UASInterface* uas, double vx, double vy, double vz, quint64 time); void updatePositionLock(UASInterface* uas, bool lock); void updateAttitudeControllerEnabled(bool enabled); diff --git a/src/ui/HUD.cc b/src/ui/HUD.cc index f938338f2..fe6bb6bc4 100644 --- a/src/ui/HUD.cc +++ b/src/ui/HUD.cc @@ -285,7 +285,7 @@ void HUD::setActiveUAS(UASInterface* uas) disconnect(this->uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(receiveHeartbeat(UASInterface*))); disconnect(this->uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); - disconnect(this->uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); + disconnect(this->uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,double,quint64))); disconnect(this->uas, SIGNAL(velocityChanged_NEDspeedChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateSpeed(UASInterface*,double,double,double,quint64))); disconnect(this->uas, SIGNAL(waypointSelected(int,int)), this, SLOT(selectWaypoint(int, int))); @@ -307,7 +307,7 @@ void HUD::setActiveUAS(UASInterface* uas) connect(uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(receiveHeartbeat(UASInterface*))); connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); - connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); + connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,double,quint64))); connect(uas, SIGNAL(velocityChanged_NED(UASInterface*,double,double,double,quint64)), this, SLOT(updateSpeed(UASInterface*,double,double,double,quint64))); connect(uas, SIGNAL(waypointSelected(int,int)), this, SLOT(selectWaypoint(int, int))); @@ -387,13 +387,14 @@ void HUD::updateLocalPosition(UASInterface* uas,double x,double y,double z,quint this->zPos = z; } -void HUD::updateGlobalPosition(UASInterface* uas,double lat, double lon, double altitude, quint64 timestamp) +void HUD::updateGlobalPosition(UASInterface* uas,double lat, double lon, double altitudeAMSL, double altitudeWGS84, quint64 timestamp) { Q_UNUSED(uas); + Q_UNUSED(altitudeAMSL); Q_UNUSED(timestamp); this->lat = lat; this->lon = lon; - this->alt = altitude; + this->alt = altitudeWGS84; } void HUD::updateSpeed(UASInterface* uas,double x,double y,double z,quint64 timestamp) diff --git a/src/ui/HUD.h b/src/ui/HUD.h index 18beedf44..e880e4395 100644 --- a/src/ui/HUD.h +++ b/src/ui/HUD.h @@ -74,7 +74,7 @@ public slots: void receiveHeartbeat(UASInterface*); void updateThrust(UASInterface*, double); void updateLocalPosition(UASInterface*,double,double,double,quint64); - void updateGlobalPosition(UASInterface*,double,double,double,quint64); + void updateGlobalPosition(UASInterface*,double,double,double,double,quint64); void updateSpeed(UASInterface*,double,double,double,quint64); void updateState(UASInterface*,QString); void updateMode(int id,QString mode, QString description); diff --git a/src/ui/PrimaryFlightDisplay.cc b/src/ui/PrimaryFlightDisplay.cc index 0bdb91b33..24348584c 100644 --- a/src/ui/PrimaryFlightDisplay.cc +++ b/src/ui/PrimaryFlightDisplay.cc @@ -218,7 +218,7 @@ void PrimaryFlightDisplay::forgetUAS(UASInterface* uas) disconnect(this->uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*, double, double, double, quint64))); disconnect(this->uas, SIGNAL(attitudeChanged(UASInterface*,int,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,int,double, double, double, quint64))); disconnect(this->uas, SIGNAL(speedChanged(UASInterface*, double, double, quint64)), this, SLOT(updateSpeed(UASInterface*, double, double, quint64))); - disconnect(this->uas, SIGNAL(altitudeChanged(UASInterface*, double, double, double, quint64)), this, SLOT(updateAltitude(UASInterface*, double, double, double, quint64))); + disconnect(this->uas, SIGNAL(altitudeChanged(UASInterface*, double, double, double, double, quint64)), this, SLOT(updateAltitude(UASInterface*, double, double, double, quint64))); disconnect(this->uas, SIGNAL(navigationControllerErrorsChanged(UASInterface*, double, double, double)), this, SLOT(updateNavigationControllerErrors(UASInterface*, double, double, double))); } } @@ -241,7 +241,7 @@ void PrimaryFlightDisplay::setActiveUAS(UASInterface* uas) connect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*, double, double, double, quint64))); connect(uas, SIGNAL(attitudeChanged(UASInterface*,int,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,int,double, double, double, quint64))); connect(uas, SIGNAL(speedChanged(UASInterface*, double, double, quint64)), this, SLOT(updateSpeed(UASInterface*, double, double, quint64))); - connect(uas, SIGNAL(altitudeChanged(UASInterface*, double, double, double, quint64)), this, SLOT(updateAltitude(UASInterface*, double, double, double, quint64))); + connect(uas, SIGNAL(altitudeChanged(UASInterface*, double, double, double, double, quint64)), this, SLOT(updateAltitude(UASInterface*, double, double, double, double, quint64))); connect(uas, SIGNAL(navigationControllerErrorsChanged(UASInterface*, double, double, double)), this, SLOT(updateNavigationControllerErrors(UASInterface*, double, double, double))); // Set new UAS @@ -319,14 +319,19 @@ void PrimaryFlightDisplay::updateSpeed(UASInterface* uas, double _groundSpeed, d airSpeed = _airSpeed; } -void PrimaryFlightDisplay::updateAltitude(UASInterface* uas, double _altitudeAMSL, double _altitudeRelative, double _climbRate, quint64 timestamp) { +void PrimaryFlightDisplay::updateAltitude(UASInterface* uas, double _altitudeAMSL, double _altitudeWGS84, double _altitudeRelative, double _climbRate, quint64 timestamp) { Q_UNUSED(uas); Q_UNUSED(timestamp); + Q_UNUSED(_altitudeWGS84) if (fabsf(altitudeAMSL - _altitudeAMSL) > 0.5f) { _valuesChanged = true; } + if (fabsf(altitudeWGS84 - _altitudeWGS84) > 0.5f) { + _valuesChanged = true; + } + if (fabsf(altitudeRelative - _altitudeRelative) > 0.5f) { _valuesChanged = true; } @@ -336,6 +341,7 @@ void PrimaryFlightDisplay::updateAltitude(UASInterface* uas, double _altitudeAMS } altitudeAMSL = _altitudeAMSL; + altitudeWGS84 = _altitudeWGS84; altitudeRelative = _altitudeRelative; climbRate = _climbRate; } @@ -892,7 +898,7 @@ void PrimaryFlightDisplay::drawAltimeter( QRectF area ) { - float primaryAltitude = altitudeAMSL; + float primaryAltitude = altitudeWGS84; float secondaryAltitude = 0; painter.resetTransform(); diff --git a/src/ui/PrimaryFlightDisplay.h b/src/ui/PrimaryFlightDisplay.h index 4c7dc6bf0..1961bd130 100644 --- a/src/ui/PrimaryFlightDisplay.h +++ b/src/ui/PrimaryFlightDisplay.h @@ -19,7 +19,7 @@ public slots: void updateAttitude(UASInterface* uas, int component, double roll, double pitch, double yaw, quint64 timestamp); void updateSpeed(UASInterface* uas, double _groundSpeed, double _airSpeed, quint64 timestamp); - void updateAltitude(UASInterface* uas, double _altitudeAMSL, double _altitudeRelative, double _climbRate, quint64 timestamp); + void updateAltitude(UASInterface* uas, double _altitudeAMSL, double _altitudeWGS84, double _altitudeRelative, double _climbRate, quint64 timestamp); void updateNavigationControllerErrors(UASInterface* uas, double altitudeError, double speedError, double xtrackError); /** @brief Set the currently monitored UAS */ @@ -104,6 +104,7 @@ private: float heading; float altitudeAMSL; + float altitudeWGS84; float altitudeRelative; // APM: GPS and baro mix above home (GPS) altitude. This value comes from the GLOBAL_POSITION_INT message. diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc index e589d042b..54d244b31 100644 --- a/src/ui/QGCToolBar.cc +++ b/src/ui/QGCToolBar.cc @@ -51,13 +51,13 @@ QGCToolBar::QGCToolBar(QWidget *parent) : // Do not load UI, wait for actions } -void QGCToolBar::globalPositionChanged(UASInterface* uas, double lat, double lon, double alt, quint64 usec) +void QGCToolBar::globalPositionChanged(UASInterface* uas, double lat, double lon, double altAMSL, double altWGS84, quint64 usec) { Q_UNUSED(uas); Q_UNUSED(lat); Q_UNUSED(lon); Q_UNUSED(usec); - altitudeMSL = alt; + altitudeMSL = altAMSL; changed = true; } @@ -370,7 +370,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active) disconnect(mav, SIGNAL(batteryChanged(UASInterface*, double, double, double,int)), this, SLOT(updateBatteryRemaining(UASInterface*, double, double, double, int))); disconnect(mav, SIGNAL(armingChanged(bool)), this, SLOT(updateArmingState(bool))); disconnect(mav, SIGNAL(heartbeatTimeout(bool, unsigned int)), this, SLOT(heartbeatTimeout(bool,unsigned int))); - disconnect(active, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(globalPositionChanged(UASInterface*,double,double,double,quint64))); + disconnect(active, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(globalPositionChanged(UASInterface*,double,double,double,double,quint64))); if (mav->getWaypointManager()) { disconnect(mav->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(updateCurrentWaypoint(quint16))); @@ -395,7 +395,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active) connect(mav, SIGNAL(batteryChanged(UASInterface*,double,double,double,int)), this, SLOT(updateBatteryRemaining(UASInterface*,double,double,double,int))); connect(mav, SIGNAL(armingChanged(bool)), this, SLOT(updateArmingState(bool))); connect(mav, SIGNAL(heartbeatTimeout(bool, unsigned int)), this, SLOT(heartbeatTimeout(bool,unsigned int))); - connect(mav, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(globalPositionChanged(UASInterface*,double,double,double,quint64))); + connect(mav, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(globalPositionChanged(UASInterface*,double,double,double,double,quint64))); if (mav->getWaypointManager()) { connect(mav->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(updateCurrentWaypoint(quint16))); diff --git a/src/ui/QGCToolBar.h b/src/ui/QGCToolBar.h index e161bcc9d..7482c4ad4 100644 --- a/src/ui/QGCToolBar.h +++ b/src/ui/QGCToolBar.h @@ -78,7 +78,7 @@ public slots: /** @brief Update connection timeout time */ void heartbeatTimeout(bool timeout, unsigned int ms); /** @brief Update global position */ - void globalPositionChanged(UASInterface* uas, double lat, double lon, double alt, quint64 usec); + void globalPositionChanged(UASInterface* uas, double lat, double lon, double altAMSL, double altWGS84, quint64 usec); /** @brief Create or connect link */ void connectLink(bool connect); /** @brief Clear status string */ diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc index c6674bcdc..a01796e46 100644 --- a/src/ui/map/QGCMapWidget.cc +++ b/src/ui/map/QGCMapWidget.cc @@ -353,7 +353,7 @@ void QGCMapWidget::mouseDoubleClickEvent(QMouseEvent* event) */ void QGCMapWidget::addUAS(UASInterface* uas) { - connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); + connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,double,quint64))); connect(uas, SIGNAL(systemSpecsChanged(int)), this, SLOT(updateSystemSpecs(int))); if (!waypointLines.value(uas->getUASID(), NULL)) { waypointLines.insert(uas->getUASID(), new QGraphicsItemGroup(map)); diff --git a/src/ui/map3D/QGCGoogleEarthView.cc b/src/ui/map3D/QGCGoogleEarthView.cc index 28bfd70bd..059844e5c 100644 --- a/src/ui/map3D/QGCGoogleEarthView.cc +++ b/src/ui/map3D/QGCGoogleEarthView.cc @@ -206,7 +206,7 @@ void QGCGoogleEarthView::addUAS(UASInterface* uas) if (trailEnabled) javaScript(QString("showTrail(%1);").arg(uas->getUASID())); // Automatically receive further position updates - connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); + connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,double,quint64))); // Receive waypoint updates // Connect the waypoint manager / data storage to the UI connect(uas->getWaypointManager(), SIGNAL(waypointEditableListChanged(int)), this, SLOT(updateWaypointList(int))); diff --git a/src/ui/uas/UASControlParameters.cpp b/src/ui/uas/UASControlParameters.cpp index 23f8f40d5..2f5c61d23 100644 --- a/src/ui/uas/UASControlParameters.cpp +++ b/src/ui/uas/UASControlParameters.cpp @@ -65,7 +65,7 @@ void UASControlParameters::changedMode(int mode) void UASControlParameters::activeUasSet(UASInterface *uas) { if(uas) { - connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); + connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,double,quint64))); connect(uas, SIGNAL(velocityChanged_NED(UASInterface*,double,double,double,quint64)), this, SLOT(speedChanged(UASInterface*,double,double,double,quint64))); connect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,double,double,double,quint64))); connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); diff --git a/src/ui/uas/UASQuickView.cc b/src/ui/uas/UASQuickView.cc index 5f1d7891e..3adce8e4f 100644 --- a/src/ui/uas/UASQuickView.cc +++ b/src/ui/uas/UASQuickView.cc @@ -31,6 +31,8 @@ UASQuickView::UASQuickView(QWidget *parent) : QWidget(parent), if (uasPropertyValueMap.size() == 0) { valueEnabled("altitudeAMSL"); + valueEnabled("altitudeAMSLFT"); + valueEnabled("altitudeWGS84"); valueEnabled("altitudeRelative"); valueEnabled("groundSpeed"); valueEnabled("distToWaypoint"); diff --git a/src/ui/uas/UASView.cc b/src/ui/uas/UASView.cc index 7affc73f1..4d5e1765d 100644 --- a/src/ui/uas/UASView.cc +++ b/src/ui/uas/UASView.cc @@ -92,7 +92,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : connect(uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(receiveHeartbeat(UASInterface*))); connect(uas, SIGNAL(thrustChanged(UASInterface*, double)), this, SLOT(updateThrust(UASInterface*, double))); connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); - connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); + connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,double,quint64))); connect(uas, SIGNAL(velocityChanged_NED(UASInterface*,double,double,double,quint64)), this, SLOT(updateSpeed(UASInterface*,double,double,double,quint64))); connect(uas, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*,QString,QString))); connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); -- 2.22.0