Bayes Filters Library
GPFPrediction.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2019 Istituto Italiano di Tecnologia (IIT)
3  *
4  * This software may be modified and distributed under the terms of the
5  * BSD 3-Clause license. See the accompanying LICENSE file for details.
6  */
7 
9 
10 #include <exception>
11 
12 using namespace bfl;
13 using namespace Eigen;
14 
15 
16 GPFPrediction::GPFPrediction(std::unique_ptr<GaussianPrediction> gauss_prediction) noexcept :
17  gaussian_prediction_(std::move(gauss_prediction))
18 { }
19 
20 
22  PFPrediction(std::move(prediction)),
23  gaussian_prediction_(std::move(prediction.gaussian_prediction_))
24 { }
25 
26 
28 {
29  if (this == &prediction)
30  return *this;
31 
32  PFPrediction::operator=(std::move(prediction));
33 
34  gaussian_prediction_ = std::move(prediction.gaussian_prediction_);
35 
36  return *this;
37 }
38 
39 
41 {
42  return gaussian_prediction_->getStateModel();
43 }
44 
45 
46 void GPFPrediction::predictStep(const ParticleSet& prev_particles, ParticleSet& pred_particles)
47 {
48  /* Propagate Gaussian belief associated to each particle. */
49  gaussian_prediction_->predict(prev_particles, pred_particles);
50 
51  /* Copy particles weights since they do not change. */
52  pred_particles.weight() = prev_particles.weight();
53 
54  /* Copy position of particles since they do not change.
55 
56  Note: in this step the mean of the Gaussian belief of each particle is updated
57  while the position of the particles do not change. */
58  pred_particles.state() = prev_particles.state();
59 
60 }
bfl::GPFPrediction::operator=
GPFPrediction & operator=(const GPFPrediction &prediction) noexcept=delete
bfl
Port of boost::any for C++11 compilers.
Definition: AdditiveMeasurementModel.h:13
bfl::PFPrediction::operator=
PFPrediction & operator=(const PFPrediction &prediction) noexcept=delete
bfl::PFPrediction
Definition: PFPrediction.h:25
GPFPrediction.h
bfl::GPFPrediction::predictStep
void predictStep(const ParticleSet &previous_particles, ParticleSet &predicted_particles) override
Definition: GPFPrediction.cpp:46
bfl::GPFPrediction::GPFPrediction
GPFPrediction(std::unique_ptr< GaussianPrediction > gauss_prediction) noexcept
Definition: GPFPrediction.cpp:16
bfl::GPFPrediction
Definition: GPFPrediction.h:24
bfl::StateModel
Definition: StateModel.h:22
bfl::ParticleSet::state
Eigen::Ref< Eigen::MatrixXd > state()
Definition: ParticleSet.cpp:84
bfl::GPFPrediction::getStateModel
StateModel & getStateModel() noexcept override
Definition: GPFPrediction.cpp:40
bfl::ParticleSet
Definition: ParticleSet.h:20
bfl::GaussianMixture::weight
Eigen::Ref< Eigen::VectorXd > weight()
Definition: GaussianMixture.cpp:166