filter package

Submodules

filter.Filter module

class filter.Filter.Filter(sim: Simulator)

Bases: object

Error-State Kalman Filter for fusing camera and IMU measurements using a sensor setup model (probe).

property Om_old
property acc_old
calculate_dof_metric()

at end of run

calculate_metric(i_cam, camera)
calculate_update_mse(i_cam, camera)
property om_old
plot(camera, compact)
propagate(t, om, acc)
propagate_imu(t0: float, tn: float)

Generates IMU data between old and current camera frame, then uses this data to propagate the states as many times as there are IMU data between frames.

reset(x0, cov0, notch0)
run(camera: Camera, k: int, run_desc_str: str) None

Filter main loop (t>=1) over all camera frames, not counting IC. arg: k should already be adjusted to start at 1.

run_one_epoch(old_t: float, t: float, i_cam: int, camera: Camera) None

Kalman filter run between old camera frame and current camera frame. 1 epoch = (>=1 prediction steps) + (1 update step) Calculates the unnormalised DOF MSE.

i_cam must be already adjusted so that the IC is not counted

save()
property u
update(t: float, camera: VisualMeasurementPoint, ang_notch: float)
update_noise_matrices()

filter.Simulator module

class filter.Simulator.Simulator(config: Config)

Bases: object

Simulation object with simulation settings as attributes. Provides methods for running and tuning the Kalman filter simulation.

property best_run_id: int
property config
property cov0: ndarray

Returns a copy of the initial covariance matrix.

property optim_std: List[float]
optimise() None

For tuning the KF parameters. Currently only for kp (scale factor for process noise).

plot(compact=True) None
reset_kf() None
run(disp_config=False, save_best=False, verbose=True) None

Runs KF on the camera trajectory several times. Calculates the mean squared error of the DOFs,

averaged from all the KF runs.

run_once() None

Only performs a single run of the filter.

filter.state module

class filter.state.ErrorState(dp: 'np.ndarray', dv: 'np.ndarray', dq: 'Quaternion', ddofs: 'np.ndarray', dndofs: 'np.ndarray', dpc: 'np.ndarray', dqc: 'Quaternion', theta: 'np.ndarray', theta_c: 'np.ndarray')

Bases: object

SIZE = 24
ddofs: ndarray
dndofs: ndarray
dp: ndarray
dpc: ndarray
dq: Quaternion
dqc: Quaternion
dv: ndarray
static from_array(vec: ndarray) ErrorState
theta: ndarray
theta_c: ndarray
class filter.state.State(p: 'np.ndarray', v: 'np.ndarray', q: 'Quaternion', dofs: 'np.ndarray', notch_dofs: 'np.ndarray', p_cam: 'np.ndarray', q_cam: 'Quaternion')

Bases: object

SIZE = 26
property array: List[ndarray]
dofs: ndarray
static from_array(vec: List[ndarray]) State

Sets values to the given ones.

notch_dofs: ndarray
p: ndarray
p_cam: ndarray
q: Quaternion
q_cam: Quaternion
v: ndarray

Module contents