Bayes Filters Library
SimulatedStateModel.h
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 
8 #ifndef SIMULATEDPROCESS_H
9 #define SIMULATEDPROCESS_H
10 
11 #include <BayesFilters/Agent.h>
12 #include <BayesFilters/Logger.h>
14 
15 #include <memory>
16 #include <fstream>
17 
18 namespace bfl {
19  class SimulatedStateModel;
20 }
21 
22 
23 class bfl::SimulatedStateModel : public Agent, public Logger
24 {
25 public:
26  SimulatedStateModel(std::unique_ptr<StateModel> state_model, const Eigen::Ref<const Eigen::VectorXd>& initial_state, const unsigned int simulation_time);
27 
28  virtual ~SimulatedStateModel() noexcept = default;
29 
30  bool bufferData() override;
31 
32  Data getData() const override;
33 
34  bool setProperty(const std::string& property) override;
35 
37 
38 
39 protected:
40  std::unique_ptr<StateModel> state_model_;
41 
43 
44  unsigned int current_simulation_time_ = 0;
45 
46  bool log_enabled_ = false;
47 
48  mutable std::ofstream log_file_state_;
49 
50  std::vector<std::string> log_file_names(const std::string& folder_path, const std::string& file_name_prefix) override
51  {
52  return {folder_path + "/" + file_name_prefix + "_target"};
53  }
54 
55  void log() override;
56 
57 
58 private:
59  unsigned int simulation_time_;
60 
61  Eigen::MatrixXd target_;
62 };
63 
64 #endif /* SIMULATEDPROCESS_H */
StateModel.h
bfl::SimulatedStateModel::state_model_
std::unique_ptr< StateModel > state_model_
Definition: SimulatedStateModel.h:40
bfl::SimulatedStateModel::current_simulation_time_
unsigned int current_simulation_time_
Definition: SimulatedStateModel.h:44
bfl::SimulatedStateModel::log_file_state_
std::ofstream log_file_state_
Definition: SimulatedStateModel.h:48
bfl
Port of boost::any for C++11 compilers.
Definition: AdditiveMeasurementModel.h:13
bfl::SimulatedStateModel::~SimulatedStateModel
virtual ~SimulatedStateModel() noexcept=default
bfl::SimulatedStateModel::setProperty
bool setProperty(const std::string &property) override
Definition: SimulatedStateModel.cpp:53
bfl::Logger
Definition: Logger.h:21
Logger.h
bfl::SimulatedStateModel::getStateModel
StateModel & getStateModel()
Definition: SimulatedStateModel.cpp:67
bfl::SimulatedStateModel::SimulatedStateModel
SimulatedStateModel(std::unique_ptr< StateModel > state_model, const Eigen::Ref< const Eigen::VectorXd > &initial_state, const unsigned int simulation_time)
Definition: SimulatedStateModel.cpp:17
Agent.h
bfl::StateModel
Definition: StateModel.h:22
bfl::SimulatedStateModel::getData
Data getData() const override
Definition: SimulatedStateModel.cpp:47
bfl::SimulatedStateModel::bufferData
bool bufferData() override
Definition: SimulatedStateModel.cpp:33
bfl::Agent
Definition: Agent.h:23
bfl::SimulatedStateModel::simulation_time_
unsigned int simulation_time_
Definition: SimulatedStateModel.h:59
bfl::SimulatedStateModel
Definition: SimulatedStateModel.h:23
bfl::any::any
The class any describes a type-safe container for single values of any type.
Definition: any.h:77
bfl::SimulatedStateModel::log_file_names
std::vector< std::string > log_file_names(const std::string &folder_path, const std::string &file_name_prefix) override
Definition: SimulatedStateModel.h:50
bfl::SimulatedStateModel::target_
Eigen::MatrixXd target_
Definition: SimulatedStateModel.h:61
bfl::SimulatedStateModel::log
void log() override
Definition: SimulatedStateModel.cpp:73
bfl::SimulatedStateModel::log_enabled_
bool log_enabled_
Definition: SimulatedStateModel.h:46
bfl::SimulatedStateModel::data_simulated_state_model_
Data data_simulated_state_model_
Definition: SimulatedStateModel.h:42