filters module

Parent classes for Kalman filter algorithms.

class filters.BaseExtendedKalmanFilter(init_dict, params_dict)[source]

Bases: BaseFilter

Class with general extended Kalman filter implementation

Q

Process noise covariance, tunable parameter

Type:

np.ndarray

R

Measurement noise covariance, tunable parameter

Type:

np.ndarray

params_dict

Dictionary of additional parameters required, implementation dependent

Type:

dict

_abc_impl = <_abc_data object>
abstract dyn_model(u, predict_dict=None)[source]

Non-linear dynamics model

abstract linearize_dynamics(predict_dict=None)[source]

Linearization of system dynamics, should return A matrix

abstract linearize_measurements(update_dict=None)[source]

Linearization of measurement model, should return H matrix

abstract measure_model(update_dict=None)[source]

Non-linear measurement model

predict(u=None, predict_dict=None)[source]

Predict the state of the filter given the control input

Parameters:
  • u (np.ndarray) – The control signal given to the actual system, dimension state_dim x D

  • predict_dict (dict) – Additional parameters needed to implement predict step

update(z, update_dict=None)[source]

Update the state of the filter given a noisy measurement of the state

Parameters:
  • z (np.ndarray) – Noisy measurement of state, dimension M x 1

  • update_dict (dict) – Additional parameters needed to implement update step

class filters.BaseFilter(state_0, sigma_0)[source]

Bases: ABC

Class with general filter implementation framework

state_0

Initial state estimate

Type:

np.ndarray

sigma_0

Current uncertainty estimated for state estimate (2D covariance)

Type:

np.ndarray

_abc_impl = <_abc_data object>
abstract predict()[source]

Predict the state of the filter based on some dynamics model

abstract update()[source]

Update the state of the filter based on some measurement model

class filters.BaseKalmanFilter(init_dict, params_dict)[source]

Bases: BaseExtendedKalmanFilter

General Kalman Filter implementation. Implementated as special case of BaseExtendedKalmanFilter with linear dynamics and measurement model

_abc_impl = <_abc_data object>
dyn_model(u, predict_dict=None)[source]

Linear dynamics model

Parameters:
  • u (np.ndarray) – Control input to system

  • predict_dict (dict) – Additional parameters that might be requried for prediction

Returns:

new_x

Return type:

State after propagation

abstract get_B(predict_dict=None)[source]

Map from control to state, should return B matrix

measure_model(update_dict=None)[source]

Linear measurement model

Parameters:

update_dict (dict) – Additional parameters that might be requried for update

Returns:

z_expect

Return type:

Measurement expected for current state

class filters.BaseUnscentedKalmanFilter(init_dict, params_dict)[source]

Bases: BaseFilter

General Unscented Kalman Filter implementation. Class with general Unscented Kalman filter implementation

Q

Process noise covariance, tunable parameter

Type:

np.ndarray

R

Measurement noise covariance, tunable parameter

Type:

np.ndarray

params_dict

Dictionary of additional parameters required, implementation dependent

Type:

dict

U_transform()[source]

Sigma Point Transform

_abc_impl = <_abc_data object>
abstract dyn_model(x, u, predict_dict=None)[source]

Non-linear dynamics model

inv_U_transform(W, x_t_tm)[source]

Inverse Sigma Point Transform

abstract measure_model(x, update_dict=None)[source]

Non-linear measurement model

predict(u, predict_dict=None)[source]

Predict the state of the filter given the control input

Parameters:
  • u (np.ndarray) – The control signal given to the actual system, dimension state_dim x D

  • predict_dict (dict) – Additional parameters needed to implement predict step

update(z, update_dict=None)[source]

Update the state of the filter given a noisy measurement of the state

Parameters:
  • z (np.ndarray) – Noisy measurement of state, dimension M x 1

  • update_dict (dict) – Additional parameters needed to implement update step

filters._check_col_vect(vect, dim)[source]

Boolean for whether input vector is column shaped or not

Parameters:
  • vect (np.ndarray) – Input vector

  • dim (int) – Number of row elements in column vector

filters._check_square_mat(mat, dim)[source]

Boolean for whether input matrices are square or not

Parameters:
  • vect (np.ndarray) – Input matrix

  • dim (int) – Number of elements for row and column = N for N x N