mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-30 02:52:04 +08:00
laikad: add residual threshold for pos_fix (#25082)
* laikad: add residual threshold for pos_fix * update ref * update test old-commit-hash: 7a4c33795a12eefff4c3e5c311f40eae2cf3506b
This commit is contained in:
@@ -28,6 +28,7 @@ from system.swaglog import cloudlog
|
||||
MAX_TIME_GAP = 10
|
||||
EPHEMERIS_CACHE = 'LaikadEphemeris'
|
||||
CACHE_VERSION = 0.1
|
||||
POS_FIX_RESIDUAL_THRESHOLD = 100.0
|
||||
|
||||
|
||||
class Laikad:
|
||||
@@ -89,9 +90,9 @@ class Laikad:
|
||||
|
||||
def get_est_pos(self, t, processed_measurements):
|
||||
if self.last_pos_fix_t is None or abs(self.last_pos_fix_t - t) >= 2:
|
||||
min_measurements = 5 if any(p.constellation_id == ConstellationId.GLONASS for p in processed_measurements) else 4
|
||||
min_measurements = 6 if any(p.constellation_id == ConstellationId.GLONASS for p in processed_measurements) else 5
|
||||
pos_fix, pos_fix_residual = calc_pos_fix_gauss_newton(processed_measurements, self.posfix_functions, min_measurements=min_measurements)
|
||||
if len(pos_fix) > 0:
|
||||
if len(pos_fix) > 0 and np.median(np.abs(pos_fix_residual)) < POS_FIX_RESIDUAL_THRESHOLD:
|
||||
self.last_pos_fix = pos_fix[:3]
|
||||
self.last_pos_residual = pos_fix_residual
|
||||
self.last_pos_fix_t = t
|
||||
|
||||
@@ -138,7 +138,7 @@ class TestLaikad(unittest.TestCase):
|
||||
laikad = Laikad(auto_update=True, valid_ephem_types=EphemerisType.ULTRA_RAPID_ORBIT)
|
||||
correct_msgs = verify_messages(self.logs, laikad)
|
||||
|
||||
correct_msgs_expected = 560
|
||||
correct_msgs_expected = 555
|
||||
self.assertEqual(correct_msgs_expected, len(correct_msgs))
|
||||
self.assertEqual(correct_msgs_expected, len([m for m in correct_msgs if m.gnssMeasurements.positionECEF.valid]))
|
||||
|
||||
@@ -159,7 +159,7 @@ class TestLaikad(unittest.TestCase):
|
||||
# Disable fetch_orbits to test NAV only
|
||||
laikad.fetch_orbits = Mock()
|
||||
correct_msgs = verify_messages(self.logs, laikad)
|
||||
correct_msgs_expected = 560
|
||||
correct_msgs_expected = 559
|
||||
self.assertEqual(correct_msgs_expected, len(correct_msgs))
|
||||
self.assertEqual(correct_msgs_expected, len([m for m in correct_msgs if m.gnssMeasurements.positionECEF.valid]))
|
||||
|
||||
@@ -168,8 +168,8 @@ class TestLaikad(unittest.TestCase):
|
||||
downloader_mock.side_effect = IOError
|
||||
laikad = Laikad(auto_update=False)
|
||||
correct_msgs = verify_messages(self.logs, laikad)
|
||||
self.assertEqual(256, len(correct_msgs))
|
||||
self.assertEqual(256, len([m for m in correct_msgs if m.gnssMeasurements.positionECEF.valid]))
|
||||
self.assertEqual(16, len(correct_msgs))
|
||||
self.assertEqual(16, len([m for m in correct_msgs if m.gnssMeasurements.positionECEF.valid]))
|
||||
|
||||
def test_laika_get_orbits(self):
|
||||
laikad = Laikad(auto_update=False)
|
||||
|
||||
@@ -1 +1 @@
|
||||
bd2ea158977f5c26658bed8ac683b72c2c592d06
|
||||
0da0928230d11dd4c76293b9e77b027eb4a1e291
|
||||
Reference in New Issue
Block a user