Apollo  v5.5.0
Open source self driving car software
information_filter.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 #pragma once
17 
19 
20 namespace apollo {
21 namespace perception {
22 namespace fusion {
23 
24 class InformationFilter : public BaseFilter {
25  public:
27  ~InformationFilter() = default;
28 
29  bool Init(const Eigen::VectorXd &global_states,
30  const Eigen::MatrixXd &global_uncertainty);
31 
32  // @brief: Set the obervation of the last moment(imf use
33  // the latest two moment of the observation which
34  // from the same source to correct the prediction.
35  // @parmas[IN] last_observation: the observation of the last moment
36  // @params[IN] last_observation_uncertainty: the uncertainty of the
37  // observation of the last moment
38  // @params[IN] last_to_cur_transform_matrix: regard last observatopn
39  // as a state and apply a motion model(the transform
40  // matrix) to predict current state of the last observation.
41  // @params[IN] last_to_cur_env_uncertainty: the uncertainty brought
42  // by the environment when predict the current state of
43  // last observation.
44  bool SetLastObservation(const Eigen::VectorXd &last_observation,
45  const Eigen::MatrixXd &last_observation_uncertainty,
46  const Eigen::MatrixXd &last_to_cur_transform_matrix,
47  const Eigen::MatrixXd &last_to_cur_env_uncertainty);
48 
49  // @brief predict the current state and uncertainty of system
50  // @params[IN] transform_matrix: transform the state from the
51  // pre moment to current moment.
52  // @params[IN] env_uncertainty_matrix: the uncertainty brought by
53  // the environment when predict system state.
54  bool Predict(const Eigen::MatrixXd &transform_matrix,
55  const Eigen::MatrixXd &env_uncertainty_matrix);
56 
57  // @brief Use the current observation to correct the prediction.
58  // @params[IN] cur_observation: the observation in current moment.
59  // @params[IN] cur_observation_uncertainty: the uncertainty of
60  // the current observation
61  bool Correct(const Eigen::VectorXd &current_observation,
62  const Eigen::MatrixXd &current_observation_uncertainty);
63 
64  // @brief get the system state
65  Eigen::VectorXd GetStates() const { return global_states_; }
66 
67  // @brief get the number of the system states
68  inline int GetStateNums() const { return states_num_; }
69 
70  // @brief set the control matrix
71  bool SetControlMatrix(const Eigen::MatrixXd &control_matrix);
72 
73  protected:
74  // @brief whether the observation of last moment has been set
76 
77  // @brief the observation of the last moment
78  Eigen::VectorXd last_observation_;
79 
80  // @brief the uncertainty of the last moment observation
82 
83  // @brief a temporary var for compute conveniece
84  Eigen::VectorXd tmp_states_;
85 
86  // @brief motion model to predict the current state of the
87  // last observation
89 
90  // @brife uncertainty when predict the current state of the
91  // last observation
93 };
94 
95 } // namespace fusion
96 } // namespace perception
97 } // namespace apollo
int states_num_
Definition: base_filter.h:76
Definition: information_filter.h:24
Definition: blob.h:72
Eigen::MatrixXd last_to_cur_transform_matrix_
Definition: information_filter.h:88
Eigen::VectorXd global_states_
Definition: base_filter.h:79
Eigen::VectorXd tmp_states_
Definition: information_filter.h:84
Eigen::VectorXd last_observation_
Definition: information_filter.h:78
Definition: base_filter.h:27
Eigen::MatrixXd last_to_cur_env_uncertainty_
Definition: information_filter.h:92
bool SetControlMatrix(const Eigen::MatrixXd &control_matrix)
Eigen::MatrixXd last_observation_uncertainty_
Definition: information_filter.h:81
int GetStateNums() const
Definition: information_filter.h:68
bool Init(const Eigen::VectorXd &global_states, const Eigen::MatrixXd &global_uncertainty)
bool last_observation_init_
Definition: information_filter.h:75
bool Predict(const Eigen::MatrixXd &transform_matrix, const Eigen::MatrixXd &env_uncertainty_matrix)
bool SetLastObservation(const Eigen::VectorXd &last_observation, const Eigen::MatrixXd &last_observation_uncertainty, const Eigen::MatrixXd &last_to_cur_transform_matrix, const Eigen::MatrixXd &last_to_cur_env_uncertainty)
Eigen::VectorXd GetStates() const
Definition: information_filter.h:65
bool Correct(const Eigen::VectorXd &current_observation, const Eigen::MatrixXd &current_observation_uncertainty)