Bayes Filters Library
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
bfl::SimulatedLinearSensor Class Reference

#include <SimulatedLinearSensor.h>

Inheritance diagram for bfl::SimulatedLinearSensor:
[legend]

Public Types

using LinearMatrixComponent = std::pair< std::size_t, std::vector< std::size_t > >
 Pair of data representing. More...
 

Public Member Functions

 SimulatedLinearSensor (std::unique_ptr< bfl::SimulatedStateModel > simulated_state_model, const LinearMatrixComponent &linear_matrix_component, const Eigen::Ref< const Eigen::MatrixXd > &noise_covariance_matrix, const unsigned int seed)
 
 SimulatedLinearSensor (std::unique_ptr< bfl::SimulatedStateModel > simulated_state_model, const LinearMatrixComponent &linear_matrix_component, const Eigen::Ref< const Eigen::MatrixXd > &noise_covariance_matrix)
 
virtual ~SimulatedLinearSensor () noexcept
 
bool freeze (const Data &data=Data()) override
 
std::pair< bool, bfl::Datameasure (const Data &data=Data()) const override
 
VectorDescription getInputDescription () const override
 
VectorDescription getMeasurementDescription () const override
 
std::pair< bool, Eigen::MatrixXd > getNoiseCovarianceMatrix () const override
 
Eigen::MatrixXd getMeasurementMatrix () const override
 
virtual std::pair< bool, bfl::DatapredictedMeasure (const Eigen::Ref< const Eigen::MatrixXd > &cur_states) const override
 
virtual std::pair< bool, bfl::Datainnovation (const bfl::Data &predicted_measurements, const bfl::Data &measurements) const override
 
virtual bool setProperty (const std::string &property)
 
bool enable_log (const std::string &folder_path, const std::string &file_name_prefix)
 
bool disable_log ()
 
std::string get_folder_path () const
 
std::string get_file_name_prefix () const
 
template<typename DatumType >
void logger (DatumType datum)
 
template<typename... DataType>
void logger (DataType... data)
 
template<typename DatumType >
void logger (DatumType datum) const
 
template<typename... DataType>
void logger (DataType... data) const
 

Protected Member Functions

void log () override
 
std::pair< bool, Eigen::MatrixXd > getNoiseSample (const int num) const
 
std::vector< std::string > log_file_names (const std::string &folder_path, const std::string &file_name_prefix) override
 

Protected Attributes

std::unique_ptr< bfl::SimulatedStateModelsimulated_state_model_
 
Eigen::MatrixXd measurement_
 
VectorDescription input_description_
 
VectorDescription measurement_description_
 
double T_
 The Sampling interval in [time]. More...
 
Eigen::MatrixXd sqrt_R_
 Square root matrix of R_. More...
 
std::function< double()> gauss_rnd_sample_
 Random number generator function from a Normal distribution. More...
 
Eigen::MatrixXd H_
 Measurement matrix. More...
 
Eigen::MatrixXd R_
 Convariance matrix of the additive white noise of the measurements. More...
 

Private Member Functions

template<typename DatumType >
void logger_helper (const size_t pos, DatumType datum)
 
template<typename DatumType , typename... DataType>
void logger_helper (const size_t pos, DatumType datum, DataType... data)
 
template<typename DatumType >
void logger_helper (const size_t pos, DatumType datum) const
 
template<typename DatumType , typename... DataType>
void logger_helper (const size_t pos, DatumType datum, DataType... data) const
 

Private Attributes

std::mt19937_64 generator_
 
std::normal_distribution< double > distribution_
 
bool log_enabled_ = false
 
std::ofstream log_file_measurements_
 
std::string folder_path_
 
std::string file_name_prefix_
 
std::vector< std::string > file_names_
 
std::vector< std::ofstream > log_files_
 

Detailed Description

Definition at line 22 of file SimulatedLinearSensor.h.

Member Typedef Documentation

◆ LinearMatrixComponent

using bfl::LinearModel::LinearMatrixComponent = std::pair<std::size_t, std::vector<std::size_t> >
inherited

Pair of data representing.

  • first: the dimension of the state vector
  • second: the 0-based row number of the state vector that we want to measure.

Example: LinearMatrixComponent{4, {0, 2}} results in the following measurement matrix H = [ 1.0 0 0 0 ] [ 0 0 1.0 0 ]

Definition at line 37 of file LinearModel.h.

Constructor & Destructor Documentation

◆ SimulatedLinearSensor() [1/2]

bfl::SimulatedLinearSensor::SimulatedLinearSensor ( std::unique_ptr< bfl::SimulatedStateModel simulated_state_model,
const LinearMatrixComponent linear_matrix_component,
const Eigen::Ref< const Eigen::MatrixXd > &  noise_covariance_matrix,
const unsigned int  seed 
)

◆ SimulatedLinearSensor() [2/2]

bfl::SimulatedLinearSensor::SimulatedLinearSensor ( std::unique_ptr< bfl::SimulatedStateModel simulated_state_model,
const LinearMatrixComponent linear_matrix_component,
const Eigen::Ref< const Eigen::MatrixXd > &  noise_covariance_matrix 
)

◆ ~SimulatedLinearSensor()

SimulatedLinearSensor::~SimulatedLinearSensor ( )
virtualdefaultnoexcept

Member Function Documentation

◆ disable_log()

bool Logger::disable_log ( )
inherited

◆ enable_log()

bool Logger::enable_log ( const std::string &  folder_path,
const std::string &  file_name_prefix 
)
inherited

Definition at line 22 of file Logger.cpp.

References bfl::Logger::file_name_prefix_, bfl::Logger::file_names_, bfl::Logger::folder_path_, bfl::Logger::log_enabled_, bfl::Logger::log_file_names(), and bfl::Logger::log_files_.

Here is the call graph for this function:

◆ freeze()

bool SimulatedLinearSensor::freeze ( const Data data = Data())
overridevirtual

Implements bfl::MeasurementModel.

Definition at line 77 of file SimulatedLinearSensor.cpp.

References bfl::LinearModel::getNoiseSample(), bfl::LTIMeasurementModel::H_, log(), measurement_, and simulated_state_model_.

Here is the call graph for this function:

◆ get_file_name_prefix()

std::string Logger::get_file_name_prefix ( ) const
inherited

Definition at line 91 of file Logger.cpp.

References bfl::Logger::file_name_prefix_.

◆ get_folder_path()

std::string Logger::get_folder_path ( ) const
inherited

Definition at line 85 of file Logger.cpp.

References bfl::Logger::folder_path_.

◆ getInputDescription()

VectorDescription SimulatedLinearSensor::getInputDescription ( ) const
overridevirtual

Reimplemented from bfl::MeasurementModel.

Definition at line 101 of file SimulatedLinearSensor.cpp.

References input_description_.

◆ getMeasurementDescription()

VectorDescription SimulatedLinearSensor::getMeasurementDescription ( ) const
overridevirtual

Reimplemented from bfl::MeasurementModel.

Definition at line 107 of file SimulatedLinearSensor.cpp.

References measurement_description_.

◆ getMeasurementMatrix()

Eigen::MatrixXd LinearModel::getMeasurementMatrix ( ) const
overridevirtualinherited

Implements bfl::LinearMeasurementModel.

Definition at line 69 of file LinearModel.cpp.

References bfl::LTIMeasurementModel::H_.

◆ getNoiseCovarianceMatrix()

std::pair< bool, MatrixXd > LinearModel::getNoiseCovarianceMatrix ( ) const
overridevirtualinherited

Reimplemented from bfl::MeasurementModel.

Definition at line 63 of file LinearModel.cpp.

References bfl::LTIMeasurementModel::R_.

◆ getNoiseSample()

std::pair< bool, MatrixXd > LinearModel::getNoiseSample ( const int  num) const
protectedinherited

Definition at line 51 of file LinearModel.cpp.

References bfl::LinearModel::gauss_rnd_sample_, and bfl::LinearModel::sqrt_R_.

Referenced by freeze().

◆ innovation()

std::pair< bool, bfl::Data > LinearMeasurementModel::innovation ( const bfl::Data predicted_measurements,
const bfl::Data measurements 
) const
overridevirtualinherited

Implements bfl::MeasurementModel.

Definition at line 24 of file LinearMeasurementModel.cpp.

◆ log()

void SimulatedLinearSensor::log ( )
overrideprotectedvirtual

Reimplemented from bfl::Logger.

Definition at line 113 of file SimulatedLinearSensor.cpp.

References bfl::Logger::logger(), and measurement_.

Referenced by freeze().

Here is the call graph for this function:

◆ log_file_names()

std::vector<std::string> bfl::LinearModel::log_file_names ( const std::string &  folder_path,
const std::string &  file_name_prefix 
)
inlineoverrideprotectedvirtualinherited

Reimplemented from bfl::Logger.

Definition at line 69 of file LinearModel.h.

◆ logger() [1/4]

template<typename... DataType>
void bfl::Logger::logger ( DataType...  data)
inlineinherited

Definition at line 42 of file Logger.h.

References bfl::Logger::log_enabled_, and bfl::Logger::logger_helper().

Here is the call graph for this function:

◆ logger() [2/4]

template<typename... DataType>
void bfl::Logger::logger ( DataType...  data) const
inlineinherited

Definition at line 56 of file Logger.h.

References bfl::Logger::log_enabled_, and bfl::Logger::logger_helper().

Here is the call graph for this function:

◆ logger() [3/4]

template<typename DatumType >
void bfl::Logger::logger ( DatumType  datum)
inlineinherited

Definition at line 35 of file Logger.h.

References bfl::Logger::log_enabled_, and bfl::Logger::log_files_.

Referenced by log().

◆ logger() [4/4]

template<typename DatumType >
void bfl::Logger::logger ( DatumType  datum) const
inlineinherited

Definition at line 49 of file Logger.h.

References bfl::Logger::log_enabled_, and bfl::Logger::log_files_.

◆ logger_helper() [1/4]

template<typename DatumType >
void bfl::Logger::logger_helper ( const size_t  pos,
DatumType  datum 
)
inlineprivateinherited

Definition at line 81 of file Logger.h.

References bfl::Logger::log_files_.

Referenced by bfl::Logger::logger(), and bfl::Logger::logger_helper().

◆ logger_helper() [2/4]

template<typename DatumType >
void bfl::Logger::logger_helper ( const size_t  pos,
DatumType  datum 
) const
inlineprivateinherited

Definition at line 95 of file Logger.h.

References bfl::Logger::log_files_.

◆ logger_helper() [3/4]

template<typename DatumType , typename... DataType>
void bfl::Logger::logger_helper ( const size_t  pos,
DatumType  datum,
DataType...  data 
)
inlineprivateinherited

Definition at line 87 of file Logger.h.

References bfl::Logger::log_files_, and bfl::Logger::logger_helper().

Here is the call graph for this function:

◆ logger_helper() [4/4]

template<typename DatumType , typename... DataType>
void bfl::Logger::logger_helper ( const size_t  pos,
DatumType  datum,
DataType...  data 
) const
inlineprivateinherited

Definition at line 101 of file Logger.h.

References bfl::Logger::log_files_, and bfl::Logger::logger_helper().

Here is the call graph for this function:

◆ measure()

std::pair< bool, Data > SimulatedLinearSensor::measure ( const Data data = Data()) const
overridevirtual

Implements bfl::MeasurementModel.

Definition at line 95 of file SimulatedLinearSensor.cpp.

References measurement_.

◆ predictedMeasure()

std::pair< bool, bfl::Data > LinearMeasurementModel::predictedMeasure ( const Eigen::Ref< const Eigen::MatrixXd > &  cur_states) const
overridevirtualinherited

Implements bfl::MeasurementModel.

Definition at line 16 of file LinearMeasurementModel.cpp.

◆ setProperty()

bool MeasurementModel::setProperty ( const std::string &  property)
virtualinherited

Reimplemented in bfl::MeasurementModelDecorator.

Definition at line 22 of file MeasurementModel.cpp.

Member Data Documentation

◆ distribution_

std::normal_distribution<double> bfl::LinearModel::distribution_
privateinherited

Definition at line 78 of file LinearModel.h.

◆ file_name_prefix_

std::string bfl::Logger::file_name_prefix_
privateinherited

Definition at line 72 of file Logger.h.

Referenced by bfl::Logger::enable_log(), and bfl::Logger::get_file_name_prefix().

◆ file_names_

std::vector<std::string> bfl::Logger::file_names_
privateinherited

Definition at line 74 of file Logger.h.

Referenced by bfl::Logger::disable_log(), and bfl::Logger::enable_log().

◆ folder_path_

std::string bfl::Logger::folder_path_
privateinherited

Definition at line 70 of file Logger.h.

Referenced by bfl::Logger::enable_log(), and bfl::Logger::get_folder_path().

◆ gauss_rnd_sample_

std::function<double()> bfl::LinearModel::gauss_rnd_sample_
protectedinherited

Random number generator function from a Normal distribution.

A call to gauss_rnd_sample_() returns a doubleing point random number.

Definition at line 67 of file LinearModel.h.

Referenced by bfl::LinearModel::getNoiseSample().

◆ generator_

std::mt19937_64 bfl::LinearModel::generator_
privateinherited

Definition at line 76 of file LinearModel.h.

◆ H_

Eigen::MatrixXd bfl::LTIMeasurementModel::H_
protectedinherited

Measurement matrix.

Definition at line 39 of file LTIMeasurementModel.h.

Referenced by freeze(), and bfl::LinearModel::getMeasurementMatrix().

◆ input_description_

VectorDescription bfl::SimulatedLinearSensor::input_description_
protected

Definition at line 44 of file SimulatedLinearSensor.h.

Referenced by getInputDescription().

◆ log_enabled_

bool bfl::LinearModel::log_enabled_ = false
privateinherited

Definition at line 80 of file LinearModel.h.

◆ log_file_measurements_

std::ofstream bfl::LinearModel::log_file_measurements_
mutableprivateinherited

Definition at line 82 of file LinearModel.h.

◆ log_files_

std::vector<std::ofstream> bfl::Logger::log_files_
mutableprivateinherited

◆ measurement_

Eigen::MatrixXd bfl::SimulatedLinearSensor::measurement_
protected

Definition at line 42 of file SimulatedLinearSensor.h.

Referenced by freeze(), log(), and measure().

◆ measurement_description_

VectorDescription bfl::SimulatedLinearSensor::measurement_description_
protected

Definition at line 46 of file SimulatedLinearSensor.h.

Referenced by getMeasurementDescription().

◆ R_

Eigen::MatrixXd bfl::LTIMeasurementModel::R_
protectedinherited

Convariance matrix of the additive white noise of the measurements.

Definition at line 44 of file LTIMeasurementModel.h.

Referenced by bfl::LinearModel::getNoiseCovarianceMatrix().

◆ simulated_state_model_

std::unique_ptr<bfl::SimulatedStateModel> bfl::SimulatedLinearSensor::simulated_state_model_
protected

Definition at line 40 of file SimulatedLinearSensor.h.

Referenced by freeze().

◆ sqrt_R_

Eigen::MatrixXd bfl::LinearModel::sqrt_R_
protectedinherited

Square root matrix of R_.

Definition at line 61 of file LinearModel.h.

Referenced by bfl::LinearModel::getNoiseSample().

◆ T_

double bfl::LinearModel::T_
protectedinherited

The Sampling interval in [time].

Definition at line 56 of file LinearModel.h.


The documentation for this class was generated from the following files: