From 699697b8cf9ccce29be389c625a6f9ea7c86ef12 Mon Sep 17 00:00:00 2001 From: Jens Scheidtmann Date: Fri, 14 Feb 2025 17:31:07 +0100 Subject: [PATCH] With lock_type --- python/PiFinder/gps_fake.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/python/PiFinder/gps_fake.py b/python/PiFinder/gps_fake.py index 55604348..92d81a69 100644 --- a/python/PiFinder/gps_fake.py +++ b/python/PiFinder/gps_fake.py @@ -15,31 +15,38 @@ # Have a linear count-down in error, simulating a bad fix, that gets better -error_countdown = 100 # 200 * 0.5 = 100 seconds -error_start = 10_000 # 100 km -error_stop = 600 # 10s meters +error_delta = 100 # 200 * 0.5 = 100 seconds +error_start = 2_000 # 100 km lock_at = 1_000 # 1 km +fix_2d = 500 # m +fix_3d = 200 # m +error_stop = 200 # 10s meters def gps_monitor(gps_queue, console_queue, log_queue): MultiprocLogging.configurer(log_queue) time.sleep(5) error_in_m = error_start - delta = (error_start - error_stop) / error_countdown lock = False + lock_type = None i = -1 while True: i += 1 time.sleep(0.5) fix = ( "fix", - {"lat": 34.22, "lon": -118.22, "altitude": 22, "source": "fakeGPS", "error_in_m": error_in_m, "lock": lock}, + {"lat": 34.22, "lon": -118.22, "altitude": 22, "source": "fakeGPS", "error_in_m": error_in_m, "lock": lock, "lock_type": lock_type}, ) gps_queue.put(fix) if error_in_m < lock_at: lock = True - if error_in_m > error_stop: - error_in_m -= delta + lock_type = 0 + if error_in_m < fix_2d: + lock_type = 2 + if error_in_m < fix_3d: + lock_type = 3 + if error_in_m >= error_stop: + error_in_m -= error_delta tm = ( "time",