1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

LP-536 add extra DGNSS state to indicate when SBAS information (any differential information in fact) is used for higher accuracy.

This commit is contained in:
Jan NIJS 2017-06-23 19:42:58 +02:00
parent b5a42dc489
commit 6f3fefd650
10 changed files with 25 additions and 11 deletions

View File

@ -416,7 +416,7 @@ static void gpsTask(__attribute__((unused)) void *parameters)
//
// if (the fix is good) {
if ((gpspositionsensor.PDOP < gpsSettings.MaxPDOP) && (gpspositionsensor.Satellites >= gpsSettings.MinSatellites) &&
(gpspositionsensor.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) &&
((gpspositionsensor.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) || (gpspositionsensor.Status == GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS)) &&
(gpspositionsensor.Latitude != 0 || gpspositionsensor.Longitude != 0)) {
AlarmsClear(SYSTEMALARMS_ALARM_GPS);
#ifdef PIOS_GPS_SETS_HOMELOCATION
@ -436,7 +436,7 @@ static void gpsTask(__attribute__((unused)) void *parameters)
}
#endif
// else if (we are at least getting what might be usable GPS data to finish a flight with) {
} else if ((gpspositionsensor.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) &&
} else if (((gpspositionsensor.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) || (gpspositionsensor.Status == GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS)) &&
(gpspositionsensor.Latitude != 0 || gpspositionsensor.Longitude != 0)) {
AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_WARNING);
// else data is probably not good enough to fly

View File

@ -337,7 +337,7 @@ static void parse_ubx_nav_sol(struct UBXPacket *ubx, GPSPositionSensorData *GpsP
GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_FIX2D;
break;
case STATUS_GPSFIX_3DFIX:
GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_FIX3D;
GpsPosition->Status = (sol->flags & STATUS_FLAGS_DIFFSOLN) ? GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS : GPSPOSITIONSENSOR_STATUS_FIX3D;
break;
default: GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_NOFIX;
}
@ -399,10 +399,18 @@ static void parse_ubx_nav_pvt(struct UBXPacket *ubx, GPSPositionSensorData *GpsP
GpsPosition->Longitude = pvt->lon;
GpsPosition->Satellites = pvt->numSV;
GpsPosition->PDOP = pvt->pDOP * 0.01f;
if (pvt->flags & PVT_FLAGS_GNSSFIX_OK) {
GpsPosition->Status = pvt->fixType == PVT_FIX_TYPE_3D ?
GPSPOSITIONSENSOR_STATUS_FIX3D : GPSPOSITIONSENSOR_STATUS_FIX2D;
} else {
switch (pvt->fixType) {
case PVT_FIX_TYPE_2D:
GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_FIX2D;
break;
case PVT_FIX_TYPE_3D:
GpsPosition->Status = (pvt->flags & PVT_FLAGS_DIFFSOLN) ? GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS : GPSPOSITIONSENSOR_STATUS_FIX3D;
break;
default: GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_NOFIX;
}
} else { // fix is not valid so we make sure to treat is as NOFIX
GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_NOFIX;
}

View File

@ -450,7 +450,7 @@ static void Run(void)
// positionData.Status, positionData.Satellites, (uint32_t)positionData.Altitude);
// GPS Status
if (positionData.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) {
if ((positionData.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) || (positionData.Status == GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS)) {
msg[OSDMSG_GPS_STAT] = OSDMSG_GPS_STAT_FIX;
} else {
msg[OSDMSG_GPS_STAT] = OSDMSG_GPS_STAT_NOFIX;

View File

@ -104,7 +104,7 @@ static filterResult filter(__attribute__((unused)) stateFilter *self, stateEstim
// check if we have a valid GPS signal (not checked by StateEstimation istelf)
if ((gpsdata.PDOP < this->settings.MaxPDOP) && (gpsdata.Satellites >= this->settings.MinSatellites) &&
(gpsdata.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) &&
((gpsdata.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) || (gpsdata.Status == GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS))&&
(gpsdata.Latitude != 0 || gpsdata.Longitude != 0)) {
int32_t LLAi[3] = {
gpsdata.Latitude,

View File

@ -382,6 +382,7 @@ static void uavoFrSKYSensorHubBridgeTask(__attribute__((unused)) void *parameter
status = 300;
break;
case GPSPOSITIONSENSOR_STATUS_FIX3D:
case GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS:
if (hl_set == HOMELOCATION_SET_TRUE) {
status = 500;
} else {
@ -419,7 +420,8 @@ static void uavoFrSKYSensorHubBridgeTask(__attribute__((unused)) void *parameter
msg_length += frsky_pack_temperature_02((vdop * 256 + hdop), shub_global->serial_buf + msg_length);
if (gpsPosData.Status == GPSPOSITIONSENSOR_STATUS_FIX2D ||
gpsPosData.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) {
gpsPosData.Status == GPSPOSITIONSENSOR_STATUS_FIX3D ||
gpsPosData.Status == GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS) {
msg_length += frsky_pack_gps(
gpsPosData.Heading,
gpsPosData.Latitude,

View File

@ -357,6 +357,7 @@ uint16_t build_GPS_message(struct hott_gps_message *msg)
msg->gps_fix_char = '2';
break;
case GPSPOSITIONSENSOR_STATUS_FIX3D:
case GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS:
msg->gps_fix_char = '3';
break;
default:

View File

@ -320,6 +320,7 @@ static void mavlink_send_position()
gps_fix_type = 2;
break;
case GPSPOSITIONSENSOR_STATUS_FIX3D:
case GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS:
gps_fix_type = 3;
break;
}

View File

@ -94,6 +94,8 @@ void GpsDisplayWidget::setFixType(const QString &fixtype)
fix_value->setText("2D");
} else if (fixtype == "Fix3D") {
fix_value->setText("3D");
} else if (fixtype == "Fix3DDGNSS") {
fix_value->setText("3D/DGNSS");
} else {
fix_value->setText("Unknown");
}

View File

@ -276,7 +276,7 @@ function gpsAltitude() {
}
function gpsStatus() {
var gpsStatusText = ["NO GPS", "NO FIX", "2D", "3D"];
var gpsStatusText = ["NO GPS", "NO FIX", "2D", "3D", "3D"];
if (gpsStatusText.length != GPSPositionSensor.GPSPositionSensorConstants.StatusCount) {
console.log("uav.js: gpsStatus() do not match gpsPositionSensor.status uavo");

View File

@ -1,7 +1,7 @@
<xml>
<object name="GPSPositionSensor" singleinstance="true" settings="false" category="Sensors">
<description>Raw GPS data from @ref GPSModule.</description>
<field name="Status" units="" type="enum" elements="1" options="NoGPS,NoFix,Fix2D,Fix3D"/>
<field name="Status" units="" type="enum" elements="1" options="NoGPS,NoFix,Fix2D,Fix3D,Fix3DDGNSS"/>
<field name="Latitude" units="degrees x 10^-7" type="int32" elements="1"/>
<field name="Longitude" units="degrees x 10^-7" type="int32" elements="1"/>
<field name="Altitude" units="meters" type="float" elements="1"/>