Skip to content

Commit a1f1be2

Browse files
committed
refactor
1 parent 3573e47 commit a1f1be2

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/smsfusion/_ins.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ def __init__(
690690
self._x = self._ins.x
691691

692692
# Error state estimate (after reset)
693-
self._dx = np.zeros(15) # always zero, but used in sequential update
693+
self._dx_prealloc = np.zeros(15) # always zero, but used in sequential update
694694

695695
# Initialize Kalman filter
696696
self._P_prior = np.asarray_chkfinite(P0_prior).copy(order="C")
@@ -723,10 +723,10 @@ def __init__(
723723
self._H = (self._H @ self._T_dx)[:, :dx_dim]
724724
self._W = (self._T_wn @ self._W @ self._T_wn.T)[:wn_dim, :wn_dim]
725725
self._I = self._I[:dx_dim, :dx_dim]
726-
self._dx = self._dx[:dx_dim]
726+
self._dx_prealloc = self._dx_prealloc[:dx_dim]
727727

728728
# Error-state estimate (before reset)
729-
self._dx_est = np.empty_like(self._dx) # needed for smoothing only
729+
self._dx = np.empty_like(self._dx_prealloc) # needed for smoothing only
730730

731731
# State transition matrix
732732
self._phi = np.empty_like(self._F) # needed for smoothing only
@@ -921,7 +921,7 @@ def _reset_ins(self, dx: NDArray[np.float64]) -> None:
921921
self._ins._x[-3:] = self._ins._x[-3:] + dx[-3:]
922922
if not self._ignore_bias_acc:
923923
self._ins._x[10:13] = self._ins._x[10:13] + dx[9:12]
924-
self._dx[:] = np.zeros(dx.size)
924+
self._dx_prealloc[:] = np.zeros(dx.size)
925925

926926
@staticmethod
927927
@njit # type: ignore[misc]
@@ -1020,7 +1020,7 @@ def update(
10201020
R_ins_nm = _rot_matrix_from_quaternion(q_ins_nm) # body-to-inertial rot matrix
10211021

10221022
# Aliases
1023-
dx = self._dx # zeros
1023+
dx = self._dx_prealloc # zeros
10241024
dt = self._dt
10251025
F = self._F
10261026
G = self._G
@@ -1087,7 +1087,7 @@ def update(
10871087
H_head = self._update_H_head(q_ins_nm)
10881088
dx, P = self._update_dx_P(dx, P, dz_head, head_var_, H_head, I_)
10891089

1090-
self._dx_est[:] = dx.ravel().copy()
1090+
self._dx[:] = dx.ravel().copy()
10911091

10921092
# Reset INS state
10931093
if dx.any():

src/smsfusion/_smoothing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def update(self, *args, **kwargs) -> Self:
8282
self._ains.update(*args, **kwargs)
8383
self._x_buf.append(self._ains.x)
8484
self._P_buf.append(self._ains.P)
85-
self._dx_buf.append(self._ains._dx_est.copy())
85+
self._dx_buf.append(self._ains._dx.copy())
8686
self._phi_buf.append(self._ains._phi.copy())
8787
return self
8888

0 commit comments

Comments
 (0)