Commit 68fd41ed authored by oscar's avatar oscar

提交更新

parent b9bb53c6
......@@ -63,5 +63,5 @@ public:
int m_updateValidCount = 3;//更新多少次认为是一个有效数据。
std::shared_ptr<mytracker_f::KalmanFilter> kf_ = nullptr;
std::shared_ptr<mytracker_f::KalmanFilter_f> kf_ = nullptr;
};
......@@ -3,7 +3,7 @@
Track2D::Track2D():BaseTrack(8, 4)
{
std::shared_ptr<mytracker_f::KalmanFilter> kf = std::make_shared<mytracker::KalmanFilter>(8, 4);
std::shared_ptr<mytracker_f::KalmanFilter_f> kf = std::make_shared<mytracker_f::KalmanFilter_f>(8, 4);
kf->F_ <<
1, 0, 0, 0, 1, 0, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0,
......
......@@ -2,7 +2,7 @@
namespace mytracker_f {
KalmanFilter::KalmanFilter(unsigned int num_states, unsigned int num_obs) :
KalmanFilter_f::KalmanFilter_f(unsigned int num_states, unsigned int num_obs) :
num_states_(num_states), num_obs_(num_obs) {
/*** Predict ***/
// State vector
......@@ -33,25 +33,25 @@ KalmanFilter::KalmanFilter(unsigned int num_states, unsigned int num_obs) :
}
void KalmanFilter::Coast() {
void KalmanFilter_f::Coast() {
x_predict_ = F_ * x_;
P_predict_ = F_ * P_ * F_.transpose() + Q_;
}
void KalmanFilter::Predict() {
void KalmanFilter_f::Predict() {
Coast();
x_ = x_predict_;
P_ = P_predict_;
}
Eigen::VectorXf KalmanFilter::PredictionToObservation(const Eigen::VectorXf &state) {
Eigen::VectorXf KalmanFilter_f::PredictionToObservation(const Eigen::VectorXf &state) {
return (H_*state);
}
void KalmanFilter::Update(const Eigen::VectorXf& z) {
void KalmanFilter_f::Update(const Eigen::VectorXf& z) {
Eigen::VectorXf z_predict = PredictionToObservation(x_predict_);
// y - innovation, z - real observation, z_predict - predicted observation
......@@ -98,7 +98,7 @@ void KalmanFilter::Update(const Eigen::VectorXf& z) {
}
float KalmanFilter::CalculateLogLikelihood(const Eigen::VectorXf& y, const Eigen::MatrixXf& S) {
float KalmanFilter_f::CalculateLogLikelihood(const Eigen::VectorXf& y, const Eigen::MatrixXf& S) {
float log_likelihood;
// Note: Computing log(M.determinant()) in Eigen C++ is risky for large matrices since it may overflow or underflow.
......
......@@ -7,7 +7,7 @@ namespace mytracker_f {
// abstract class for Kalman filter
// implementation could be KF/EKF/UKF...
class KalmanFilter {
class KalmanFilter_f {
public:
/**
* user need to define H matrix & R matrix
......@@ -15,10 +15,10 @@ public:
* @param num_obs
*/
// constructor
explicit KalmanFilter(unsigned int num_states, unsigned int num_obs);
explicit KalmanFilter_f(unsigned int num_states, unsigned int num_obs);
// destructor
virtual ~KalmanFilter() = default;
virtual ~KalmanFilter_f() = default;
/**
* Coast state and state covariance using the process model
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment