Bayes Filters Library
LTIMeasurementModel.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 <Eigen/Dense>
11 
12 using namespace bfl;
13 using namespace Eigen;
14 
15 
16 LTIMeasurementModel::LTIMeasurementModel(const Ref<const MatrixXd>& measurement_matrix, const Ref<const MatrixXd>& noise_covariance_matrix)
17 {
18  if ((measurement_matrix.rows() == 0) || (measurement_matrix.cols() == 0))
19  throw std::runtime_error("ERROR::LTIMEASUREMENTMODEL::CTOR\nERROR:\n\tMeasurement matrix dimensions cannot be 0.");
20  else if ((noise_covariance_matrix.rows() == 0) || (noise_covariance_matrix.cols() == 0))
21  throw std::runtime_error("ERROR::LTIMEASUREMENTMODEL::CTOR\nERROR:\n\tNoise covariance matrix dimensions cannot be 0.");
22  else if (noise_covariance_matrix.rows() != noise_covariance_matrix.cols())
23  throw std::runtime_error("ERROR::LTIMEASUREMENTMODEL::CTOR\nERROR:\n\tNoise covariance matrix must be a square matrix.");
24  else if (measurement_matrix.rows() != noise_covariance_matrix.rows())
25  throw std::runtime_error("ERROR::LTIMEASUREMENTMODEL::CTOR\nERROR:\n\tNumber of rows of the measurement matrix must be the same as the size of the noise covariance matrix.");
26 
27  H_ = measurement_matrix;
28  R_ = noise_covariance_matrix;
29 }
30 
31 
32 std::pair<bool, Eigen::MatrixXd> LTIMeasurementModel::getNoiseCovarianceMatrix() const
33 {
34  return std::make_pair(true, R_);
35 }
36 
37 
39 {
40  return H_;
41 }
bfl
Port of boost::any for C++11 compilers.
Definition: AdditiveMeasurementModel.h:13
bfl::LTIMeasurementModel::getNoiseCovarianceMatrix
std::pair< bool, Eigen::MatrixXd > getNoiseCovarianceMatrix() const override
Definition: LTIMeasurementModel.cpp:32
bfl::LTIMeasurementModel::getMeasurementMatrix
Eigen::MatrixXd getMeasurementMatrix() const override
Definition: LTIMeasurementModel.cpp:38
LTIMeasurementModel.h
bfl::LTIMeasurementModel::LTIMeasurementModel
LTIMeasurementModel(const Eigen::Ref< const Eigen::MatrixXd > &measurement_matrix, const Eigen::Ref< const Eigen::MatrixXd > &noise_covariance_matrix)
Definition: LTIMeasurementModel.cpp:16