Skip to content
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

Landing predictions become inf / nan #49

Open
KevWal opened this issue Aug 23, 2022 · 16 comments
Open

Landing predictions become inf / nan #49

KevWal opened this issue Aug 23, 2022 · 16 comments

Comments

@KevWal
Copy link
Contributor

KevWal commented Aug 23, 2022

Playing back this GPS track: https://github.com/KevWal/pits/blob/63f0a1918b78d8278c807f693a08f81b01c122c2/nmea/Friday-No-GSV-VTG.NMEA

I get issues with the prediction code:

LORA0: $$KW01,236,21:03:57,52.01939,-0.15447,17022,35,83,5,31.3,4.317,0.99,52.29643,2.62463,3.3,3333,-70,6,22,NBA6C
...
LORA0: $$KW01,237,21:04:16,52.01968,-0.15169,16838,1,0,5,31.2,4.273,0.97,52.29172,2.58097,3.3,3270,-64,8,23,N
8479
...
LORA0: $$KW01,238,21:04:27,52.01996,-0.14920,16674,35,83,5,31.2,4.356,inf, nan, nan,0.0,2147483647,-64,8,23,N1051
...
LORA0: $$KW01,239,21:04:27,52.02020,-0.14700,16529,35,77,5,31.2,4.311,inf, nan, nan,0.0,2147483647,-64,8,23,N
BCD6

Playing it back a second time, I get the same thing (Scroll back buffer didnt go back far enough to find the start of the issue):

LORA0: $$KW01,254,22:39:14,52.03025,0.02985,11048,87,91,5,30.4,4.350,inf, nan, nan,0.0,2147483647,-62,6,64,N6B11
...
LORA0: $$KW01,255,22:39:30,52.03013,0.03556,10942,87,91,5,30.6,4.276,inf, nan, nan,0.0,2147483647,-62,6,64,N
0E80
...
LORA0: $$KW01,256,22:39:47,52.02990,0.04163,10833,87,92,5,30.6,4.353,inf, nan, nan,0.0,2147483647,-62,6,64,N*3319

Interestingly, 2 values are fixed again at the very end of the playback:

LORA0: SSDV image 176 packet 79 of 114
LORA0: $$KW01,408,23:19:34,51.99414,0.58410,00126,20,92,5,31.0,4.346,inf, nan, nan,0.0,2147483647,-60,6,95,NC940
LORA0: SSDV image 176 packet 80 of 114
LORA0: $$KW01,409,23:19:35,51.99412,0.58437,00116,20,92,5,31.0,4.263,inf, nan, nan,0.0,2147483647,-60,6,95,N
2BA4
LORA0: SSDV image 176 packet 81 of 114
LORA0: $$KW01,410,23:19:35,51.99412,0.58454,00109,20,92,5,31.0,4.263,inf, nan, nan,0.0,2147483647,-60,6,95,ND6F9
LORA0: ^^KW01,434.712,1,2,48,96,0
07DE
LORA0: SSDV image 176 packet 82 of 114
LORA0: $$KW01,411,23:19:45,51.99410,0.58506,00090,14,90,5,30.9,4.263,inf,51.99411,0.58481,0.0,0,-60,6,95,NAA24
LORA0: SSDV image 176 packet 83 of 114
LORA0: $$KW01,412,23:19:47,51.99410,0.58519,00084,1,0,5,30.9,4.300,inf,51.99410,0.58519,0.0,0,-60,6,95,N
1E58
LORA0: SSDV image 176 packet 84 of 114
LORA0: $$KW01,413,23:19:53,51.99410,0.58560,00065,14,90,5,30.9,4.300,inf,51.99410,0.58519,0.0,0,-60,6,95,N*FFFA

Cheers
Kev

@PiInTheSky
Copy link
Owner

PiInTheSky commented Aug 24, 2022 via email

@PiInTheSky
Copy link
Owner

PiInTheSky commented Aug 24, 2022 via email

@KevWal
Copy link
Contributor Author

KevWal commented Aug 24, 2022 via email

@KevWal
Copy link
Contributor Author

KevWal commented Aug 24, 2022

Can you send me your NMEA file please, and I'll set this up today. Dave

Hi Dave,

File attached (I had to add .txt at the end to let me upload it), or also linked on gihub in the mesage above.

Cheers
Kev

Friday-No-GSV-VTG.NMEA.txt

@KevWal
Copy link
Contributor Author

KevWal commented Aug 24, 2022

Second example (https://github.com/KevWal/pits/blob/develop/nmea/XABEN11.NMEA) re running, currently it is on the way up, it broke on the way down here last night:

image

(where the descent becomes vertical)

@KevWal
Copy link
Contributor Author

KevWal commented Aug 24, 2022

Just caught the break before it scrolled out of the buffer! :)

LORA0: $$KW01,690,12:43:13,52.06396,0.65472,24148,3,0,5,28.1,4.356,1.29,51.96360,1.03043,2.9,4435,0,0,0,N3E5E
LORA0: $$KW01,691,12:43:38,52.06362,0.65289,23761,0,0,5,28.0,4.305,1.75,51.94694,1.09340,2.5,5149,0,0,0,N
ACC0
LORA0: $$KW01,692,12:43:54,52.06353,0.65208,23532,0,0,5,28.1,4.199,1.67,51.94973,1.08321,2.5,5016,0,0,0,N6A25
LORA0: $$KW01,693,12:44:18,52.06343,0.65094,23189,22,265,5,28.3,4.366,inf, nan, nan,0.0,2147483647,0,0,0,N
B52C
LORA0: $$KW01,695,12:44:51,52.06330,0.64941,22732,22,265,5,28.4,4.252,inf, nan, nan,0.0,2147483647,0,0,0,N8601
LORA0: $$KW01,696,12:45:11,52.06321,0.64857,22427,0,0,5,28.3,4.363,inf, nan, nan,0.0,2147483647,0,0,0,N
4276

Will leave it running as yesterday it fixed its self at the very end.

Cheers
Kev

@PiInTheSky
Copy link
Owner

PiInTheSky commented Aug 24, 2022 via email

@KevWal
Copy link
Contributor Author

KevWal commented Aug 24, 2022

Want to send me your NMEA and I can run here once https://github.com/KevWal/pits/blob/develop/nmea/XABEN11.NMEA is finished?

@KevWal
Copy link
Contributor Author

KevWal commented Aug 24, 2022

XABEN11 now finished here, and as per my run last night, the nan's worked at the very end, but not the inf:

LORA0: $$KW01,927,13:47:06,51.98930,0.95826,00109,0,0,5,31.0,4.246,inf, nan, nan,0.0,2147483647,0,0,0,NE15C
LORA0: $$KW01,928,13:47:09,51.98926,0.95841,00103,39,103,5,31.0,4.246,inf, nan, nan,0.0,2147483647,0,0,0,N
AE8B
LORA0: $$KW01,929,13:47:11,51.98918,0.95871,00090,0,0,5,31.1,4.246,inf,51.98923,0.95856,0.0,0,0,0,0,N9898
LORA0: $$KW01,930,13:47:14,51.98915,0.95886,00083,0,0,5,31.1,4.246,inf,51.98923,0.95856,0.0,0,0,0,0,N
466D

Appretiate you looking into this.

Cheers
Kev

@daveake
Copy link
Collaborator

daveake commented Aug 24, 2022 via email

@KevWal
Copy link
Contributor Author

KevWal commented Aug 25, 2022

@daveake
Copy link
Collaborator

daveake commented Aug 25, 2022 via email

@daveake
Copy link
Collaborator

daveake commented Aug 25, 2022 via email

@KevWal
Copy link
Contributor Author

KevWal commented Aug 25, 2022

And I now no longer get it to fail, tried both NMEA files, tried printing or not printing debug stuff, just works every time now, and I cant think of anythnig changed!

I have now added some isnormal() code just in case, dont want it breaking again in flight...

        // Landing Prediction, if enabled and not a seperate sentence
        if (Config.EnableLandingPrediction && (Config.PredictionID[0] == '\0'))
        {
                if (!isnormal(GPS->CDA))
                {
                        printf("ERROR: GPS->CDA not normal!\n");
                        GPS->CDA = 0;
                }
                if (!isnormal(GPS->PredictedLatitude))
                {
                        printf("ERROR: GPS->PredictedLatitude not normal!\n");
                        GPS->PredictedLatitude = 0;
                }
                if (!isnormal(GPS->PredictedLongitude))
                {
                        printf("ERROR: GPS->PredictedLongitude not normal!\n");
                        GPS->PredictedLongitude = 0;
                }
                if (!isnormal(GPS->PredictedLandingSpeed))
                {
                        printf("ERROR: GPS->PredictedLandingSpeed\n");
                        GPS->PredictedLandingSpeed = 0;
                }

Thanks for trying to reproduce. I'll come back here if I see it again!

Cheers
Kev

@PiInTheSky
Copy link
Owner

PiInTheSky commented Aug 25, 2022 via email

@daveake
Copy link
Collaborator

daveake commented Oct 11, 2022 via email

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

3 participants