diff --git a/selfdrive/locationd/kalman/README.md b/selfdrive/locationd/kalman/README.md index de25c627e..4c4ebd59c 100644 --- a/selfdrive/locationd/kalman/README.md +++ b/selfdrive/locationd/kalman/README.md @@ -2,7 +2,7 @@ ## 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 the very +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. @@ -18,7 +18,7 @@ most applications those estimators are overkill and introduce too much complexit 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 remove the possiblity of introducing calculation errors. +This library symbolically computes the Jacobians using sympy to simplify the system's definition and remove the possiblity of introducing calculation errors. ### Error State Kalman Filter 3D localization algorithms ussually also require estimating orientation of an object in 3D. Orientation is generally represented @@ -28,18 +28,18 @@ Euler angles have several problems, there are mulitple ways to represent the sam 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, this is cannot be cleanly enforced in a kalman filter. -Most importantly though a quaternion has 4 dimensions, but only represents 3 DOF. It is problematic to describe the error-state, -with redundant dimensions. +Most importantly though a quaternion has 4 dimensions, but only represents 3 degrees of freedom, so there is one redundant dimension. -The solution is to have a compromise, use the quaternion to represent the system's state and use euler angles to describe -the error-state. This library supports and defining an arbitrary error-state that is different from the state. +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à](https://arxiv.org/abs/1711.02508) has written a comprehensive description of using ESKFs for robust 3D orientation estimation. ### Multi-State Constraint Kalman Filter -paper: +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](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.437.1085&rep=rep1&type=pdf), which this library fully supports. ### Rauch–Tung–Striebel smoothing -When doing offline estimation with a kalman filter there can be an initialzition period where states are badly estimated. -Global estimators don't suffer from this, to make our kalman filter competitive with global optimizers when can run the filter +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.