Bayes Filters Library
StateModel.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 using namespace bfl;
11 using namespace Eigen;
12 
13 
14 bool StateModel::skip(const std::string& what_step, const bool status)
15 {
16  if (what_step == "state")
17  skip_ = status;
18  else if (what_step == "exogenous")
19  exogenous_model().skip(what_step, status);
20  else
21  return false;
22 
23  return true;
24 }
25 
26 
28 {
29  return skip_;
30 }
31 
32 
33 bool StateModel::add_exogenous_model(std::unique_ptr<ExogenousModel> exogenous_model)
34 {
35  exogenous_model_ = std::move(exogenous_model);
36 
37  return true;
38 }
39 
40 
42 {
43  if (exogenous_model_)
44  return true;
45  else
46  return false;
47 }
48 
49 
51 {
52  if (exogenous_model_)
53  return *exogenous_model_;
54 
55  throw std::runtime_error("ERROR::STATEMODEL::GET_EXOGENOUS_MODEL\nERROR:\n\tNo valid ExogenousModel object present in LTIStateModel object. Use LTIStateModel::add_exogenous_model() to add one.");
56 }
57 
58 
59 
60 Eigen::MatrixXd StateModel::getJacobian()
61 {
62  throw std::runtime_error("ERROR::STATEMODEL::GETJACOBIAN\nERROR:\n\tMethod not implemented.");
63 }
64 
65 
66 Eigen::VectorXd StateModel::getTransitionProbability(const Ref<const MatrixXd>& prev_states, const Ref<const MatrixXd>& cur_states)
67 {
68  throw std::runtime_error("ERROR::STATEMODEL::TRANSITIONPROBABILITY\nERROR:\n\tMethod not implemented.");
69 }
70 
71 
73 {
74  throw std::runtime_error("ERROR::STATEMODEL::GETNOISECOVARIANCEMATRIX\nERROR:\n\tMethod not implemented.");
75 }
76 
77 
78 Eigen::MatrixXd StateModel::getNoiseSample(const std::size_t num)
79 {
80  throw std::runtime_error("ERROR::STATEMODEL::GETNOISESAMPLE\nERROR:\n\tMethod not implemented.");
81 }
82 
83 
84 bool StateModel::setSamplingTime(const double& time)
85 {
86  /* Does nothing by default. */
87 
88  return true;
89 }
StateModel.h
bfl::StateModel::exogenous_model
ExogenousModel & exogenous_model()
Definition: StateModel.cpp:50
bfl
Port of boost::any for C++11 compilers.
Definition: AdditiveMeasurementModel.h:13
bfl::StateModel::setSamplingTime
virtual bool setSamplingTime(const double &time)
Definition: StateModel.cpp:84
bfl::StateModel::getNoiseSample
virtual Eigen::MatrixXd getNoiseSample(const std::size_t num)
Definition: StateModel.cpp:78
bfl::StateModel::have_exogenous_model
bool have_exogenous_model() noexcept
Definition: StateModel.cpp:41
bfl::StateModel::add_exogenous_model
bool add_exogenous_model(std::unique_ptr< ExogenousModel > exogenous_model)
Definition: StateModel.cpp:33
bfl::StateModel::getTransitionProbability
virtual Eigen::VectorXd getTransitionProbability(const Eigen::Ref< const Eigen::MatrixXd > &prev_states, const Eigen::Ref< const Eigen::MatrixXd > &cur_states)
Definition: StateModel.cpp:66
bfl::ExogenousModel
Definition: ExogenousModel.h:19
bfl::StateModel::getJacobian
virtual Eigen::MatrixXd getJacobian()
Definition: StateModel.cpp:60
bfl::StateModel::getNoiseCovarianceMatrix
virtual Eigen::MatrixXd getNoiseCovarianceMatrix()
Definition: StateModel.cpp:72
bfl::StateModel::skip
bool skip(const std::string &what_step, const bool status) override
Definition: StateModel.cpp:14
bfl::StateModel::is_skipping
bool is_skipping() override
Definition: StateModel.cpp:27