visual-tracking-control
DrawFwdKinPoses.cpp
Go to the documentation of this file.
1 #include <DrawFwdKinPoses.h>
2 
3 #include <utility>
4 
5 using namespace bfl;
6 using namespace Eigen;
7 
8 
10 
11 
13 
14 
16  state_model_(std::move(pf_prediction.state_model_)),
17  exogenous_model_(std::move(pf_prediction.exogenous_model_)) { };
18 
19 
21 {
22  state_model_ = std::move(pf_prediction.state_model_);
23 
24  exogenous_model_ = std::move(pf_prediction.exogenous_model_);
25 
26  return *this;
27 }
28 
29 
31 {
32  return *state_model_;
33 }
34 
35 
36 void DrawFwdKinPoses::setStateModel(std::unique_ptr<StateModel> state_model)
37 {
38  state_model_ = std::move(state_model);
39 }
40 
41 
43 {
44  return *exogenous_model_;
45 }
46 
47 
48 void DrawFwdKinPoses::setExogenousModel(std::unique_ptr<ExogenousModel> exogenous_model)
49 {
50  exogenous_model_ = std::move(exogenous_model);
51 }
52 
53 
54 void DrawFwdKinPoses::predictStep(const Ref<const MatrixXf>& prev_states, const Ref<const VectorXf>& prev_weights,
55  Ref<MatrixXf> pred_states, Ref<VectorXf> pred_weights)
56 {
57  VectorXf sorted_cor = prev_weights;
58  std::sort(sorted_cor.data(), sorted_cor.data() + sorted_cor.size());
59  float threshold = sorted_cor.tail(6)(0);
60 
61  exogenous_model_->setProperty("ICFW_DELTA");
62 
63  for (int j = 0; j < prev_weights.rows(); ++j)
64  {
65  VectorXf tmp_states = VectorXf::Zero(prev_states.rows());
66 
67  if (!getSkipExogenous())
68  exogenous_model_->propagate(prev_states.col(j), tmp_states);
69  else
70  tmp_states = prev_states.col(j);
71 
72  if (!getSkipState() && prev_weights(j) <= threshold)
73  state_model_->motion(tmp_states, pred_states.col(j));
74  else
75  pred_states.col(j) = tmp_states;
76  }
77 
78  pred_weights = prev_weights;
79 }
StateModel & getStateModel() override
void predictStep(const Eigen::Ref< const Eigen::MatrixXf > &prev_states, const Eigen::Ref< const Eigen::VectorXf > &prev_weights, Eigen::Ref< Eigen::MatrixXf > pred_states, Eigen::Ref< Eigen::VectorXf > pred_weights) override
DrawFwdKinPoses & operator=(DrawFwdKinPoses &&pf_prediction) noexcept
ExogenousModel & getExogenousModel() override
void setExogenousModel(std::unique_ptr< ExogenousModel > exogenous_model) override
void setStateModel(std::unique_ptr< StateModel > state_model) override