sparkfun / SparkFun_u-blox_GNSS_Arduino_Library

An Arduino library which allows you to communicate seamlessly with the full range of u-blox GNSS modules
Other
218 stars 99 forks source link

Some extra function #155

Closed jan5650 closed 1 year ago

jan5650 commented 1 year ago

Hi Guys!

You did great job with this libraray. But sadly some function missed, that i realy want to use.

It would be great, when there will be a function, wich i can measure Distance and Bearingto between two gps coordinate.

Can you write a function for it? NEOGps libraray got it, but sadly i cannot implement it by myself

Thank you for your work!

PaulZC commented 1 year ago

Hi @jan5650 ,

I do not want to add the code for calculating the "Great Circle Distance" directly into the library as it takes up a significant amount of memory. However, I have added a new example showing how you can calculate the distance and course between two points. Please see the v2.2.16 release notes for more details.

Best wishes, Paul

jan5650 commented 1 year ago

Thank you for the example!

Can i do a last question?

In this library there is a lot of "Heading" type value. What's the different between them?

getATTheading, getHeading, getHeadingAccEst, getVehicleHeading, getMotionHeading, getHNRheading

I want the heading to where my vechile moving. Because there is no Compass, i can only compute heading by two GPS coordinate. Wich one i need to use fot the best resoult, or is there any meethod?

Thank you!

PaulZC commented 1 year ago

Hi @jan5650 ,

getHeading is the one you need. It returns the 2D "heading of motion" (headMot) from the UBX-NAV-PVT message.

getVehicleHeading is only relevant for sensors which have an internal Inertial Measurement Unit (IMU). It returns the "heading of vehicle" (vehHeading) from the UBX-NAV-PVAT message and compensates for the attitude of the vehicle.

getMotionHeading returns the heading of motion from the UBX-NAV-PVAT message.

getHNRheading is only relevant for sensors that support High Navigation Rate.

getATTheading is only relevant for sensors that support UBX-NAV-ATT and have a built-in IMU.

Best wishes, Paul

jan5650 commented 1 year ago

Thank you very much, you helped me a lot!

I have one more question: I would like to check somehow if there is GPS fixation, because if there are a sufficient number of satellites, I only start certain calculations when I have a sufficiently accurate latitude-longitude data. As long as there are only 0-5 satellites fixation I don't even start calculations because it is so inaccurate.

So far I have related this to the number of satellites. There was a value in the NEOGps Library that gave back the number of satelites of fixation.

In this libraries how can I get the number of satellites. I wonder if there is a better way? Maybe there is another methode?

PaulZC commented 1 year ago

Hi @jan5650 ,

getFixType() will tell you if you have a 3D fix (getFixType() == 3).

getSIV() will tell you the number of satellites used in the navigation solution. SIV means "Satellites In View" - an old term - but the number returned is actually the number of satellites used in the navigation solution.

getHorizontalAccEst() returns the horizontal accuracy estimate in mm. If you wait until getHorizontalAccEst() < 3000 you know you have a good fix.

Best wishes, Paul

jan5650 commented 1 year ago

Wow! You are so on Top!

If I set:

// Turning off NMEA on both output myGNSS.setUART1Output(COM_TYPE_UBX); myGNSS.setI2COutput(COM_TYPE_UBX);

myGNSS.setMeasurementRate(200) myGNSS.setNavigationRate(1) myGNSS.saveConfiguration();

Then i get a module with 5Hz, that gives output from current latitude and longtitude in every 200ms. And then i need to call myGNSS.getLatitude(); and myGNSS.getLongitude(); in every loop after 200ms?

Am i right?

PaulZC commented 1 year ago

Please see:

https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/blob/main/examples/Example25_MeasurementAndNavigationRate/Example25_MeasurementAndNavigationRate.ino