Commit af1056d5 authored by Thomas Gubler's avatar Thomas Gubler

handle wgs84 altitude correctly

also adds AMSL output in ft
parent 6836a23a
...@@ -109,6 +109,8 @@ UAS::UAS(MAVLinkProtocol* protocol, QThread* thread, int id) : UASInterface(), ...@@ -109,6 +109,8 @@ UAS::UAS(MAVLinkProtocol* protocol, QThread* thread, int id) : UASInterface(),
latitude(0.0), latitude(0.0),
longitude(0.0), longitude(0.0),
altitudeAMSL(0.0), altitudeAMSL(0.0),
altitudeAMSLFT(0.0),
altitudeWGS84(0.0),
altitudeRelative(0.0), altitudeRelative(0.0),
globalEstimatorActive(false), globalEstimatorActive(false),
...@@ -820,7 +822,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -820,7 +822,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if (!isnan(hud.airspeed)) if (!isnan(hud.airspeed))
setAirSpeed(hud.airspeed); setAirSpeed(hud.airspeed);
speedZ = -hud.climb; speedZ = -hud.climb;
emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time); emit altitudeChanged(this, altitudeAMSL, altitudeWGS84, altitudeRelative, -speedZ, time);
emit speedChanged(this, groundSpeed, airSpeed, time); emit speedChanged(this, groundSpeed, airSpeed, time);
} }
break; break;
...@@ -879,7 +881,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -879,7 +881,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
setLatitude(pos.lat/(double)1E7); setLatitude(pos.lat/(double)1E7);
setLongitude(pos.lon/(double)1E7); setLongitude(pos.lon/(double)1E7);
setAltitudeAMSL(pos.alt/1000.0); setAltitudeWGS84(pos.alt/1000.0);
setAltitudeRelative(pos.relative_alt/1000.0); setAltitudeRelative(pos.relative_alt/1000.0);
globalEstimatorActive = true; globalEstimatorActive = true;
...@@ -888,8 +890,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -888,8 +890,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
speedY = pos.vy/100.0; speedY = pos.vy/100.0;
speedZ = pos.vz/100.0; speedZ = pos.vz/100.0;
emit globalPositionChanged(this, getLatitude(), getLongitude(), getAltitudeAMSL(), time); emit globalPositionChanged(this, getLatitude(), getLongitude(), getAltitudeAMSL(), getAltitudeWGS84(), time);
emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time); emit altitudeChanged(this, altitudeAMSL, altitudeWGS84, altitudeRelative, -speedZ, time);
// We had some frame mess here, global and local axes were mixed. // We had some frame mess here, global and local axes were mixed.
emit velocityChanged_NED(this, speedX, speedY, speedZ, time); emit velocityChanged_NED(this, speedX, speedY, speedZ, time);
...@@ -938,9 +940,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -938,9 +940,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if (!globalEstimatorActive) { if (!globalEstimatorActive) {
setLatitude(latitude_gps); setLatitude(latitude_gps);
setLongitude(longitude_gps); setLongitude(longitude_gps);
setAltitudeAMSL(altitude_gps); setAltitudeWGS84(altitude_gps);
emit globalPositionChanged(this, getLatitude(), getLongitude(), getAltitudeAMSL(), time); emit globalPositionChanged(this, getLatitude(), getLongitude(), getAltitudeAMSL(), getAltitudeWGS84(), time);
emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time); emit altitudeChanged(this, altitudeAMSL, altitudeWGS84, altitudeRelative, -speedZ, time);
float vel = pos.vel/100.0f; float vel = pos.vel/100.0f;
// Smaller than threshold and not NaN // Smaller than threshold and not NaN
......
...@@ -110,6 +110,8 @@ public: ...@@ -110,6 +110,8 @@ public:
Q_PROPERTY(double groundSpeed READ getGroundSpeed WRITE setGroundSpeed NOTIFY groundSpeedChanged) Q_PROPERTY(double groundSpeed READ getGroundSpeed WRITE setGroundSpeed NOTIFY groundSpeedChanged)
Q_PROPERTY(double bearingToWaypoint READ getBearingToWaypoint WRITE setBearingToWaypoint NOTIFY bearingToWaypointChanged) Q_PROPERTY(double bearingToWaypoint READ getBearingToWaypoint WRITE setBearingToWaypoint NOTIFY bearingToWaypointChanged)
Q_PROPERTY(double altitudeAMSL READ getAltitudeAMSL WRITE setAltitudeAMSL NOTIFY altitudeAMSLChanged) 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) Q_PROPERTY(double altitudeRelative READ getAltitudeRelative WRITE setAltitudeRelative NOTIFY altitudeRelativeChanged)
void setGroundSpeed(double val) void setGroundSpeed(double val)
...@@ -197,7 +199,10 @@ public: ...@@ -197,7 +199,10 @@ public:
{ {
altitudeAMSL = val; altitudeAMSL = val;
emit altitudeAMSLChanged(val, "altitudeAMSL"); 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 double getAltitudeAMSL() const
...@@ -205,6 +210,24 @@ public: ...@@ -205,6 +210,24 @@ public:
return altitudeAMSL; 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) void setAltitudeRelative(double val)
{ {
altitudeRelative = val; altitudeRelative = val;
...@@ -453,7 +476,9 @@ protected: //COMMENTS FOR TEST UNIT ...@@ -453,7 +476,9 @@ protected: //COMMENTS FOR TEST UNIT
double latitude; ///< Global latitude as estimated by position estimator double latitude; ///< Global latitude as estimated by position estimator
double longitude; ///< Global longitude 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 altitudeRelative; ///< Altitude above home as estimated by position estimator
double satelliteCount; ///< Number of satellites visible to raw GPS double satelliteCount; ///< Number of satellites visible to raw GPS
...@@ -963,6 +988,8 @@ signals: ...@@ -963,6 +988,8 @@ signals:
void longitudeChanged(double val,QString name); void longitudeChanged(double val,QString name);
void latitudeChanged(double val,QString name); void latitudeChanged(double val,QString name);
void altitudeAMSLChanged(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 altitudeRelativeChanged(double val,QString name);
void rollChanged(double val,QString name); void rollChanged(double val,QString name);
void pitchChanged(double val,QString name); void pitchChanged(double val,QString name);
......
...@@ -525,8 +525,8 @@ signals: ...@@ -525,8 +525,8 @@ signals:
void userPositionSetPointsChanged(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired); 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*, double x, double y, double z, quint64 usec);
void localPositionChanged(UASInterface*, int component, 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 globalPositionChanged(UASInterface*, double lat, double lon, double altAMSL, double altWGS84, quint64 usec);
void altitudeChanged(UASInterface*, double altitudeAMSL, double altitudeRelative, double climbRate, 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 */ /** @brief Update the status of one satellite used for localization */
void gpsSatelliteStatusChanged(int uasid, int satid, float azimuth, float direction, float snr, bool used); void gpsSatelliteStatusChanged(int uasid, int satid, float azimuth, float direction, float snr, bool used);
......
...@@ -55,7 +55,7 @@ UASWaypointManager::UASWaypointManager(UAS* _uas) ...@@ -55,7 +55,7 @@ UASWaypointManager::UASWaypointManager(UAS* _uas)
uasid = uas->getUASID(); uasid = uas->getUASID();
connect(&protocol_timer, SIGNAL(timeout()), this, SLOT(timeout())); 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(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 else
{ {
...@@ -119,11 +119,12 @@ void UASWaypointManager::handleLocalPositionChanged(UASInterface* mav, double x, ...@@ -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(mav);
Q_UNUSED(time); Q_UNUSED(time);
Q_UNUSED(alt); Q_UNUSED(altAMSL);
Q_UNUSED(altWGS84);
Q_UNUSED(lon); Q_UNUSED(lon);
Q_UNUSED(lat); Q_UNUSED(lat);
if (waypointsEditable.count() > 0 && currentWaypointEditable && (currentWaypointEditable->getFrame() == MAV_FRAME_GLOBAL || currentWaypointEditable->getFrame() == MAV_FRAME_GLOBAL_RELATIVE_ALT)) if (waypointsEditable.count() > 0 && currentWaypointEditable && (currentWaypointEditable->getFrame() == MAV_FRAME_GLOBAL || currentWaypointEditable->getFrame() == MAV_FRAME_GLOBAL_RELATIVE_ALT))
......
...@@ -145,7 +145,7 @@ public slots: ...@@ -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 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 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: signals:
void waypointEditableListChanged(void); ///< emits signal that the list of editable waypoints has been changed void waypointEditableListChanged(void); ///< emits signal that the list of editable waypoints has been changed
......
...@@ -115,7 +115,7 @@ void senseSoarMAV::receiveMessage(LinkInterface *link, mavlink_message_t message ...@@ -115,7 +115,7 @@ void senseSoarMAV::receiveMessage(LinkInterface *link, mavlink_message_t message
emit valueChanged(uasId, "latitude", "deg", this->latitude, time); emit valueChanged(uasId, "latitude", "deg", this->latitude, time);
emit valueChanged(uasId, "longitude", "deg", this->longitude, time); emit valueChanged(uasId, "longitude", "deg", this->longitude, time);
emit valueChanged(uasId, "altitude", "m", this->altitude, 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; break;
} }
case MAVLINK_MSG_ID_OBS_QFF: case MAVLINK_MSG_ID_OBS_QFF:
......
...@@ -920,7 +920,7 @@ void HSIDisplay::setActiveUAS(UASInterface* uas) ...@@ -920,7 +920,7 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
if (this->uas != NULL) { 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(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(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(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(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))); 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) ...@@ -955,8 +955,8 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
this, SLOT(updateSatellite(int,int,float,float,float,bool))); this, SLOT(updateSatellite(int,int,float,float,float,bool)));
connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)),
this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64)));
connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)),
this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,double,quint64)));
connect(uas, SIGNAL(attitudeThrustSetPointChanged(UASInterface*,float,float,float,float,quint64)), connect(uas, SIGNAL(attitudeThrustSetPointChanged(UASInterface*,float,float,float,float,quint64)),
this, SLOT(updateAttitudeSetpoints(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)), connect(uas, SIGNAL(positionSetPointsChanged(int,float,float,float,float,quint64)),
...@@ -1161,11 +1161,12 @@ void HSIDisplay::updateLocalPosition(UASInterface*, double x, double y, double z ...@@ -1161,11 +1161,12 @@ void HSIDisplay::updateLocalPosition(UASInterface*, double x, double y, double z
localAvailable = usec; 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->lat = lat;
this->lon = lon; this->lon = lon;
this->alt = alt; this->alt = altWGS84;
globalAvailable = usec; globalAvailable = usec;
} }
......
...@@ -60,7 +60,7 @@ public slots: ...@@ -60,7 +60,7 @@ public slots:
void updateUserPositionSetpoints(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired); 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 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 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 updateSpeed(UASInterface* uas, double vx, double vy, double vz, quint64 time);
void updatePositionLock(UASInterface* uas, bool lock); void updatePositionLock(UASInterface* uas, bool lock);
void updateAttitudeControllerEnabled(bool enabled); void updateAttitudeControllerEnabled(bool enabled);
......
...@@ -285,7 +285,7 @@ void HUD::setActiveUAS(UASInterface* uas) ...@@ -285,7 +285,7 @@ void HUD::setActiveUAS(UASInterface* uas)
disconnect(this->uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(receiveHeartbeat(UASInterface*))); 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(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(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))); disconnect(this->uas, SIGNAL(waypointSelected(int,int)), this, SLOT(selectWaypoint(int, int)));
...@@ -307,7 +307,7 @@ void HUD::setActiveUAS(UASInterface* uas) ...@@ -307,7 +307,7 @@ void HUD::setActiveUAS(UASInterface* uas)
connect(uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(receiveHeartbeat(UASInterface*))); 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(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(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))); 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 ...@@ -387,13 +387,14 @@ void HUD::updateLocalPosition(UASInterface* uas,double x,double y,double z,quint
this->zPos = z; 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(uas);
Q_UNUSED(altitudeAMSL);
Q_UNUSED(timestamp); Q_UNUSED(timestamp);
this->lat = lat; this->lat = lat;
this->lon = lon; this->lon = lon;
this->alt = altitude; this->alt = altitudeWGS84;
} }
void HUD::updateSpeed(UASInterface* uas,double x,double y,double z,quint64 timestamp) void HUD::updateSpeed(UASInterface* uas,double x,double y,double z,quint64 timestamp)
......
...@@ -74,7 +74,7 @@ public slots: ...@@ -74,7 +74,7 @@ public slots:
void receiveHeartbeat(UASInterface*); void receiveHeartbeat(UASInterface*);
void updateThrust(UASInterface*, double); void updateThrust(UASInterface*, double);
void updateLocalPosition(UASInterface*,double,double,double,quint64); 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 updateSpeed(UASInterface*,double,double,double,quint64);
void updateState(UASInterface*,QString); void updateState(UASInterface*,QString);
void updateMode(int id,QString mode, QString description); void updateMode(int id,QString mode, QString description);
......
...@@ -218,7 +218,7 @@ void PrimaryFlightDisplay::forgetUAS(UASInterface* uas) ...@@ -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*,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(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(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))); 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) ...@@ -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*,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(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(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))); connect(uas, SIGNAL(navigationControllerErrorsChanged(UASInterface*, double, double, double)), this, SLOT(updateNavigationControllerErrors(UASInterface*, double, double, double)));
// Set new UAS // Set new UAS
...@@ -319,14 +319,19 @@ void PrimaryFlightDisplay::updateSpeed(UASInterface* uas, double _groundSpeed, d ...@@ -319,14 +319,19 @@ void PrimaryFlightDisplay::updateSpeed(UASInterface* uas, double _groundSpeed, d
airSpeed = _airSpeed; 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(uas);
Q_UNUSED(timestamp); Q_UNUSED(timestamp);
Q_UNUSED(_altitudeWGS84)
if (fabsf(altitudeAMSL - _altitudeAMSL) > 0.5f) { if (fabsf(altitudeAMSL - _altitudeAMSL) > 0.5f) {
_valuesChanged = true; _valuesChanged = true;
} }
if (fabsf(altitudeWGS84 - _altitudeWGS84) > 0.5f) {
_valuesChanged = true;
}
if (fabsf(altitudeRelative - _altitudeRelative) > 0.5f) { if (fabsf(altitudeRelative - _altitudeRelative) > 0.5f) {
_valuesChanged = true; _valuesChanged = true;
} }
...@@ -336,6 +341,7 @@ void PrimaryFlightDisplay::updateAltitude(UASInterface* uas, double _altitudeAMS ...@@ -336,6 +341,7 @@ void PrimaryFlightDisplay::updateAltitude(UASInterface* uas, double _altitudeAMS
} }
altitudeAMSL = _altitudeAMSL; altitudeAMSL = _altitudeAMSL;
altitudeWGS84 = _altitudeWGS84;
altitudeRelative = _altitudeRelative; altitudeRelative = _altitudeRelative;
climbRate = _climbRate; climbRate = _climbRate;
} }
...@@ -892,7 +898,7 @@ void PrimaryFlightDisplay::drawAltimeter( ...@@ -892,7 +898,7 @@ void PrimaryFlightDisplay::drawAltimeter(
QRectF area QRectF area
) { ) {
float primaryAltitude = altitudeAMSL; float primaryAltitude = altitudeWGS84;
float secondaryAltitude = 0; float secondaryAltitude = 0;
painter.resetTransform(); painter.resetTransform();
......
...@@ -19,7 +19,7 @@ public slots: ...@@ -19,7 +19,7 @@ public slots:
void updateAttitude(UASInterface* uas, int component, double roll, double pitch, double yaw, quint64 timestamp); 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 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); void updateNavigationControllerErrors(UASInterface* uas, double altitudeError, double speedError, double xtrackError);
/** @brief Set the currently monitored UAS */ /** @brief Set the currently monitored UAS */
...@@ -104,6 +104,7 @@ private: ...@@ -104,6 +104,7 @@ private:
float heading; float heading;
float altitudeAMSL; float altitudeAMSL;
float altitudeWGS84;
float altitudeRelative; float altitudeRelative;
// APM: GPS and baro mix above home (GPS) altitude. This value comes from the GLOBAL_POSITION_INT message. // APM: GPS and baro mix above home (GPS) altitude. This value comes from the GLOBAL_POSITION_INT message.
......
...@@ -51,13 +51,13 @@ QGCToolBar::QGCToolBar(QWidget *parent) : ...@@ -51,13 +51,13 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
// Do not load UI, wait for actions // 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(uas);
Q_UNUSED(lat); Q_UNUSED(lat);
Q_UNUSED(lon); Q_UNUSED(lon);
Q_UNUSED(usec); Q_UNUSED(usec);
altitudeMSL = alt; altitudeMSL = altAMSL;
changed = true; changed = true;
} }
...@@ -370,7 +370,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active) ...@@ -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(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(armingChanged(bool)), this, SLOT(updateArmingState(bool)));
disconnect(mav, SIGNAL(heartbeatTimeout(bool, unsigned int)), this, SLOT(heartbeatTimeout(bool,unsigned int))); 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()) if (mav->getWaypointManager())
{ {
disconnect(mav->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(updateCurrentWaypoint(quint16))); disconnect(mav->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(updateCurrentWaypoint(quint16)));
...@@ -395,7 +395,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active) ...@@ -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(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(armingChanged(bool)), this, SLOT(updateArmingState(bool)));
connect(mav, SIGNAL(heartbeatTimeout(bool, unsigned int)), this, SLOT(heartbeatTimeout(bool,unsigned int))); 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()) if (mav->getWaypointManager())
{ {
connect(mav->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(updateCurrentWaypoint(quint16))); connect(mav->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(updateCurrentWaypoint(quint16)));
......
...@@ -78,7 +78,7 @@ public slots: ...@@ -78,7 +78,7 @@ public slots:
/** @brief Update connection timeout time */ /** @brief Update connection timeout time */
void heartbeatTimeout(bool timeout, unsigned int ms); void heartbeatTimeout(bool timeout, unsigned int ms);
/** @brief Update global position */ /** @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 */ /** @brief Create or connect link */
void connectLink(bool connect); void connectLink(bool connect);
/** @brief Clear status string */ /** @brief Clear status string */
......
...@@ -353,7 +353,7 @@ void QGCMapWidget::mouseDoubleClickEvent(QMouseEvent* event) ...@@ -353,7 +353,7 @@ void QGCMapWidget::mouseDoubleClickEvent(QMouseEvent* event)
*/ */
void QGCMapWidget::addUAS(UASInterface* uas) 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))); connect(uas, SIGNAL(systemSpecsChanged(int)), this, SLOT(updateSystemSpecs(int)));
if (!waypointLines.value(uas->getUASID(), NULL)) { if (!waypointLines.value(uas->getUASID(), NULL)) {
waypointLines.insert(uas->getUASID(), new QGraphicsItemGroup(map)); waypointLines.insert(uas->getUASID(), new QGraphicsItemGroup(map));
......
...@@ -206,7 +206,7 @@ void QGCGoogleEarthView::addUAS(UASInterface* uas) ...@@ -206,7 +206,7 @@ void QGCGoogleEarthView::addUAS(UASInterface* uas)
if (trailEnabled) javaScript(QString("showTrail(%1);").arg(uas->getUASID())); if (trailEnabled) javaScript(QString("showTrail(%1);").arg(uas->getUASID()));
// Automatically receive further position updates // 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 // Receive waypoint updates
// Connect the waypoint manager / data storage to the UI // Connect the waypoint manager / data storage to the UI
connect(uas->getWaypointManager(), SIGNAL(waypointEditableListChanged(int)), this, SLOT(updateWaypointList(int))); connect(uas->getWaypointManager(), SIGNAL(waypointEditableListChanged(int)), this, SLOT(updateWaypointList(int)));
......
...@@ -65,7 +65,7 @@ void UASControlParameters::changedMode(int mode) ...@@ -65,7 +65,7 @@ void UASControlParameters::changedMode(int mode)
void UASControlParameters::activeUasSet(UASInterface *uas) void UASControlParameters::activeUasSet(UASInterface *uas)
{ {
if(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(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(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))); connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString)));
......
...@@ -31,6 +31,8 @@ UASQuickView::UASQuickView(QWidget *parent) : QWidget(parent), ...@@ -31,6 +31,8 @@ UASQuickView::UASQuickView(QWidget *parent) : QWidget(parent),
if (uasPropertyValueMap.size() == 0) if (uasPropertyValueMap.size() == 0)
{ {
valueEnabled("altitudeAMSL"); valueEnabled("altitudeAMSL");
valueEnabled("altitudeAMSLFT");
valueEnabled("altitudeWGS84");
valueEnabled("altitudeRelative"); valueEnabled("altitudeRelative");
valueEnabled("groundSpeed"); valueEnabled("groundSpeed");
valueEnabled("distToWaypoint"); valueEnabled("distToWaypoint");
......
...@@ -92,7 +92,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -92,7 +92,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
connect(uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(receiveHeartbeat(UASInterface*))); connect(uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(receiveHeartbeat(UASInterface*)));
connect(uas, SIGNAL(thrustChanged(UASInterface*, double)), this, SLOT(updateThrust(UASInterface*, double))); 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(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(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(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*,QString,QString)));
connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString)));
......
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