Skip to content

getPositionAccuracy() not returning correct values ? #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Niv1900 opened this issue Jan 19, 2021 · 3 comments
Closed

getPositionAccuracy() not returning correct values ? #6

Niv1900 opened this issue Jan 19, 2021 · 3 comments

Comments

@Niv1900
Copy link

Niv1900 commented Jan 19, 2021

Hi @PaulZC,

Thank you for this 2.0.x version. I'm quite a "baby user" here since it's my first issue that I post on github...

I'm having some trouble to use the getPositionAccuracy() function. I'll try to not miss any piece of information.

Workbench

  • NEO-M8N (this product is not officially marked as compatible, but so far all functions are working correctly) ;
  • ESP32 (lolin32) with the Arduino framework ;
  • I²C connection without addition pull-up resistor ;
  • I²C tested at 400 000 Hz and 40 000 Hz ;
  • Everything is powered via the USB cable on the ESP32 ;
  • an IMU is running in parallel via SPI Bus ;
  • compiled code with -O3 flag.
  • the GNSS receiver and module are static since startup

Steps to reproduce

Ok so I'm quite a begginer here, so what I do is that I get all the info I need and put them into a struct for a use in another task, here is my GNSS Task :

void xT_GNSS(void *pvParameters)
{
    TickType_t xLastWakeTime_GNSS;
    xLastWakeTime_GNSS = xTaskGetTickCount();

    while (1)
    {
        vTaskDelayUntil(&xLastWakeTime_GNSS, Tck_GNSS);

        F.GNSS.fix           = myGNSS.getGnssFixOk();
        F.GNSS.latitude      = myGNSS.getLatitude();
        F.GNSS.longitude     = myGNSS.getLongitude();
        F.GNSS.altitude      = myGNSS.getAltitude();
        F.GNSS.fixType       = myGNSS.getFixType();
        F.GNSS.groundSpeed   = myGNSS.getGroundSpeed();
        F.GNSS.heading       = myGNSS.getHeading();
        F.GNSS.PDOP          = myGNSS.getPDOP();
        F.GNSS.SIV           = myGNSS.getSIV();
        F.GNSS.year          = myGNSS.getYear();
        F.GNSS.month         = myGNSS.getMonth();
        F.GNSS.day           = myGNSS.getDay();
        F.GNSS.hour          = myGNSS.getHour();
        F.GNSS.minute        = myGNSS.getMinute();
        F.GNSS.second        = myGNSS.getSecond();
        F.GNSS.millisecond   = myGNSS.getMillisecond();
        F.GNSS.nanosecond    = myGNSS.getNanosecond();
        F.GNSS.PosACC        = myGNSS.getPositionAccuracy(); //? not working :(
    }

    vTaskDelete(NULL);
}

Expected behavior

To have a correct value returned by the getPositionAccuracy() function.

Actual behavior

getPositionAccuracy() function return a very strange result (like 107341414, even if my PDOP is quite near 1).

F.GNSS.PosACC = myGNSS.getPositionAccuracy();

When this line of code is commented I have noticed that everything run faster :

Here it's when getPositionAccuracy() is used :
lent

And here it's when getPositionAccuracy() is not being used :
rapide

(the delta time between each line is around 18ms for both example)

So does a maxdelay is being triggered and then the operation to get the position accuracy is cancelled ?

Thank you, if the problem is only related to the fact that I'm using the NEO-M8N I'm really sorry for creating this issue...

@Niv1900
Copy link
Author

Niv1900 commented Jan 19, 2021

I'm really sorry to have polluted this repo with a real false issue.

While reading SparkFun_u-blox_GNSS_Arduino_Library.h this function is only valid for NEO-M8P and ZED-F9P.

I need to use getHorizontalAccEst() and getVerticalAccEst() since getHorizontalAccuracy() and getVerticalAccuracy() have the same behaviour as getPositionAccuracy().

@Niv1900 Niv1900 closed this as completed Jan 19, 2021
@PaulZC
Copy link
Collaborator

PaulZC commented Jan 19, 2021

Hi @Niv1900 ,

(We have a saying: "There is no such thing as a silly question." Please don't worry about asking questions. We are all learning!)

Your main issue is that getPositionAccuracy comes from the NAV-HPPOSECEF message (which is only supported on u-blox "high precision" modules).
Likewise getHorizontalAccuracy and getVerticalAccuracy come from NAV-HPPOSLLH (which is also "high precision").

getHorizontalAccEst and getVerticalAccEst come from the standard NAV-PVT message - which your NEO does support.

The reason you were seeing an extra delay in your code, is that NAV-PVT was being requested, then NAV-HPPOSECEF was being requested. The NAV-HPPOSECEF request would be NACK'd (Not ACKnowledged), which would take the extra time.

Please have a look at the NAV-PVT Callback example. You may be able to use the UBX_NAV_PVT_data_t struct directly in your ESP code?

Good luck with your project,
Paul

@Niv1900
Copy link
Author

Niv1900 commented Jan 19, 2021

Thank you very much for your answer, everything is crystal clear now.

Oh indeed, the callback system looks nice, I have to play with it !

Looking forward to using this library, thank you @PaulZC.

PaulZC pushed a commit that referenced this issue Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants