• Stars
    star
    297
  • Rank 136,257 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created about 4 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Kalman filter library

Introduction

The kalman filter framework described here is an incredibly powerful tool for any optimization problem, but particularly for visual odometry, sensor fusion localization or SLAM. It is designed to provide very accurate results, work online or offline, be fairly computationally efficient, be easy to design filters with in python.

Feature walkthrough

Extended Kalman Filter with symbolic Jacobian computation

Most dynamic systems can be described as a Hidden Markov Process. To estimate the state of such a system with noisy measurements one can use a Recursive Bayesian estimator. For a linear Markov Process a regular linear Kalman filter is optimal. Unfortunately, a lot of systems are non-linear. Extended Kalman Filters can model systems by linearizing the non-linear system at every step, this provides a close to optimal estimator when the linearization is good enough. If the linearization introduces too much noise, one can use an Iterated Extended Kalman Filter, Unscented Kalman Filter or a Particle Filter. For most applications those estimators are overkill. They add a lot of complexity and require a lot of additional compute.

Conventionally Extended Kalman Filters are implemented by writing the system's dynamic equations and then manually symbolically calculating the Jacobians for the linearization. For complex systems this is time consuming and very prone to calculation errors. This library symbolically computes the Jacobians using sympy to simplify the system's definition and remove the possibility of introducing calculation errors.

Error State Kalman Filter

3D localization algorithms usually also require estimating orientation of an object in 3D. Orientation is generally represented with euler angles or quaternions.

Euler angles have several problems, there are multiple ways to represent the same orientation, gimbal lock can cause the loss of a degree of freedom and lastly their behaviour is very non-linear when errors are large. Quaternions with one strictly positive dimension don't suffer from these issues, but have another set of problems. Quaternions need to be normalized otherwise they will grow unbounded, but this cannot be cleanly enforced in a kalman filter. Most importantly though a quaternion has 4 dimensions, but only represents 3 degrees of freedom, so there is one redundant dimension.

Kalman filters are designed to minimize the error of the system's state. It is possible to have a kalman filter where state and the error of the state are represented in a different space. As long as there is an error function that can compute the error based on the true state and estimated state. It is problematic to have redundant dimensions in the error of the kalman filter, but not in the state. A good compromise then, is to use the quaternion to represent the system's attitude state and use euler angles to describe the error in attitude. This library supports and defining an arbitrary error that is in a different space than the state. Joan Solà has written a comprehensive description of using ESKFs for robust 3D orientation estimation.

Multi-State Constraint Kalman Filter

How do you integrate feature-based visual odometry with a Kalman filter? The problem is that one cannot write an observation equation for 2D feature observations in image space for a localization kalman filter. One needs to give the feature observation a depth so it has a 3D position, then one can write an obvervation equation in the kalman filter. This is possible by tracking the feature across frames and then estimating the depth. However, the solution is not that simple, the depth estimated by tracking the feature across frames depends on the location of the camera at those frames, and thus the state of the kalman filter. This creates a positive feedback loop where the kalman filter wrongly gains confidence in it's position because the feature position updates reinforce it.

The solution is to use an MSCKF, which this library fully supports.

Rauch–Tung–Striebel smoothing

When doing offline estimation with a kalman filter there can be an initialization period where states are badly estimated. Global estimators don't suffer from this, to make our kalman filter competitive with global optimizers we can run the filter backwards using an RTS smoother. Those combined with potentially multiple forward and backwards passes of the data should make performance very close to global optimization.

Mahalanobis distance outlier rejector

A lot of measurements do not come from a Gaussian distribution and as such have outliers that do not fit the statistical model of the Kalman filter. This can cause a lot of performance issues if not dealt with. This library allows the use of a mahalanobis distance statistical test on the incoming measurements to deal with this. Note that good initialization is critical to prevent good measurements from being rejected.

More Repositories

1

openpilot

openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
Python
40,192
star
2

research

dataset and code for 2016 paper "Learning a Driving Simulator"
Python
4,105
star
3

neo

comma neo research platform
1,627
star
4

opendbc

democratize access to car decoder rings
C++
1,393
star
5

panda

code powering the comma.ai panda
C
1,340
star
6

speedchallenge

The comma.ai Speed Prediction Challenge!
784
star
7

calib_challenge

The comma.ai Calibration Challenge!
Python
780
star
8

comma10k

10k crowdsourced images for training segnets
Python
658
star
9

laika

Simple Python GNSS processing library
Python
613
star
10

comma2k19

A driving dataset for the development and validation of fused pose estimators and mapping algorithms
Jupyter Notebook
560
star
11

commavq

commaVQ is a dataset of compressed driving video
Jupyter Notebook
198
star
12

cereal

capnp struct definitions and messaging used in comma ecosystem
Cap'n Proto
157
star
13

cabana

CAN visualizer and DBC maker
JavaScript
154
star
14

chffrplus

open source dashcam software
C
133
star
15

eon-neos

Operating System for your comma two and EON
Python
122
star
16

commacoloring

you like coloring books?
JavaScript
101
star
17

connect

Connect PWA
JavaScript
87
star
18

body

firmware for the comma body robotics dev kit
C
56
star
19

chffr-api

API to access chffr data!
JavaScript
51
star
20

monitoring

The comma.ai Driver Monitoring Challenge!
51
star
21

openpilot-apks

The source code for the APK that runs inside openpilot.
JavaScript
47
star
22

pandajs

JavaScript
46
star
23

agnos

the operating system for your comma 3/3X
Python
39
star
24

depth10k

10k images for unsupervised depthnets
HTML
37
star
25

eon-neos-builder

Build NEOS, the operating system for your EON
C
27
star
26

comma-steering-control

Jupyter Notebook
25
star
27

entium

A helper for converting entwine tile data into cesium tiles
Python
21
star
28

connect-app

comma Connect Mobile App
JavaScript
21
star
29

agnos-builder

Build AGNOS, the operating system for your comma three
Python
21
star
30

trafficlights

Simple neural network to recognize the color of traffic lights
Jupyter Notebook
20
star
31

panda-artifacts

Releases of panda code.
Python
16
star
32

eon-neos-leeco

Operating System for your EON Gold
Shell
13
star
33

android_kernel_comma_msm8996

C
12
star
34

comma-x-native

X UI Library for React Native
JavaScript
12
star
35

vidutil.js

Decode H.264 and HEVC bitstreams in the browser using FFmpeg and WebAssembly
C
10
star
36

log_reader_js

Javascript implementation of the capnp log reader
JavaScript
10
star
37

android_device_oneplus_oneplus3

upstream: https://github.com/sultanxda/android_device_oneplus_oneplus3
C
8
star
38

gnss-data

Shell
8
star
39

agnos-kernel-sdm845

Kernel for the SDM845 modules
C
8
star
40

usr

usr directory from NEOS
Python
8
star
41

jobs

work @ comma.ai
8
star
42

android_kernel_leeco_msm8996

upstream: https://github.com/LineageOS/android_kernel_leeco_msm8996/commits/cm-13.0
C
6
star
43

android_system_core

upstream: https://github.com/CyanogenMod/android_system_core
C++
6
star
44

gnss-data-alt

Shell
5
star
45

android_vendor_oneplus_oneplus3

Makefile
5
star
46

android_frameworks_base

upstream: https://github.com/CyanogenMod/android_frameworks_base
Java
5
star
47

android_build

upstream: https://github.com/cyanogenmod/android_build
Makefile
5
star
48

comma-api

JavaScript
5
star
49

panda_jungle

Code powering the Panda Jungle debug board
C
4
star
50

can-message

JavaScript
4
star
51

openpilot-pyextra

Python
4
star
52

tipsi-stripe

Fork of tipsi-stripe removing Android firebase dependency
JavaScript
4
star
53

android_system_extras_su

upstream: https://github.com/CyanogenMod/android_system_extras_su
C
3
star
54

android_packages_apps_NEOSSetup

JavaScript
3
star
55

flash

JavaScript
3
star
56

my-comma-auth

shared auth utils for my.comma.ai apps (explorer, cabana)
JavaScript
3
star
57

tensorflow-autodetect

Automatically install the cpu or gpu version of Tensorflow
Python
3
star
58

cabana-issues

Public issue tracker for https://cabana.comma.ai
3
star
59

android_packages_apps_Settings

upstream: https://github.com/CyanogenMod/android_packages_apps_Settings
Java
3
star
60

qtlocation

C++
2
star
61

gnss-data-hourly

Shell
2
star
62

android

upstream: https://github.com/CyanogenMod/android -b cm-13.0
2
star
63

android_kernel_oneplus_msm8996

upstream: https://github.com/CyanogenMod/android_kernel_oneplus_msm8996
C
2
star
64

android_packages_inputmethods_LatinIME

upstream: https://github.com/CyanogenMod/android_packages_inputmethods_LatinIME
Java
2
star
65

apkpatch

generates and applies efficient patch files to whole apks
Java
2
star
66

android_frameworks_opt_net_wifi

upstream: https://github.com/CyanogenMod/android_frameworks_opt_net_wifi
Java
2
star
67

android_hardware_quectel

Prebuilt RIL binaries for Quectel modems
Makefile
1
star
68

android_frameworks_opt_telephony

upstream: https://github.com/CyanogenMod/android_frameworks_opt_telephony
Java
1
star
69

android_device_oppo_common

upstream: https://github.com/CyanogenMod/android_device_oppo_common
Java
1
star
70

android_vendor_cm

upstream: https://github.com/CyanogenMod/android_vendor_cm
CSS
1
star
71

opencv-python-builder

Dockerfile
1
star
72

android_packages_apps_Bluetooth

upstream: https://github.com/CyanogenMod/android_packages_apps_Bluetooth
Java
1
star