ekf.hpp
Go to the documentation of this file.
1 /*********************************************************************
2 * Copyright (c) 2017 Robert Bosch GmbH.
3 * All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 * *********************************************************************/
17 
18 #ifndef EKF_HPP
19 #define EKF_HPP
20 
21 #include <Eigen/Dense>
22 
24 
25 namespace steering
26 {
27 
28 typedef Eigen::Matrix<double, 2, 2> Matrix2d;
29 typedef Eigen::Matrix<double, 3, 3> Matrix3d;
30 typedef Eigen::Matrix<double, 3, 2> Matrix32d;
31 typedef Eigen::Matrix<double, 2, 3> Matrix23d;
32 
33 class EKF
34 {
35 public:
37  EKF();
38 
40  void set_parameters(const Motion_Noise &motion_noise, const Measurement_Noise &measurement_noise,
41  const Controller &_controller);
42 
44  Matrix3d covariance_to_eigen(const double covariance[16]) const;
45 
47  void eigen_to_covariance(const Matrix3d &covariance_eigen, double covariance[16]) const;
48 
50  void get_motion_jacobi(const State &state, const Control &control, double integration_step, Matrix3d &F_x,
51  Matrix32d &F_u) const;
52 
54  Matrix3d get_observation_jacobi() const;
55 
57  Matrix2d get_motion_covariance(const State &state, const Control &control, double integration_step) const;
58 
60  Matrix3d get_observation_covariance() const;
61 
63  Matrix23d get_controller_gain(const Control &control) const;
64 
66  Matrix3d get_rotation_matrix(double angle) const;
67 
70  void predict(const State_With_Covariance &state, const Control &control, double integration_step,
71  State_With_Covariance &state_pred) const;
72 
74  void update(const State_With_Covariance &state_pred, State_With_Covariance &state_corr) const;
75 
78 
79 private:
82 
85 
88 
90  Matrix3d I_;
91 };
92 
93 } // namespace steering
94 
95 #endif
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Overload operator new for fixed-size vectorizable Eigen member variable.
Definition: ekf.hpp:77
void set_parameters(const Motion_Noise &motion_noise, const Measurement_Noise &measurement_noise, const Controller &_controller)
Sets the parameters required by the EKF.
Definition: ekf.cpp:31
Eigen::Matrix< double, 2, 3 > Matrix23d
Definition: ekf.hpp:31
Matrix3d get_observation_jacobi() const
Computes the Jacobian of the observation equations with respect to the state.
Definition: ekf.cpp:166
void eigen_to_covariance(const Matrix3d &covariance_eigen, double covariance[16]) const
Converts a covariance given by an Eigen matrix to a double array.
Definition: ekf.cpp:52
Matrix2d get_motion_covariance(const State &state, const Control &control, double integration_step) const
Returns the motion covariance in control space.
Definition: ekf.cpp:171
Controller controller_
Feedback controller.
Definition: ekf.hpp:87
Eigen::Matrix< double, 3, 3 > Matrix3d
Definition: ekf.hpp:29
Eigen::Matrix< double, 3, 2 > Matrix32d
Definition: ekf.hpp:30
Matrix3d covariance_to_eigen(const double covariance[16]) const
Converts a covariance given by a double array to an Eigen matrix.
Definition: ekf.cpp:39
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
Motion_Noise motion_noise_
Motion noise.
Definition: ekf.hpp:81
Parameters of the motion noise model according to the book: Probabilistic Robotics, S. Thrun and others, MIT Press, 2006, p. 127-128 and p.204-206.
Description of a path segment with its corresponding control inputs.
void update(const State_With_Covariance &state_pred, State_With_Covariance &state_corr) const
Predicts the covariances.
Definition: ekf.cpp:236
Description of a kinematic car&#39;s state with covariance.
Parameters of the measurement noise.
Parameters of the feedback controller.
Matrix3d get_observation_covariance() const
Returns the observation covariance.
Definition: ekf.cpp:181
Description of a kinematic car&#39;s state.
Eigen::Matrix< double, 2, 2 > Matrix2d
Definition: ekf.hpp:28
Matrix23d get_controller_gain(const Control &control) const
Returns the gain of the controller.
Definition: ekf.cpp:190
Matrix3d get_rotation_matrix(double angle) const
Returns the rotation matrix from a global frame to a local frame.
Definition: ekf.cpp:199
Matrix3d I_
Identity matrix.
Definition: ekf.hpp:90
Measurement_Noise measurement_noise_
Measurement noise.
Definition: ekf.hpp:84
void predict(const State_With_Covariance &state, const Control &control, double integration_step, State_With_Covariance &state_pred) const
Predicts the covariances based on the paper: Rapidly-exploring random belief trees for motion plannin...
Definition: ekf.cpp:212
void get_motion_jacobi(const State &state, const Control &control, double integration_step, Matrix3d &F_x, Matrix32d &F_u) const
Computes the Jacobians of the motion equations with respect to the state and control.
Definition: ekf.cpp:63


steering_functions
Author(s): Holger Banzhaf
autogenerated on Thu Aug 18 2022 02:09:46