From ec1661befca85fb0a37c872fe1690e80538ea178 Mon Sep 17 00:00:00 2001 From: Balamurugan Kandan Date: Tue, 3 Nov 2020 20:56:47 +0000 Subject: [PATCH 1/3] NAV-PVT velocity parameters parsed. --- src/SparkFun_Ublox_Arduino_Library.cpp | 65 +++++++++++++++++++++++++- src/SparkFun_Ublox_Arduino_Library.h | 19 ++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/SparkFun_Ublox_Arduino_Library.cpp b/src/SparkFun_Ublox_Arduino_Library.cpp index 81994a1..7011ca5 100644 --- a/src/SparkFun_Ublox_Arduino_Library.cpp +++ b/src/SparkFun_Ublox_Arduino_Library.cpp @@ -986,6 +986,12 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg) latitude = extractLong(28 - startingSpot); altitude = extractLong(32 - startingSpot); altitudeMSL = extractLong(36 - startingSpot); + horizontalAccEst = extractLong(40 - startingSpot); + verticalAccEst = extractLong(44 - startingSpot); + nedNorthVel = extractLong(48 - startingSpot); + nedEastVel = extractLong(52 - startingSpot); + nedDownVel = extractLong(56 - startingSpot); + groundSpeed = extractLong(60 - startingSpot); headingOfMotion = extractLong(64 - startingSpot); pDOP = extractInt(76 - startingSpot); @@ -1007,6 +1013,13 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg) moduleQueried.latitude = true; moduleQueried.altitude = true; moduleQueried.altitudeMSL = true; + + moduleQueried.horizontalAccEst = true; + moduleQueried.verticalAccEst = true; + moduleQueried.nedNorthVel = true; + moduleQueried.nedEastVel = true; + moduleQueried.nedDownVel = true; + moduleQueried.SIV = true; moduleQueried.fixType = true; moduleQueried.carrierSolution = true; @@ -3308,6 +3321,56 @@ int32_t SFE_UBLOX_GPS::getAltitudeMSL(uint16_t maxWait) return (altitudeMSL); } +int32_t SFE_UBLOX_GPS::getHorizontalAccEst(uint16_t maxWait) +{ + if (moduleQueried.horizontalAccEst == false) + getPVT(maxWait); + moduleQueried.horizontalAccEst = false; //Since we are about to give this to user, mark this data as stale + moduleQueried.all = false; + + return (horizontalAccEst); +} + +int32_t SFE_UBLOX_GPS::getVerticalAccEst(uint16_t maxWait) +{ + if (moduleQueried.verticalAccEst == false) + getPVT(maxWait); + moduleQueried.verticalAccEst = false; //Since we are about to give this to user, mark this data as stale + moduleQueried.all = false; + + return (verticalAccEst); +} + +int32_t SFE_UBLOX_GPS::getNedNorthVel(uint16_t maxWait) +{ + if (moduleQueried.nedNorthVel == false) + getPVT(maxWait); + moduleQueried.nedNorthVel = false; //Since we are about to give this to user, mark this data as stale + moduleQueried.all = false; + + return (nedNorthVel); +} + +int32_t SFE_UBLOX_GPS::getNedEastVel(uint16_t maxWait) +{ + if (moduleQueried.nedEastVel == false) + getPVT(maxWait); + moduleQueried.nedEastVel = false; //Since we are about to give this to user, mark this data as stale + moduleQueried.all = false; + + return (nedEastVel); +} + +int32_t SFE_UBLOX_GPS::getNedDownVel(uint16_t maxWait) +{ + if (moduleQueried.nedDownVel == false) + getPVT(maxWait); + moduleQueried.nedDownVel = false; //Since we are about to give this to user, mark this data as stale + moduleQueried.all = false; + + return (nedDownVel); +} + //Get the number of satellites used in fix uint8_t SFE_UBLOX_GPS::getSIV(uint16_t maxWait) { @@ -3800,4 +3863,4 @@ bool SFE_UBLOX_GPS::setStaticPosition(int32_t ecefXOrLat, int8_t ecefXOrLatHP, i bool SFE_UBLOX_GPS::setStaticPosition(int32_t ecefXOrLat, int32_t ecefYOrLon, int32_t ecefZOrAlt, bool latlong, uint16_t maxWait) { return (setStaticPosition(ecefXOrLat, 0, ecefYOrLon, 0, ecefZOrAlt, 0, latlong, maxWait)); -} \ No newline at end of file +} diff --git a/src/SparkFun_Ublox_Arduino_Library.h b/src/SparkFun_Ublox_Arduino_Library.h index 7405335..e84498a 100644 --- a/src/SparkFun_Ublox_Arduino_Library.h +++ b/src/SparkFun_Ublox_Arduino_Library.h @@ -508,6 +508,13 @@ class SFE_UBLOX_GPS int32_t getLongitude(uint16_t maxWait = getPVTmaxWait); //Returns the current longitude in degrees * 10-7. Auto selects between HighPrecision and Regular depending on ability of module. int32_t getAltitude(uint16_t maxWait = getPVTmaxWait); //Returns the current altitude in mm above ellipsoid int32_t getAltitudeMSL(uint16_t maxWait = getPVTmaxWait); //Returns the current altitude in mm above mean sea level + + int32_t getHorizontalAccEst(uint16_t maxWait = getPVTmaxWait); + int32_t getVerticalAccEst(uint16_t maxWait = getPVTmaxWait); + int32_t getNedNorthVel(uint16_t maxWait = getPVTmaxWait); + int32_t getNedEastVel(uint16_t maxWait = getPVTmaxWait); + int32_t getNedDownVel(uint16_t maxWait = getPVTmaxWait); + uint8_t getSIV(uint16_t maxWait = getPVTmaxWait); //Returns number of sats used in fix uint8_t getFixType(uint16_t maxWait = getPVTmaxWait); //Returns the type of fix: 0=no, 3=3D, 4=GNSS+Deadreckoning uint8_t getCarrierSolutionType(uint16_t maxWait = getPVTmaxWait); //Returns RTK solution: 0=no, 1=float solution, 2=fixed solution @@ -691,6 +698,11 @@ class SFE_UBLOX_GPS int32_t longitude; //Degrees * 10^-7 (more accurate than floats) int32_t altitude; //Number of mm above ellipsoid int32_t altitudeMSL; //Number of mm above Mean Sea Level + uint32_t horizontalAccEst; + uint32_t verticalAccEst; + int32_t nedNorthVel; + int32_t nedEastVel; + int32_t nedDownVel; uint8_t SIV; //Number of satellites used in position solution uint8_t fixType; //Tells us when we have a solution aka lock uint8_t carrierSolution; //Tells us when we have an RTK float/fixed solution @@ -877,6 +889,13 @@ class SFE_UBLOX_GPS uint32_t latitude : 1; uint32_t altitude : 1; uint32_t altitudeMSL : 1; + + uint32_t horizontalAccEst : 1; + uint32_t verticalAccEst : 1; + uint32_t nedNorthVel : 1; + uint32_t nedEastVel : 1; + uint32_t nedDownVel : 1; + uint32_t SIV : 1; uint32_t fixType : 1; uint32_t carrierSolution : 1; From 2f3493cd30783a0777ca3bc3f70caa9151b99b0f Mon Sep 17 00:00:00 2001 From: Balamurugan Kandan Date: Wed, 4 Nov 2020 09:53:25 +0000 Subject: [PATCH 2/3] keywords.txt file is updated for newly added functions. --- keywords.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/keywords.txt b/keywords.txt index 08b919c..66b7b65 100644 --- a/keywords.txt +++ b/keywords.txt @@ -53,6 +53,11 @@ getGroundSpeed KEYWORD2 getHeading KEYWORD2 getPDOP KEYWORD2 getTimeOfWeek KEYWORD2 +getHorizontalAccEst KEYWORD2 +getVerticalAccEst KEYWORD2 +getNedNorthVel KEYWORD2 +getNedEastVel KEYWORD2 +getNedDownVel KEYWORD2 setPortOutput KEYWORD2 setPortInput KEYWORD2 From 436486b84de1f90d62f225d5b90760363a8a6781 Mon Sep 17 00:00:00 2001 From: Balamurugan Kandan Date: Wed, 4 Nov 2020 10:18:36 +0000 Subject: [PATCH 3/3] NAV-PVT newly added functions demonstrated in example and keywords.txt corrected. --- .../Example1_AutoPVT/Example1_AutoPVT.ino | 27 ++++++++++++++++++- keywords.txt | 10 +++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/examples/Example13_PVT/Example1_AutoPVT/Example1_AutoPVT.ino b/examples/Example13_PVT/Example1_AutoPVT/Example1_AutoPVT.ino index 28ffa26..b5dd97e 100644 --- a/examples/Example13_PVT/Example1_AutoPVT/Example1_AutoPVT.ino +++ b/examples/Example13_PVT/Example1_AutoPVT/Example1_AutoPVT.ino @@ -78,7 +78,32 @@ void loop() int PDOP = myGPS.getPDOP(); Serial.print(F(" PDOP: ")); Serial.print(PDOP); - Serial.print(F(" (10^-2)")); + Serial.print(F(" (10^-2)")); + + int nedNorthVel = myGPS.getNedNorthVel(); + Serial.print(F(" VelN: ")); + Serial.print(nedNorthVel); + Serial.print(F(" (mm/s)")); + + int nedEastVel = myGPS.getNedEastVel(); + Serial.print(F(" VelE: ")); + Serial.print(nedEastVel); + Serial.print(F(" (mm/s)")); + + int nedDownVel = myGPS.getNedDownVel(); + Serial.print(F(" VelD: ")); + Serial.print(nedDownVel); + Serial.print(F(" (mm/s)")); + + int verticalAccEst = myGPS.getVerticalAccEst(); + Serial.print(F(" VAccEst: ")); + Serial.print(verticalAccEst); + Serial.print(F(" (mm)")); + + int horizontalAccEst = myGPS.getHorizontalAccEst(); + Serial.print(F(" HAccEst: ")); + Serial.print(horizontalAccEst); + Serial.print(F(" (mm)")); Serial.println(); } else { diff --git a/keywords.txt b/keywords.txt index 66b7b65..f3f9dcf 100644 --- a/keywords.txt +++ b/keywords.txt @@ -53,11 +53,11 @@ getGroundSpeed KEYWORD2 getHeading KEYWORD2 getPDOP KEYWORD2 getTimeOfWeek KEYWORD2 -getHorizontalAccEst KEYWORD2 -getVerticalAccEst KEYWORD2 -getNedNorthVel KEYWORD2 -getNedEastVel KEYWORD2 -getNedDownVel KEYWORD2 +getHorizontalAccEst KEYWORD2 +getVerticalAccEst KEYWORD2 +getNedNorthVel KEYWORD2 +getNedEastVel KEYWORD2 +getNedDownVel KEYWORD2 setPortOutput KEYWORD2 setPortInput KEYWORD2