Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

NAV-PVT velocity parameters parsed. #146

Merged
merged 3 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion examples/Example13_PVT/Example1_AutoPVT/Example1_AutoPVT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
65 changes: 64 additions & 1 deletion src/SparkFun_Ublox_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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));
}
}
19 changes: 19 additions & 0 deletions src/SparkFun_Ublox_Arduino_Library.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down