Skip to content

Commit

Permalink
With lock_type
Browse files Browse the repository at this point in the history
  • Loading branch information
jscheidtmann committed Feb 14, 2025
1 parent 36018d0 commit 699697b
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions python/PiFinder/gps_fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 699697b

Please sign in to comment.