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

Glonass : avoid passing corrupt ephemeris and TOW measurements to observables #655

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

vladisslav2011
Copy link
Contributor

@vladisslav2011 vladisslav2011 commented Aug 26, 2022

Implemented Glonass ephemeris validation (much the same as with BeiDou).

Demonstration: https://www.youtube.com/watch?v=QvpAruQmgy8
GPS+Galileo for comparison: https://www.youtube.com/watch?v=WA-wMrXQyWg

@vladisslav2011 vladisslav2011 changed the title Glonass ephemeris validation Glonass : avoid passing corrupt ephemeris and TOW measurements to an observables Aug 26, 2022
@vladisslav2011 vladisslav2011 changed the title Glonass : avoid passing corrupt ephemeris and TOW measurements to an observables Glonass : avoid passing corrupt ephemeris and TOW measurements to observables Aug 26, 2022
@vladisslav2011 vladisslav2011 marked this pull request as draft August 26, 2022 13:19
@vladisslav2011 vladisslav2011 force-pushed the glonass_ephemeris_validation branch 2 times, most recently from 15c6d74 to 10877bd Compare August 26, 2022 13:35
@vladisslav2011 vladisslav2011 marked this pull request as ready for review August 26, 2022 14:59
@vladisslav2011
Copy link
Contributor Author

vladisslav2011 commented Sep 1, 2022

Have you seen the updated test:

for (int k = 8; k < 85; k++)
{
std::bitset<GLONASS_GNAV_STRING_BITS> corrupt_bits = bits;
corrupt_bits[k] = corrupt_bits[k] ? false : true;
ASSERT_TRUE(gnav_msg.CRC_test(corrupt_bits));
ASSERT_TRUE(corrupt_bits == bits);
}
?
I'm checking, that every flipped data bit is being corrected by Glonass_Gnav_Navigation_Message::CRC_test. If not so, the test would fail and the CI would not pass.

It does not give much improvement because single bit errors do not happen frequently (in my tests). The string is either completely broken with many flipped bits and is uncorrectable (ephemeris corruption is handled by the validator in this case) or the string does not have any flipped bits.

@vladisslav2011
Copy link
Contributor Author

@ZaquL

Maybe to be completly sure, one should check those data?

No problem. Test data added.

@vladisslav2011 vladisslav2011 marked this pull request as draft September 7, 2022 21:11
@vladisslav2011
Copy link
Contributor Author

I have all tests passing on my local machine. Let's wait for the CI to complete.

@carlesfernandez
Copy link
Member

I’m not sure if this is the way to go. Ephemeris data have their own validation mechanism, and I feel this external validation is somewhat heuristic. In this sense, I prefer the implementation at #667, which seems to stick to the ICD.

However, this is a good idea that worth exploring it further, maybe as an anti-spoofing mechanism. Thanks for your work.

@vladisslav2011
Copy link
Contributor Author

@ValZapod
It looks like this PR follows additional recommendations from creators of Glonass.

@carlesfernandez
My tests are showing, that existing validation mechanism fails too often with real world signals (a signal from a vehicle-mounted antenna when driving through a city for example). This validator makes GNSS-SDR produce a better track with less position jumps and much more valid points.
I don't think, that this validator may help in case of spoofing. The GNSS-SDR will still switch to spoofed ephemeris after n frames.
Should I rebase the ECC error correction on top of next and open a separate PR?

@carlesfernandez
Copy link
Member

Yes, please, make another PR only with the ECC error correction.

Implement generic ephemeris validator:
Keep previous and last valid ephemeris.
Compare received ephemeris to previous and last valid.
Count successful comparisions.
Update last valid ephemeris if count reaches threshold.

Add telemetry decoder configuration parameters:

int32_t TelemetryDecoder_B1.ecc_reject - reject ephemeris if the ECC error
counter reaches this value

int32_t TelemetryDecoder_B1.ecc_resync - resync telemetry decoder if the ECC
error counter reaches this value

int32_t TelemetryDecoder_B1.validator_thr - number of equal ephemeris
received, after that the ephemeris would be passed to observable. Set to
1 to disable validation

bool TelemetryDecoder_B1.validator_accept_first - an option to always pass
the first received ephemeris, bypassing the validator for one time. This
may speed up first PVT solution at cost of higher probability of getting
incorrect PVT in case, the first epehemeris would be corrupt.

Signed-off-by: Vladislav P <vladisslav2011@gmail.com>
New configuration parameters

int32_t TelemetryDecoder_1G.ecc_resync - resync telemetry decoder if
the ECC error counter reaches this value

int32_t TelemetryDecoder_1G.validator_thr - number of equal ephemeris
received, after that the ephemeris would be passed to observable. Set to
1 to disable validation

bool TelemetryDecoder_1G.validator_accept_first - an option to always pass
the first received ephemeris, bypassing the validator for one time. This
may speed up first PVT solution at cost of higher probability of getting
incorrect PVT in case, the first epehemeris would be corrupt.

Signed-off-by: Vladislav P <vladisslav2011@gmail.com>
@vladisslav2011
Copy link
Contributor Author

@carlesfernandez
PR ready: #694

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

Successfully merging this pull request may close these issues.

None yet

2 participants