Apollo 10.0
自动驾驶开放平台
apollo::perception::camera::AdaptiveKalmanFilter类 参考

#include <adaptive_kalman_filter.h>

类 apollo::perception::camera::AdaptiveKalmanFilter 继承关系图:
apollo::perception::camera::AdaptiveKalmanFilter 的协作图:

Public 成员函数

 AdaptiveKalmanFilter ()
 
 ~AdaptiveKalmanFilter ()
 
void Init (const base::Object &object) override
 Init base filter config
 
Eigen::VectorXd Predict (const double time_diff) override
 Predict the state of the object after time_diff
 
Eigen::VectorXd UpdateWithObject (const base::Object &new_object, double time_diff) override
 Update the state of the target based on the observations
 
void GetState (Eigen::Vector3d *anchor_point, Eigen::Vector3d *velocity)
 Get the State object
 
Eigen::Matrix4d GetCovarianceMatrix () override
 Get the Covariance Matrix object
 
- Public 成员函数 继承自 apollo::perception::camera::BaseFilter
 BaseFilter ()
 Construct a new Base Filter object
 
virtual ~BaseFilter ()
 
std::string Name ()
 The name of the camera base Filter
 

静态 Public 成员函数

static void SetQMatrixRatio (double q_matrix_ratio)
 Set the QMatrix Ratio
 

额外继承的成员函数

- Protected 属性 继承自 apollo::perception::camera::BaseFilter
std::string name_
 

详细描述

在文件 adaptive_kalman_filter.h26 行定义.

构造及析构函数说明

◆ AdaptiveKalmanFilter()

apollo::perception::camera::AdaptiveKalmanFilter::AdaptiveKalmanFilter ( )

在文件 adaptive_kalman_filter.cc26 行定义.

26{ name_ = "AdaptiveKalmanFilter"; }

◆ ~AdaptiveKalmanFilter()

apollo::perception::camera::AdaptiveKalmanFilter::~AdaptiveKalmanFilter ( )

在文件 adaptive_kalman_filter.cc28 行定义.

28{}

成员函数说明

◆ GetCovarianceMatrix()

Eigen::Matrix4d apollo::perception::camera::AdaptiveKalmanFilter::GetCovarianceMatrix ( )
inlineoverridevirtual

Get the Covariance Matrix object

返回
Eigen::Matrix4d

实现了 apollo::perception::camera::BaseFilter.

在文件 adaptive_kalman_filter.h72 行定义.

72{ return p_matrix_; }

◆ GetState()

void apollo::perception::camera::AdaptiveKalmanFilter::GetState ( Eigen::Vector3d *  anchor_point,
Eigen::Vector3d *  velocity 
)
virtual

Get the State object

参数
anchor_point
velocity

实现了 apollo::perception::camera::BaseFilter.

在文件 adaptive_kalman_filter.cc109 行定义.

110 {
111 if (anchor_point == nullptr) {
112 AERROR << "anchor_point is not available";
113 return;
114 }
115 if (velocity == nullptr) {
116 AERROR << "velocity is not available";
117 return;
118 }
119 *anchor_point = belief_anchor_point_;
120 *velocity = belief_velocity_;
121}
#define AERROR
Definition log.h:44

◆ Init()

void apollo::perception::camera::AdaptiveKalmanFilter::Init ( const base::Object object)
overridevirtual

Init base filter config

参数
object

实现了 apollo::perception::camera::BaseFilter.

在文件 adaptive_kalman_filter.cc30 行定义.

30 {
31 belief_anchor_point_ = object.center;
32 belief_velocity_ = object.velocity.cast<double>();
33 a_matrix_.setIdentity();
34 // initialize states to the states of the detected obstacle
35 posteriori_state_(0) = belief_anchor_point_(0);
36 posteriori_state_(1) = belief_anchor_point_(1);
37 posteriori_state_(2) = belief_velocity_(0);
38 posteriori_state_(3) = belief_velocity_(1);
39 priori_state_ = posteriori_state_;
40 q_matrix_.setIdentity();
41 q_matrix_ *= s_q_matrix_ratio_;
42 r_matrix_.setIdentity();
43 r_matrix_.topLeftCorner(2, 2) =
44 object.center_uncertainty.topLeftCorner(2, 2).cast<double>();
45 r_matrix_.block<2, 2>(2, 2) =
46 object.velocity_uncertainty.topLeftCorner(2, 2).cast<double>();
47 p_matrix_.setIdentity();
48 p_matrix_.topLeftCorner(2, 2) =
49 object.center_uncertainty.topLeftCorner(2, 2).cast<double>();
50 p_matrix_.block<2, 2>(2, 2) =
51 object.velocity_uncertainty.topLeftCorner(2, 2).cast<double>();
52 c_matrix_.setIdentity();
53}

◆ Predict()

Eigen::VectorXd apollo::perception::camera::AdaptiveKalmanFilter::Predict ( const double  time_diff)
overridevirtual

Predict the state of the object after time_diff

参数
time_diff
返回
Eigen::VectorXd

实现了 apollo::perception::camera::BaseFilter.

在文件 adaptive_kalman_filter.cc55 行定义.

55 {
56 Eigen::VectorXd state;
57 state.resize(4);
58 state[0] = belief_anchor_point_[0] + belief_velocity_[0] * time_diff;
59 state[1] = belief_anchor_point_[1] + belief_velocity_[1] * time_diff;
60 state[2] = belief_velocity_[0];
61 state[3] = belief_velocity_[1];
62 return state;
63}

◆ SetQMatrixRatio()

static void apollo::perception::camera::AdaptiveKalmanFilter::SetQMatrixRatio ( double  q_matrix_ratio)
inlinestatic

Set the QMatrix Ratio

参数
q_matrix_ratio

在文件 adaptive_kalman_filter.h79 行定义.

79 {
80 s_q_matrix_ratio_ = q_matrix_ratio;
81 }

◆ UpdateWithObject()

Eigen::VectorXd apollo::perception::camera::AdaptiveKalmanFilter::UpdateWithObject ( const base::Object new_object,
double  time_diff 
)
overridevirtual

Update the state of the target based on the observations

参数
new_object
time_diff
返回
Eigen::VectorXd

实现了 apollo::perception::camera::BaseFilter.

在文件 adaptive_kalman_filter.cc65 行定义.

66 {
67 // predict and then correct
68 a_matrix_.setIdentity();
69 a_matrix_(0, 2) = time_diff;
70 a_matrix_(1, 3) = time_diff;
71 priori_state_ = a_matrix_ * posteriori_state_;
72 p_matrix_ = ((a_matrix_ * p_matrix_) * a_matrix_.transpose()) + q_matrix_;
73 belief_anchor_point_ = new_object.center;
74 belief_velocity_ = new_object.velocity.cast<double>();
75 Eigen::Vector4d measurement;
76 measurement(0) = belief_anchor_point_(0);
77 measurement(1) = belief_anchor_point_(1);
78 measurement(2) = belief_velocity_(0);
79 measurement(3) = belief_velocity_(1);
80 r_matrix_.setIdentity();
81 r_matrix_.topLeftCorner(2, 2) =
82 new_object.center_uncertainty.topLeftCorner(2, 2).cast<double>();
83 r_matrix_.block<2, 2>(2, 2) =
84 new_object.velocity_uncertainty.topLeftCorner(2, 2).cast<double>();
85 k_matrix_ =
86 p_matrix_ * c_matrix_.transpose() *
87 (c_matrix_ * p_matrix_ * c_matrix_.transpose() + r_matrix_).inverse();
88 Eigen::Vector4d predict_measurement(priori_state_(0), priori_state_(1),
89 priori_state_(2), priori_state_(3));
90 posteriori_state_ =
91 priori_state_ + k_matrix_ * (measurement - predict_measurement);
92 p_matrix_ =
93 (Eigen::Matrix4d::Identity() - k_matrix_ * c_matrix_) * p_matrix_ *
94 (Eigen::Matrix4d::Identity() - k_matrix_ * c_matrix_).transpose() +
95 k_matrix_ * r_matrix_ * k_matrix_.transpose();
96 belief_anchor_point_(0) = posteriori_state_(0);
97 belief_anchor_point_(1) = posteriori_state_(1);
98 belief_velocity_(0) = posteriori_state_(2);
99 belief_velocity_(1) = posteriori_state_(3);
100 Eigen::VectorXd state;
101 state.resize(4);
102 state[0] = belief_anchor_point_[0];
103 state[1] = belief_anchor_point_[1];
104 state[2] = belief_velocity_[0];
105 state[3] = belief_velocity_[1];
106 return state;
107}

该类的文档由以下文件生成: