Apollo  6.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:
26  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
27 
28  public:
30  ~InformationFilter() = default;
31 
32  bool Init(const Eigen::VectorXd &global_states,
33  const Eigen::MatrixXd &global_uncertainty);
34 
35  // @brief: Set the obervation of the last moment(imf use
36  // the latest two moment of the observation which
37  // from the same source to correct the prediction.
38  // @parmas[IN] last_observation: the observation of the last moment
39  // @params[IN] last_observation_uncertainty: the uncertainty of the
40  // observation of the last moment
41  // @params[IN] last_to_cur_transform_matrix: regard last observatopn
42  // as a state and apply a motion model(the transform
43  // matrix) to predict current state of the last observation.
44  // @params[IN] last_to_cur_env_uncertainty: the uncertainty brought
45  // by the environment when predict the current state of
46  // last observation.
47  bool SetLastObservation(const Eigen::VectorXd &last_observation,
48  const Eigen::MatrixXd &last_observation_uncertainty,
49  const Eigen::MatrixXd &last_to_cur_transform_matrix,
50  const Eigen::MatrixXd &last_to_cur_env_uncertainty);
51 
52  // @brief predict the current state and uncertainty of system
53  // @params[IN] transform_matrix: transform the state from the
54  // pre moment to current moment.
55  // @params[IN] env_uncertainty_matrix: the uncertainty brought by
56  // the environment when predict system state.
57  bool Predict(const Eigen::MatrixXd &transform_matrix,
58  const Eigen::MatrixXd &env_uncertainty_matrix);
59 
60  // @brief Use the current observation to correct the prediction.
61  // @params[IN] cur_observation: the observation in current moment.
62  // @params[IN] cur_observation_uncertainty: the uncertainty of
63  // the current observation
64  bool Correct(const Eigen::VectorXd &current_observation,
65  const Eigen::MatrixXd &current_observation_uncertainty);
66 
67  // @brief get the system state
68  Eigen::VectorXd GetStates() const { return global_states_; }
69 
70  // @brief get the number of the system states
71  inline int GetStateNums() const { return states_num_; }
72 
73  // @brief set the control matrix
74  bool SetControlMatrix(const Eigen::MatrixXd &control_matrix);
75 
76  protected:
77  // @brief whether the observation of last moment has been set
79 
80  // @brief the observation of the last moment
81  Eigen::VectorXd last_observation_;
82 
83  // @brief the uncertainty of the last moment observation
85 
86  // @brief a temporary var for compute conveniece
87  Eigen::VectorXd tmp_states_;
88 
89  // @brief motion model to predict the current state of the
90  // last observation
92 
93  // @brife uncertainty when predict the current state of the
94  // last observation
96 };
97 
98 } // namespace fusion
99 } // namespace perception
100 } // namespace apollo
int states_num_
Definition: base_filter.h:79
Definition: information_filter.h:24
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Eigen::MatrixXd last_to_cur_transform_matrix_
Definition: information_filter.h:91
Eigen::VectorXd global_states_
Definition: base_filter.h:82
Eigen::VectorXd tmp_states_
Definition: information_filter.h:87
Eigen::VectorXd last_observation_
Definition: information_filter.h:81
Definition: base_filter.h:27
Eigen::MatrixXd last_to_cur_env_uncertainty_
Definition: information_filter.h:95
bool SetControlMatrix(const Eigen::MatrixXd &control_matrix)
Eigen::MatrixXd last_observation_uncertainty_
Definition: information_filter.h:84
int GetStateNums() const
Definition: information_filter.h:71
bool Init(const Eigen::VectorXd &global_states, const Eigen::MatrixXd &global_uncertainty)
bool last_observation_init_
Definition: information_filter.h:78
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:68
bool Correct(const Eigen::VectorXd &current_observation, const Eigen::MatrixXd &current_observation_uncertainty)