12 lastDetectedHuman = human;
14 if (useKalmanFilter) {
37 ukf = std::make_unique<UnscentedKalmanFilter<SystemModelT>>(Q, R, alpha, state0, P0);
46 if (useKalmanFilter) {
50 human.
pose = fromUkfState(ukf->getCurrentState());
61 double dt = (detectionTime - lastDetectedHuman.
detectionTime).toSecondsDouble();
64 if (useKalmanFilter) {
67 ukf->update(observation);
69 newPose = fromUkfState(ukf->getCurrentState());
70 newPose.linear() = pose.linear();
79 Eigen::Vector2f ds = newPose.translation() - lastDetectedHuman.
pose.translation();
80 Eigen::Vector2f linVelocity = ds /
dt;
87 newVelocity.setZero();
94 lastDetectedHuman = human;
114 return {{pose.translation().x() / 1000,
115 pose.translation().y() / 1000,
124 pose2d.translation().x() = pose.
pose.x() * 1000;
125 pose2d.translation().y() = pose.
pose.y() * 1000;
126 pose2d.linear() = Eigen::Rotation2Df(0 ).toRotationMatrix();
132 HumanFilter::toUkfControl(
const Eigen::Vector2f& vel)
135 const auto& global_R_human = human.
pose.linear();
136 const auto& human_V_vel = global_R_human.inverse() * vel;
139 return {{human_V_vel.x() / 1000, human_V_vel.y() / 1000, 0}};