27 mF = Eigen::MatrixXd::Identity(7, 7);
28 mH = Eigen::MatrixXd::Identity(7, 7);
30 mQ = 0.1 * Eigen::MatrixXd::Identity(7, 7);
31 mR = 1 * Eigen::MatrixXd::Identity(7, 7);
33 mP = Eigen::MatrixXd::Identity(
mF.rows(),
mF.cols());
50 lastUpdate = std::chrono::high_resolution_clock::now();
53 Eigen::VectorXd
x = Eigen::VectorXd::Zero(7);
57 std::cerr <<
"Got a Object without poses." << std::endl;
62 x(0) = current_pose->point->getEigen().x();
63 x(1) = current_pose->point->getEigen().y();
64 x(2) = current_pose->point->getEigen().z();
65 x(3) = current_pose->quat->getEigen().w();
66 x(4) = current_pose->quat->getEigen().x();
67 x(5) = current_pose->quat->getEigen().y();
68 x(6) = current_pose->quat->getEigen().z();
78 Eigen::VectorXd xPred =
mF * x;
79 Eigen::MatrixXd PPred =
mF *
mP *
mF.transpose() +
mQ;
82 Eigen::MatrixXd Ku = PPred *
mH.transpose();
83 Eigen::MatrixXd Kl = (
mH * PPred *
mH.transpose() +
mR);
84 Eigen::MatrixXd K = Ku * Kl.inverse();
85 Eigen::VectorXd xNew = xPred + K * (
mZ -
mH * xPred);
86 mP = PPred - K *
mH * PPred;
99 return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() -
lastUpdate).count() > threshold;
106 geometry_msgs::Pose current_pose;
107 current_pose.position.x =
mZ(0);
108 current_pose.position.y =
mZ(1);
109 current_pose.position.z =
mZ(2);
110 current_pose.orientation.w =
mZ(3);
111 current_pose.orientation.x =
mZ(4);
112 current_pose.orientation.y =
mZ(5);
113 current_pose.orientation.z =
mZ(6);
116 geometry_msgs::PoseWithCovariance current_pose_with_c;
117 current_pose_with_c.pose = current_pose;
void update(ISM::Object pObject)
std::chrono::high_resolution_clock::time_point lastUpdate
KalmanFilter(ISM::Object pObject)
TFSIMD_FORCE_INLINE const tfScalar & x() const
bool isTimedOut(unsigned int threshold)