Commit 17883dbb authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #428 from DrTon/alt_speed_fix

Altitude and speed rewrite
parents 9dea5ac9 fd497bc6
...@@ -911,14 +911,14 @@ void QGCXPlaneLink::setRandomPosition() ...@@ -911,14 +911,14 @@ void QGCXPlaneLink::setRandomPosition()
double offLon = rand() / static_cast<double>(RAND_MAX) / 500.0 + 1.0/500.0; double offLon = rand() / static_cast<double>(RAND_MAX) / 500.0 + 1.0/500.0;
double offAlt = rand() / static_cast<double>(RAND_MAX) * 200.0 + 100.0; double offAlt = rand() / static_cast<double>(RAND_MAX) * 200.0 + 100.0;
if (mav->getAltitude() + offAlt < 0) if (mav->getAltitudeAMSL() + offAlt < 0)
{ {
offAlt *= -1.0; offAlt *= -1.0;
} }
setPositionAttitude(mav->getLatitude() + offLat, setPositionAttitude(mav->getLatitude() + offLat,
mav->getLongitude() + offLon, mav->getLongitude() + offLon,
mav->getAltitude() + offAlt, mav->getAltitudeAMSL() + offAlt,
mav->getRoll(), mav->getRoll(),
mav->getPitch(), mav->getPitch(),
mav->getYaw()); mav->getYaw());
...@@ -935,7 +935,7 @@ void QGCXPlaneLink::setRandomAttitude() ...@@ -935,7 +935,7 @@ void QGCXPlaneLink::setRandomAttitude()
setPositionAttitude(mav->getLatitude(), setPositionAttitude(mav->getLatitude(),
mav->getLongitude(), mav->getLongitude(),
mav->getAltitude(), mav->getAltitudeAMSL(),
roll, roll,
pitch, pitch,
yaw); yaw);
......
...@@ -112,7 +112,15 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), ...@@ -112,7 +112,15 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
latitude(0.0), latitude(0.0),
longitude(0.0), longitude(0.0),
altitude(0.0), altitudeAMSL(0.0),
altitudeRelative(0.0),
airSpeed(NAN),
groundSpeed(NAN),
speedX(0.0),
speedY(0.0),
speedZ(0.0),
globalEstimatorActive(false), globalEstimatorActive(false),
latitude_gps(0.0), latitude_gps(0.0),
...@@ -828,18 +836,17 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -828,18 +836,17 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if (!attitudeKnown) if (!attitudeKnown)
{ {
//yaw = QGC::limitAngleToPMPId((((double)hud.heading-180.0)/360.0)*M_PI); setYaw(QGC::limitAngleToPMPId((((double)hud.heading)/180.0)*M_PI));
setYaw(QGC::limitAngleToPMPId((((double)hud.heading-180.0)/360.0)*M_PI));
emit attitudeChanged(this, getRoll(), getPitch(), getYaw(), time); emit attitudeChanged(this, getRoll(), getPitch(), getYaw(), time);
} }
// The primary altitude is the one that the UAV uses for navigation. setAltitudeAMSL(hud.alt);
// We assume! that the HUD message reports that as altitude. setGroundSpeed(hud.groundspeed);
emit primaryAltitudeChanged(this, hud.alt, time); if (!isnan(hud.airspeed))
setAirSpeed(hud.airspeed);
emit primarySpeedChanged(this, hud.airspeed, time); speedZ = -hud.climb;
emit gpsSpeedChanged(this, hud.groundspeed, time); emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time);
emit climbRateChanged(this, hud.climb, time); emit speedChanged(this, groundSpeed, airSpeed, time);
} }
break; break;
case MAVLINK_MSG_ID_LOCAL_POSITION_NED: case MAVLINK_MSG_ID_LOCAL_POSITION_NED:
...@@ -855,13 +862,17 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -855,13 +862,17 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if (!wrongComponent) if (!wrongComponent)
{ {
localX = pos.x; setLocalX(pos.x);
localY = pos.y; setLocalY(pos.y);
localZ = pos.z; setLocalZ(pos.z);
speedX = pos.vx;
speedY = pos.vy;
speedZ = pos.vz;
// Emit // Emit
emit localPositionChanged(this, pos.x, pos.y, pos.z, time); emit localPositionChanged(this, localX, localY, localZ, time);
emit velocityChanged_NED(this, pos.vx, pos.vy, pos.vz, time); emit velocityChanged_NED(this, speedX, speedY, speedZ, time);
// Set internal state // Set internal state
if (!positionLock) { if (!positionLock) {
...@@ -888,15 +899,13 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -888,15 +899,13 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
{ {
mavlink_global_position_int_t pos; mavlink_global_position_int_t pos;
mavlink_msg_global_position_int_decode(&message, &pos); mavlink_msg_global_position_int_decode(&message, &pos);
quint64 time = getUnixTime(); quint64 time = getUnixTime();
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);
// dongfang: Beware. There are 2 altitudes in this message; neither is the primary. setAltitudeRelative(pos.relative_alt/1000.0);
// pos.alt is GPS altitude and pos.relative_alt is above-home altitude.
// It would be nice if APM could be modified to present the primary (mix) alt. instead
// of the GPS alt. in this message.
setAltitude(pos.alt/1000.0);
globalEstimatorActive = true; globalEstimatorActive = true;
...@@ -904,14 +913,13 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -904,14 +913,13 @@ 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(), getAltitude(), time); emit globalPositionChanged(this, getLatitude(), getLongitude(), getAltitudeAMSL(), time);
// dongfang: The altitude is GPS altitude. Bugger. It needs to be changed to primary. emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time);
emit gpsAltitudeChanged(this, getAltitude(), 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);
double groundspeed = qSqrt(speedX*speedX+speedY*speedY); setGroundSpeed(qSqrt(speedX*speedX+speedY*speedY));
emit gpsSpeedChanged(this, groundspeed, time); emit speedChanged(this, groundSpeed, airSpeed, time);
// Set internal state // Set internal state
if (!positionLock) if (!positionLock)
...@@ -930,9 +938,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -930,9 +938,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
mavlink_gps_raw_int_t pos; mavlink_gps_raw_int_t pos;
mavlink_msg_gps_raw_int_decode(&message, &pos); mavlink_msg_gps_raw_int_decode(&message, &pos);
// SANITY CHECK
// only accept values in a realistic range
// quint64 time = getUnixTime(pos.time_usec);
quint64 time = getUnixTime(pos.time_usec); quint64 time = getUnixTime(pos.time_usec);
emit gpsLocalizationChanged(this, pos.fix_type); emit gpsLocalizationChanged(this, pos.fix_type);
...@@ -947,6 +952,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -947,6 +952,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if (pos.fix_type > 2) if (pos.fix_type > 2)
{ {
positionLock = true;
isGlobalPositionKnown = true;
latitude_gps = pos.lat/(double)1E7; latitude_gps = pos.lat/(double)1E7;
longitude_gps = pos.lon/(double)1E7; longitude_gps = pos.lon/(double)1E7;
...@@ -956,29 +963,16 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -956,29 +963,16 @@ 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);
setAltitude(altitude_gps); setAltitudeAMSL(altitude_gps);
emit globalPositionChanged(this, getLatitude(), getLongitude(), getAltitude(), time); emit globalPositionChanged(this, getLatitude(), getLongitude(), getAltitudeAMSL(), time);
emit gpsAltitudeChanged(this, getAltitude(), time); emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time);
}
positionLock = true; float vel = pos.vel/100.0f;
isGlobalPositionKnown = true; // Smaller than threshold and not NaN
if ((vel < 1000000) && !isnan(vel) && !isinf(vel)) {
// Smaller than threshold and not NaN
float vel = pos.vel/100.0f;
// If no GLOBAL_POSITION_INT messages ever received, use these raw GPS values instead.
if (!globalEstimatorActive) {
if ((vel < 1000000) && !isnan(vel) && !isinf(vel))
{
//emit speedChanged(this, vel, 0.0, 0.0, time);
setGroundSpeed(vel); setGroundSpeed(vel);
// TODO: Other sources also? Actually this condition does not quite belong here. emit speedChanged(this, groundSpeed, airSpeed, time);
emit gpsSpeedChanged(this, vel, time); } else {
}
else
{
emit textMessageReceived(uasId, message.compid, 255, QString("GCS ERROR: RECEIVED INVALID SPEED OF %1 m/s").arg(vel)); emit textMessageReceived(uasId, message.compid, 255, QString("GCS ERROR: RECEIVED INVALID SPEED OF %1 m/s").arg(vel));
} }
} }
......
...@@ -103,7 +103,11 @@ public: ...@@ -103,7 +103,11 @@ public:
Q_PROPERTY(double pitch READ getPitch WRITE setPitch NOTIFY pitchChanged) Q_PROPERTY(double pitch READ getPitch WRITE setPitch NOTIFY pitchChanged)
Q_PROPERTY(double yaw READ getYaw WRITE setYaw NOTIFY yawChanged) Q_PROPERTY(double yaw READ getYaw WRITE setYaw NOTIFY yawChanged)
Q_PROPERTY(double distToWaypoint READ getDistToWaypoint WRITE setDistToWaypoint NOTIFY distToWaypointChanged) Q_PROPERTY(double distToWaypoint READ getDistToWaypoint WRITE setDistToWaypoint NOTIFY distToWaypointChanged)
Q_PROPERTY(double airSpeed READ getGroundSpeed WRITE setGroundSpeed NOTIFY airSpeedChanged)
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 altitudeAMSL READ getAltitudeAMSL WRITE setAltitudeAMSL NOTIFY altitudeAMSLChanged)
Q_PROPERTY(double altitudeRelative READ getAltitudeRelative WRITE setAltitudeRelative NOTIFY altitudeRelativeChanged)
void setGroundSpeed(double val) void setGroundSpeed(double val)
{ {
...@@ -115,17 +119,24 @@ public: ...@@ -115,17 +119,24 @@ public:
{ {
return groundSpeed; return groundSpeed;
} }
Q_PROPERTY(double bearingToWaypoint READ getBearingToWaypoint WRITE setBearingToWaypoint NOTIFY bearingToWaypointChanged)
// dongfang: There is not only one altitude; there are at least (APM) GPS altitude, mix altitude and mix-altitude relative to home. void setAirSpeed(double val)
// I have made this property refer to the mix-altitude ASL as this is the one actually used in navigation by APM. {
Q_PROPERTY(double altitude READ getAltitude WRITE setAltitude NOTIFY altitudeChanged) airSpeed = val;
emit airSpeedChanged(val,"airSpeed");
emit valueChanged(this->uasId,"airSpeed","m/s",QVariant(val),getUnixTime());
}
double getAirSpeed() const
{
return airSpeed;
}
void setLocalX(double val) void setLocalX(double val)
{ {
localX = val; localX = val;
emit localXChanged(val,"localX"); emit localXChanged(val,"localX");
emit valueChanged(this->uasId,"localX","M",QVariant(val),getUnixTime()); emit valueChanged(this->uasId,"localX","m",QVariant(val),getUnixTime());
} }
double getLocalX() const double getLocalX() const
...@@ -137,7 +148,7 @@ public: ...@@ -137,7 +148,7 @@ public:
{ {
localY = val; localY = val;
emit localYChanged(val,"localY"); emit localYChanged(val,"localY");
emit valueChanged(this->uasId,"localY","M",QVariant(val),getUnixTime()); emit valueChanged(this->uasId,"localY","m",QVariant(val),getUnixTime());
} }
double getLocalY() const double getLocalY() const
{ {
...@@ -148,7 +159,7 @@ public: ...@@ -148,7 +159,7 @@ public:
{ {
localZ = val; localZ = val;
emit localZChanged(val,"localZ"); emit localZChanged(val,"localZ");
emit valueChanged(this->uasId,"localZ","M",QVariant(val),getUnixTime()); emit valueChanged(this->uasId,"localZ","m",QVariant(val),getUnixTime());
} }
double getLocalZ() const double getLocalZ() const
{ {
...@@ -179,23 +190,35 @@ public: ...@@ -179,23 +190,35 @@ public:
return longitude; return longitude;
} }
void setAltitude(double val) void setAltitudeAMSL(double val)
{ {
altitude = val; altitudeAMSL = val;
emit altitudeChanged(val, "altitude"); emit altitudeAMSLChanged(val, "altitudeAMSL");
emit valueChanged(this->uasId,"altitude","M",QVariant(val),getUnixTime()); emit valueChanged(this->uasId,"altitudeAMSL","m",QVariant(val),getUnixTime());
} }
double getAltitude() const double getAltitudeAMSL() const
{ {
return altitude; return altitudeAMSL;
}
void setAltitudeRelative(double val)
{
altitudeRelative = val;
emit altitudeRelativeChanged(val, "altitudeRelative");
emit valueChanged(this->uasId,"altitudeRelative","m",QVariant(val),getUnixTime());
}
double getAltitudeRelative() const
{
return altitudeRelative;
} }
void setSatelliteCount(double val) void setSatelliteCount(double val)
{ {
satelliteCount = val; satelliteCount = val;
emit satelliteCountChanged(val,"satelliteCount"); emit satelliteCountChanged(val,"satelliteCount");
emit valueChanged(this->uasId,"satelliteCount","M",QVariant(val),getUnixTime()); emit valueChanged(this->uasId,"satelliteCount","",QVariant(val),getUnixTime());
} }
double getSatelliteCount() const double getSatelliteCount() const
...@@ -217,7 +240,7 @@ public: ...@@ -217,7 +240,7 @@ public:
{ {
distToWaypoint = val; distToWaypoint = val;
emit distToWaypointChanged(val,"distToWaypoint"); emit distToWaypointChanged(val,"distToWaypoint");
emit valueChanged(this->uasId,"distToWaypoint","M",QVariant(val),getUnixTime()); emit valueChanged(this->uasId,"distToWaypoint","m",QVariant(val),getUnixTime());
} }
double getDistToWaypoint() const double getDistToWaypoint() const
...@@ -229,7 +252,7 @@ public: ...@@ -229,7 +252,7 @@ public:
{ {
bearingToWaypoint = val; bearingToWaypoint = val;
emit bearingToWaypointChanged(val,"bearingToWaypoint"); emit bearingToWaypointChanged(val,"bearingToWaypoint");
emit valueChanged(this->uasId,"bearingToWaypoint","M",QVariant(val),getUnixTime()); emit valueChanged(this->uasId,"bearingToWaypoint","deg",QVariant(val),getUnixTime());
} }
double getBearingToWaypoint() const double getBearingToWaypoint() const
...@@ -414,8 +437,8 @@ protected: //COMMENTS FOR TEST UNIT ...@@ -414,8 +437,8 @@ protected: //COMMENTS FOR TEST UNIT
/// POSITION /// POSITION
bool positionLock; ///< Status if position information is available or not bool positionLock; ///< Status if position information is available or not
bool isLocalPositionKnown; ///< If the local position has been received for this MAV bool isLocalPositionKnown; ///< If the local position has been received for this MAV
bool isGlobalPositionKnown; ///< If the global position has been received for this MAV bool isGlobalPositionKnown; ///< If the global position has been received for this MAV
double localX; double localX;
double localY; double localY;
...@@ -423,7 +446,8 @@ protected: //COMMENTS FOR TEST UNIT ...@@ -423,7 +446,8 @@ 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 altitude; ///< Global altitude as estimated by position estimator double altitudeAMSL; ///< Global altitude 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
bool globalEstimatorActive; ///< Global position estimator present, do not fall back to GPS raw for position bool globalEstimatorActive; ///< Global position estimator present, do not fall back to GPS raw for position
...@@ -439,7 +463,8 @@ protected: //COMMENTS FOR TEST UNIT ...@@ -439,7 +463,8 @@ protected: //COMMENTS FOR TEST UNIT
/// WAYPOINT NAVIGATION /// WAYPOINT NAVIGATION
double distToWaypoint; ///< Distance to next waypoint double distToWaypoint; ///< Distance to next waypoint
double groundSpeed; ///< GPS Groundspeed double airSpeed; ///< Airspeed
double groundSpeed; ///< Groundspeed
double bearingToWaypoint; ///< Bearing to next waypoint double bearingToWaypoint; ///< Bearing to next waypoint
UASWaypointManager waypointManager; UASWaypointManager waypointManager;
...@@ -921,18 +946,16 @@ signals: ...@@ -921,18 +946,16 @@ signals:
void localZChanged(double val,QString name); void localZChanged(double val,QString name);
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 altitudeChanged(double val,QString name); void altitudeAMSLChanged(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);
void yawChanged(double val,QString name); void yawChanged(double val,QString name);
void satelliteCountChanged(double val,QString name); void satelliteCountChanged(double val,QString name);
void distToWaypointChanged(double val,QString name); void distToWaypointChanged(double val,QString name);
void groundSpeedChanged(double val, QString name); void groundSpeedChanged(double val, QString name);
void airSpeedChanged(double val, QString name);
void bearingToWaypointChanged(double val,QString name); void bearingToWaypointChanged(double val,QString name);
//void primaryAltitudeChanged(UASInterface*, double altitude, quint64 usec);
//void gpsAltitudeChanged(UASInterface*, double altitude, quint64 usec);
//void velocityChanged_NED(UASInterface*, double vx, double vy, double vz, quint64 usec);
protected: protected:
/** @brief Get the UNIX timestamp in milliseconds, enter microseconds */ /** @brief Get the UNIX timestamp in milliseconds, enter microseconds */
quint64 getUnixTime(quint64 time=0); quint64 getUnixTime(quint64 time=0);
......
...@@ -124,7 +124,8 @@ public: ...@@ -124,7 +124,8 @@ public:
virtual double getLatitude() const = 0; virtual double getLatitude() const = 0;
virtual double getLongitude() const = 0; virtual double getLongitude() const = 0;
virtual double getAltitude() const = 0; virtual double getAltitudeAMSL() const = 0;
virtual double getAltitudeRelative() const = 0;
virtual bool globalPositionKnown() const = 0; virtual bool globalPositionKnown() const = 0;
virtual double getRoll() const = 0; virtual double getRoll() const = 0;
...@@ -523,16 +524,12 @@ signals: ...@@ -523,16 +524,12 @@ signals:
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 alt, quint64 usec);
void primaryAltitudeChanged(UASInterface*, double altitude, quint64 usec); void altitudeChanged(UASInterface*, double altitudeAMSL, double altitudeRelative, double climbRate, quint64 usec);
void gpsAltitudeChanged(UASInterface*, double altitude, 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);
// The horizontal speed (a scalar) // The horizontal speed (a scalar)
void primarySpeedChanged(UASInterface*, double speed, quint64 usec); void speedChanged(UASInterface* uas, double groundSpeed, double airSpeed, quint64 usec);
void gpsSpeedChanged(UASInterface*, double speed, quint64 usec);
// The vertical speed (a scalar)
void climbRateChanged(UASInterface*, double climb, quint64 usec);
// Consider adding a MAV_FRAME parameter to this; could help specifying what the 3 scalars are. // Consider adding a MAV_FRAME parameter to this; could help specifying what the 3 scalars are.
void velocityChanged_NED(UASInterface*, double vx, double vy, double vz, quint64 usec); void velocityChanged_NED(UASInterface*, double vx, double vy, double vz, quint64 usec);
......
This diff is collapsed.
...@@ -18,11 +18,8 @@ public slots: ...@@ -18,11 +18,8 @@ public slots:
/** @brief Attitude from one specific component / redundant autopilot */ /** @brief Attitude from one specific component / redundant autopilot */
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 updatePrimarySpeed(UASInterface* uas, double speed, quint64 timstamp); void updateSpeed(UASInterface* uas, double _groundSpeed, double _airSpeed, quint64 timestamp);
void updateGPSSpeed(UASInterface* uas, double speed, quint64 timstamp); void updateAltitude(UASInterface* uas, double _altitudeAMSL, double _altitudeRelative, double _climbRate, quint64 timestamp);
void updateClimbRate(UASInterface* uas, double altitude, quint64 timestamp);
void updatePrimaryAltitude(UASInterface* uas, double altitude, quint64 timestamp);
void updateGPSAltitude(UASInterface* uas, double altitude, 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 */
...@@ -102,8 +99,8 @@ private: ...@@ -102,8 +99,8 @@ private:
void drawAICompassDisk(QPainter& painter, QRectF area, float halfspan); void drawAICompassDisk(QPainter& painter, QRectF area, float halfspan);
void drawSeparateCompassDisk(QPainter& painter, QRectF area); void drawSeparateCompassDisk(QPainter& painter, QRectF area);
void drawAltimeter(QPainter& painter, QRectF area, float altitude, float secondaryAltitude, float vv); void drawAltimeter(QPainter& painter, QRectF area);
void drawVelocityMeter(QPainter& painter, QRectF area, float speed, float secondarySpeed); void drawVelocityMeter(QPainter& painter, QRectF area);
void fillInstrumentBackground(QPainter& painter, QRectF edge); void fillInstrumentBackground(QPainter& painter, QRectF edge);
void fillInstrumentOpagueBackground(QPainter& painter, QRectF edge); void fillInstrumentOpagueBackground(QPainter& painter, QRectF edge);
void drawInstrumentBackground(QPainter& painter, QRectF edge); void drawInstrumentBackground(QPainter& painter, QRectF edge);
...@@ -125,24 +122,23 @@ private: ...@@ -125,24 +122,23 @@ private:
SpeedMode speedMode; SpeedMode speedMode;
*/ */
bool didReceivePrimaryAltitude; bool didReceiveSpeed;
bool didReceivePrimarySpeed;
float roll; float roll;
float pitch; float pitch;
float heading; float heading;
float primaryAltitude; float altitudeAMSL;
float GPSAltitude; 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.
// Do !!!NOT!!! ever do altitude calculations at the ground station. There are enough pitfalls already. // Do !!!NOT!!! ever do altitude calculations at the ground station. There are enough pitfalls already.
// If the MP "set home altitude" button is migrated to here, it must set the UAS home altitude, not a GS-local one. // If the MP "set home altitude" button is migrated to here, it must set the UAS home altitude, not a GS-local one.
float aboveHomeAltitude; float aboveHomeAltitude;
float primarySpeed; float groundSpeed;
float groundspeed; float airSpeed;
float verticalVelocity; float climbRate;
float navigationAltitudeError; float navigationAltitudeError;
float navigationSpeedError; float navigationSpeedError;
......
...@@ -306,7 +306,7 @@ void WaypointList::addEditable(bool onCurrentPosition) ...@@ -306,7 +306,7 @@ void WaypointList::addEditable(bool onCurrentPosition)
} else { } else {
updateStatusLabel(tr("Added default GLOBAL (Relative alt.) waypoint.")); updateStatusLabel(tr("Added default GLOBAL (Relative alt.) waypoint."));
} }
wp = new Waypoint(0, uas->getLatitude(), uas->getLongitude(), uas->getAltitude(), 0, WPM->getAcceptanceRadiusRecommendation(), 0, 0,true, true, (MAV_FRAME)WPM->getFrameRecommendation(), MAV_CMD_NAV_WAYPOINT); wp = new Waypoint(0, uas->getLatitude(), uas->getLongitude(), uas->getAltitudeAMSL(), 0, WPM->getAcceptanceRadiusRecommendation(), 0, 0,true, true, (MAV_FRAME)WPM->getFrameRecommendation(), MAV_CMD_NAV_WAYPOINT);
WPM->addWaypointEditable(wp); WPM->addWaypointEditable(wp);
} else { } else {
......
...@@ -462,7 +462,7 @@ void QGCMapWidget::updateGlobalPosition() ...@@ -462,7 +462,7 @@ void QGCMapWidget::updateGlobalPosition()
// Set new lat/lon position of UAV icon // Set new lat/lon position of UAV icon
internals::PointLatLng pos_lat_lon = internals::PointLatLng(system->getLatitude(), system->getLongitude()); internals::PointLatLng pos_lat_lon = internals::PointLatLng(system->getLatitude(), system->getLongitude());
uav->SetUAVPos(pos_lat_lon, system->getAltitude()); uav->SetUAVPos(pos_lat_lon, system->getAltitudeAMSL());
// Follow status // Follow status
if (followUAVEnabled && system->getUASID() == followUAVID) SetCurrentPosition(pos_lat_lon); if (followUAVEnabled && system->getUASID() == followUAVID) SetCurrentPosition(pos_lat_lon);
// Convert from radians to degrees and apply // Convert from radians to degrees and apply
...@@ -490,7 +490,7 @@ void QGCMapWidget::updateLocalPosition() ...@@ -490,7 +490,7 @@ void QGCMapWidget::updateLocalPosition()
// Set new lat/lon position of UAV icon // Set new lat/lon position of UAV icon
internals::PointLatLng pos_lat_lon = internals::PointLatLng(system->getLatitude(), system->getLongitude()); internals::PointLatLng pos_lat_lon = internals::PointLatLng(system->getLatitude(), system->getLongitude());
uav->SetUAVPos(pos_lat_lon, system->getAltitude()); uav->SetUAVPos(pos_lat_lon, system->getAltitudeAMSL());
// Follow status // Follow status
if (followUAVEnabled && system->getUASID() == followUAVID) SetCurrentPosition(pos_lat_lon); if (followUAVEnabled && system->getUASID() == followUAVID) SetCurrentPosition(pos_lat_lon);
// Convert from radians to degrees and apply // Convert from radians to degrees and apply
......
...@@ -682,7 +682,7 @@ Pixhawk3DWidget::selectTargetHeading(void) ...@@ -682,7 +682,7 @@ Pixhawk3DWidget::selectTargetHeading(void)
if (mGlobalViewParams->frame() == MAV_FRAME_GLOBAL) if (mGlobalViewParams->frame() == MAV_FRAME_GLOBAL)
{ {
double altitude = mActiveUAS->getAltitude(); double altitude = mActiveUAS->getAltitudeAMSL();
QPointF cursorWorldCoords = QPointF cursorWorldCoords =
m3DWidget->worldCursorPosition(m3DWidget->mouseCursorCoords(), altitude); m3DWidget->worldCursorPosition(m3DWidget->mouseCursorCoords(), altitude);
...@@ -722,7 +722,7 @@ Pixhawk3DWidget::selectTarget(void) ...@@ -722,7 +722,7 @@ Pixhawk3DWidget::selectTarget(void)
if (mGlobalViewParams->frame() == MAV_FRAME_GLOBAL) if (mGlobalViewParams->frame() == MAV_FRAME_GLOBAL)
{ {
double altitude = mActiveUAS->getAltitude(); double altitude = mActiveUAS->getAltitudeAMSL();
QPointF cursorWorldCoords = QPointF cursorWorldCoords =
m3DWidget->worldCursorPosition(mCachedMousePos, altitude); m3DWidget->worldCursorPosition(mCachedMousePos, altitude);
...@@ -789,7 +789,7 @@ Pixhawk3DWidget::insertWaypoint(void) ...@@ -789,7 +789,7 @@ Pixhawk3DWidget::insertWaypoint(void)
{ {
double latitude = mActiveUAS->getLatitude(); double latitude = mActiveUAS->getLatitude();
double longitude = mActiveUAS->getLongitude(); double longitude = mActiveUAS->getLongitude();
double altitude = mActiveUAS->getAltitude(); double altitude = mActiveUAS->getAltitudeAMSL();
double x, y; double x, y;
QString utmZone; QString utmZone;
Imagery::LLtoUTM(latitude, longitude, x, y, utmZone); Imagery::LLtoUTM(latitude, longitude, x, y, utmZone);
...@@ -845,7 +845,7 @@ Pixhawk3DWidget::moveWaypointPosition(void) ...@@ -845,7 +845,7 @@ Pixhawk3DWidget::moveWaypointPosition(void)
{ {
double latitude = mActiveUAS->getLatitude(); double latitude = mActiveUAS->getLatitude();
double longitude = mActiveUAS->getLongitude(); double longitude = mActiveUAS->getLongitude();
double altitude = mActiveUAS->getAltitude(); double altitude = mActiveUAS->getAltitudeAMSL();
double x, y; double x, y;
QString utmZone; QString utmZone;
Imagery::LLtoUTM(latitude, longitude, x, y, utmZone); Imagery::LLtoUTM(latitude, longitude, x, y, utmZone);
...@@ -1700,7 +1700,7 @@ Pixhawk3DWidget::getPose(UASInterface* uas, ...@@ -1700,7 +1700,7 @@ Pixhawk3DWidget::getPose(UASInterface* uas,
{ {
double latitude = uas->getLatitude(); double latitude = uas->getLatitude();
double longitude = uas->getLongitude(); double longitude = uas->getLongitude();
double altitude = uas->getAltitude(); double altitude = uas->getAltitudeAMSL();
Imagery::LLtoUTM(latitude, longitude, x, y, utmZone); Imagery::LLtoUTM(latitude, longitude, x, y, utmZone);
z = -altitude; z = -altitude;
...@@ -1742,7 +1742,7 @@ Pixhawk3DWidget::getPosition(UASInterface* uas, ...@@ -1742,7 +1742,7 @@ Pixhawk3DWidget::getPosition(UASInterface* uas,
{ {
double latitude = uas->getLatitude(); double latitude = uas->getLatitude();
double longitude = uas->getLongitude(); double longitude = uas->getLongitude();
double altitude = uas->getAltitude(); double altitude = uas->getAltitudeAMSL();
Imagery::LLtoUTM(latitude, longitude, x, y, utmZone); Imagery::LLtoUTM(latitude, longitude, x, y, utmZone);
z = -altitude; z = -altitude;
......
...@@ -632,7 +632,7 @@ void QGCGoogleEarthView::updateState() ...@@ -632,7 +632,7 @@ void QGCGoogleEarthView::updateState()
uasId = currMav->getUASID(); uasId = currMav->getUASID();
lat = currMav->getLatitude(); lat = currMav->getLatitude();
lon = currMav->getLongitude(); lon = currMav->getLongitude();
alt = currMav->getAltitude(); alt = currMav->getAltitudeAMSL();
roll = currMav->getRoll(); roll = currMav->getRoll();
pitch = currMav->getPitch(); pitch = currMav->getPitch();
yaw = currMav->getYaw(); yaw = currMav->getYaw();
......
...@@ -65,7 +65,7 @@ WaypointGroupNode::update(UASInterface* uas, MAV_FRAME frame) ...@@ -65,7 +65,7 @@ WaypointGroupNode::update(UASInterface* uas, MAV_FRAME frame)
{ {
double latitude = uas->getLatitude(); double latitude = uas->getLatitude();
double longitude = uas->getLongitude(); double longitude = uas->getLongitude();
double altitude = uas->getAltitude(); double altitude = uas->getAltitudeAMSL();
QString utmZone; QString utmZone;
Imagery::LLtoUTM(latitude, longitude, robotX, robotY, utmZone); Imagery::LLtoUTM(latitude, longitude, robotX, robotY, utmZone);
...@@ -75,7 +75,7 @@ WaypointGroupNode::update(UASInterface* uas, MAV_FRAME frame) ...@@ -75,7 +75,7 @@ WaypointGroupNode::update(UASInterface* uas, MAV_FRAME frame)
{ {
double latitude = uas->getLatitude(); double latitude = uas->getLatitude();
double longitude = uas->getLongitude(); double longitude = uas->getLongitude();
double altitude = uas->getAltitude() + UASManager::instance()->getHomeAltitude(); double altitude = uas->getAltitudeRelative();
QString utmZone; QString utmZone;
Imagery::LLtoUTM(latitude, longitude, robotX, robotY, utmZone); Imagery::LLtoUTM(latitude, longitude, robotX, robotY, utmZone);
......
...@@ -165,7 +165,6 @@ void UASListWidget::addUAS(UASInterface* uas) ...@@ -165,7 +165,6 @@ void UASListWidget::addUAS(UASInterface* uas)
uWidget = NULL; uWidget = NULL;
} }
} }
if (!uasViews.contains(uas)) if (!uasViews.contains(uas))
{ {
// Only display the UAS in a single link. // Only display the UAS in a single link.
......
...@@ -29,11 +29,10 @@ UASQuickView::UASQuickView(QWidget *parent) : QWidget(parent) ...@@ -29,11 +29,10 @@ UASQuickView::UASQuickView(QWidget *parent) : QWidget(parent)
//If we don't have any predefined settings, set some defaults. //If we don't have any predefined settings, set some defaults.
if (uasPropertyValueMap.size() == 0) if (uasPropertyValueMap.size() == 0)
{ {
valueEnabled("altitude"); valueEnabled("altitudeAMSL");
valueEnabled("altitudeRelative");
valueEnabled("groundSpeed"); valueEnabled("groundSpeed");
valueEnabled("distToWP"); valueEnabled("distToWP");
valueEnabled("yaw");
valueEnabled("roll");
} }
QAction *action = new QAction("Add/Remove Items",this); QAction *action = new QAction("Add/Remove Items",this);
......
...@@ -10,7 +10,6 @@ UASQuickViewTextItem::UASQuickViewTextItem(QWidget *parent) : UASQuickViewItem(p ...@@ -10,7 +10,6 @@ UASQuickViewTextItem::UASQuickViewTextItem(QWidget *parent) : UASQuickViewItem(p
// Create the title label. Scale the font based on available size. // Create the title label. Scale the font based on available size.
titleLabel = new QLabel(this); titleLabel = new QLabel(this);
// <<<<<<< HEAD
titleLabel->setAlignment(Qt::AlignHCenter); titleLabel->setAlignment(Qt::AlignHCenter);
titleLabel->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Minimum); titleLabel->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Minimum);
titleLabel->setObjectName(QString::fromUtf8("title")); titleLabel->setObjectName(QString::fromUtf8("title"));
...@@ -25,18 +24,6 @@ UASQuickViewTextItem::UASQuickViewTextItem(QWidget *parent) : UASQuickViewItem(p ...@@ -25,18 +24,6 @@ UASQuickViewTextItem::UASQuickViewTextItem(QWidget *parent) : UASQuickViewItem(p
valueLabel->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Minimum); valueLabel->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Minimum);
valueLabel->setObjectName(QString::fromUtf8("value")); valueLabel->setObjectName(QString::fromUtf8("value"));
valueLabel->setText("0.00"); valueLabel->setText("0.00");
// =======
// titleLabel->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored);
// titleLabel->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
// this->layout()->addWidget(titleLabel);
// valueLabel = new QLabel(this);
// valueLabel->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored);
// valueLabel->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
// valueLabel->setText("0.00");
// this->layout()->addWidget(valueLabel);
// //spacerItem = new QSpacerItem(20,40,QSizePolicy::Minimum,QSizePolicy::Ignored);
// //layout->addSpacerItem(spacerItem);
// >>>>>>> 34eaf1fb422146f5df3b01fad4d756343b3127c9
QFont valuefont = valueLabel->font(); QFont valuefont = valueLabel->font();
valuefont.setPixelSize(this->height() / 2.0); valuefont.setPixelSize(this->height() / 2.0);
valueLabel->setFont(valuefont); valueLabel->setFont(valuefont);
......
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