Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.

Commit 250dfc6

Browse files
committed
Merge pull request #240 from akleeman/verbose_failure
Issue warnings if calc_PVT fails.
2 parents 81bd794 + ee08c0e commit 250dfc6

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

python/swiftnav/pvt.pyx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
88
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
99

10+
import warnings
11+
1012
cimport pvt_c
1113
from libc.stdlib cimport malloc, free
1214

@@ -64,6 +66,16 @@ cdef class Solution:
6466
self.dops.hdop,
6567
self.dops.vdop)
6668

69+
_calc_pvt_codes = {2: "Solution converged but RAIM unavailable or disabled",
70+
1: "Solution converged, failed RAIM but was successfully repaired",
71+
-1: "PDOP is too high to yield a good solution.",
72+
-2: "Altitude is unreasonable.",
73+
-3: "Velocity is greater than or equal to 1000 kts.",
74+
-4: "RAIM check failed and repair was unsuccessful",
75+
-5: "RAIM check failed and repair was impossible (not enough measurements)",
76+
-6: "pvt_iter didn't converge",
77+
-7: "< 4 measurements"}
78+
6779
def calc_PVT(nav_meas):
6880
n_used = len(nav_meas)
6981
cdef navigation_measurement_t* nav_meas_array = <navigation_measurement_t*>malloc(n_used*sizeof(navigation_measurement_t))
@@ -72,8 +84,11 @@ def calc_PVT(nav_meas):
7284
nav_meas_array[n] = (<NavigationMeasurement?>nav_meas[n]).meas
7385

7486
s = Solution()
75-
pvt_c.calc_PVT(n_used, nav_meas_array, False, &(s.soln), &(s.dops))
76-
87+
cdef s8 ret
88+
ret = pvt_c.calc_PVT(n_used, nav_meas_array, False, &(s.soln), &(s.dops))
7789
free(nav_meas_array)
7890

91+
if not ret == 0:
92+
warnings.warn(_calc_pvt_codes[ret])
93+
7994
return s

0 commit comments

Comments
 (0)