john2zy / IMU-Position-Tracking

Position Tracking With IMU
201 stars 46 forks source link

An error reported while running : LinAlgError("Singular matrix") #8

Open beiyoujun opened 1 year ago

beiyoujun commented 1 year ago

initializing... acc var: [0. 0. 0.], norm: 0.0 ang var: [2.22264042e-07 3.78493540e-01 2.42670246e+01], norm: 24.269976085242057 mag var: [74.9536 0. 0. ], norm: 74.9536

processing... /Users/biumr/Documents/python/IMU-Position-Tracking/mathlib.py:16: RuntimeWarning: invalid value encountered in divide return x / np.linalg.norm(x) /Users/biumr/Documents/python/IMU-Position-Tracking/main.py:149: RuntimeWarning: invalid value encountered in scalar divide Ra = [(acc_noise / np.linalg.norm(at))2 + (1 - g0 / np.linalg.norm(at))2] * 3 Traceback (most recent call last): File "/Users/biumr/Documents/python/IMU-Position-Tracking/main.py", line 367, in plot_trajectory() File "/Users/biumr/Documents/python/IMU-Position-Tracking/main.py", line 342, in plot_trajectory a_nav, orix, oriy, oriz = tracker.attitudeTrack(data[30:], init_list) File "/Users/biumr/Documents/python/IMU-Position-Tracking/main.py", line 156, in attitudeTrack K = P @ Ht.T @ np.linalg.inv(S) File "/Users/biumr/Library/Python/3.9/lib/python/site-packages/numpy/linalg/linalg.py", line 561, in inv ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj) File "/Users/biumr/Library/Python/3.9/lib/python/site-packages/numpy/linalg/linalg.py", line 112, in _raise_linalgerror_singular raise LinAlgError("Singular matrix") numpy.linalg.LinAlgError: Singular matrix

john2zy commented 11 months ago

Looks like the norm of x is zero here.