diff --git a/flight/OpenPilot/Modules/GPS/GPS.c b/flight/OpenPilot/Modules/GPS/GPS.c index beb7a9ba6..5d20de245 100644 --- a/flight/OpenPilot/Modules/GPS/GPS.c +++ b/flight/OpenPilot/Modules/GPS/GPS.c @@ -425,16 +425,25 @@ void nmeaProcessGPGGA(char* packet) // get altitude (in meters mm.m) tokens = strsep(&packet, delimiter); //reuse variables for alt - deg=strtol (tokens,&pEnd,10); // always 0.1m resolution? + deg=strtol (tokens,&pEnd,10); // always 0.1m resolution? No desim=strtol (pEnd+1,NULL,10); - if(1) // OPGPS 3 desimal + if(1) // OPGPS 3 decimal GpsData.Altitude=deg+desim/1000.0; else GpsData.Altitude=deg+desim/10.0; // next field: altitude units, always 'M' - // next field: geoid seperation - // next field: seperation units + tokens = strsep(&packet, delimiter); + // next field: geoid separation + tokens = strsep(&packet, delimiter); + //reuse variables for geoid separation + deg=strtol (tokens,&pEnd,10); // always 0.1m resolution? No + desim=strtol (pEnd+1,NULL,10); + if(1) // OPGPS 3 decimal + GpsData.GeoidSeparation=deg+desim/1000.0; + else + GpsData.GeoidSeparation=deg+desim/10.0; + // next field: separation units // next field: DGPS age // next field: DGPS station ID // next field: checksum diff --git a/flight/OpenPilot/UAVObjects/inc/positionactual.h b/flight/OpenPilot/UAVObjects/inc/positionactual.h index 6b01caef3..cd619d348 100644 --- a/flight/OpenPilot/UAVObjects/inc/positionactual.h +++ b/flight/OpenPilot/UAVObjects/inc/positionactual.h @@ -33,7 +33,7 @@ #define POSITIONACTUAL_H // Object constants -#define POSITIONACTUAL_OBJID 981132812U +#define POSITIONACTUAL_OBJID 1265479538U #define POSITIONACTUAL_NAME "PositionActual" #define POSITIONACTUAL_METANAME "PositionActualMeta" #define POSITIONACTUAL_ISSINGLEINST 1 @@ -61,6 +61,7 @@ typedef struct { float Latitude; float Longitude; float Altitude; + float GeoidSeparation; float Heading; float Groundspeed; int8_t Satellites; @@ -77,6 +78,7 @@ typedef enum { POSITIONACTUAL_STATUS_NOGPS=0, POSITIONACTUAL_STATUS_NOFIX=1, POS // Field Latitude information // Field Longitude information // Field Altitude information +// Field GeoidSeparation information // Field Heading information // Field Groundspeed information // Field Satellites information diff --git a/ground/src/plugins/uavobjects/positionactual.cpp b/ground/src/plugins/uavobjects/positionactual.cpp index 8a505f516..74eb44f1b 100644 --- a/ground/src/plugins/uavobjects/positionactual.cpp +++ b/ground/src/plugins/uavobjects/positionactual.cpp @@ -57,6 +57,9 @@ PositionActual::PositionActual(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, QStringList AltitudeElemNames; AltitudeElemNames.append("0"); fields.append( new UAVObjectField(QString("Altitude"), QString("meters"), UAVObjectField::FLOAT32, AltitudeElemNames, QStringList()) ); + QStringList GeoidSeparationElemNames; + GeoidSeparationElemNames.append("0"); + fields.append( new UAVObjectField(QString("GeoidSeparation"), QString("meters"), UAVObjectField::FLOAT32, GeoidSeparationElemNames, QStringList()) ); QStringList HeadingElemNames; HeadingElemNames.append("0"); fields.append( new UAVObjectField(QString("Heading"), QString("degrees"), UAVObjectField::FLOAT32, HeadingElemNames, QStringList()) ); diff --git a/ground/src/plugins/uavobjects/positionactual.h b/ground/src/plugins/uavobjects/positionactual.h index 368ef7863..d56fc3cc9 100644 --- a/ground/src/plugins/uavobjects/positionactual.h +++ b/ground/src/plugins/uavobjects/positionactual.h @@ -45,6 +45,7 @@ public: float Latitude; float Longitude; float Altitude; + float GeoidSeparation; float Heading; float Groundspeed; qint8 Satellites; @@ -61,6 +62,7 @@ public: // Field Latitude information // Field Longitude information // Field Altitude information + // Field GeoidSeparation information // Field Heading information // Field Groundspeed information // Field Satellites information @@ -70,7 +72,7 @@ public: // Constants - static const quint32 OBJID = 981132812U; + static const quint32 OBJID = 1265479538U; static const QString NAME; static const bool ISSINGLEINST = 1; static const bool ISSETTINGS = 0; diff --git a/ground/src/plugins/uavobjects/positionactual.py b/ground/src/plugins/uavobjects/positionactual.py index 45a8fede1..5cad0fdd8 100644 --- a/ground/src/plugins/uavobjects/positionactual.py +++ b/ground/src/plugins/uavobjects/positionactual.py @@ -81,6 +81,16 @@ _fields = [ \ { } ), + uavobject.UAVObjectField( + 'GeoidSeparation', + 'f', + 1, + [ + '0', + ], + { + } + ), uavobject.UAVObjectField( 'Heading', 'f', @@ -146,7 +156,7 @@ _fields = [ \ class PositionActual(uavobject.UAVObject): ## Object constants - OBJID = 981132812 + OBJID = 1265479538 NAME = "PositionActual" METANAME = "PositionActualMeta" ISSINGLEINST = 1 diff --git a/ground/src/shared/uavobjectdefinition/positionactual.xml b/ground/src/shared/uavobjectdefinition/positionactual.xml index ab7049130..5d7dbfdae 100644 --- a/ground/src/shared/uavobjectdefinition/positionactual.xml +++ b/ground/src/shared/uavobjectdefinition/positionactual.xml @@ -4,6 +4,7 @@ +