Go to the documentation of this file.
18 #ifndef STATE_ESTIMATION__MEASUREMENT__LINEAR_MEASUREMENT_HPP_
19 #define STATE_ESTIMATION__MEASUREMENT__LINEAR_MEASUREMENT_HPP_
33 namespace state_estimation
45 template<
typename StateT>
49 template<
typename OtherStateT>
50 using MappingMatrixFrom =
51 Eigen::Matrix<
typename StateT::Scalar, StateT::size(), OtherStateT::size()>;
54 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
65 const typename StateT::Vector & measurement,
66 const typename StateT::Matrix & covariance)
67 : m_measurement{measurement},
68 m_covariance{covariance} {}
81 const typename StateT::Vector & measurement,
82 const typename StateT::Vector & standard_deviation)
85 standard_deviation.array().square().matrix().asDiagonal()};
93 template<
typename NewScalarT>
96 using NewState = decltype(m_measurement.template cast<NewScalarT>());
98 m_measurement.vector().template cast<NewScalarT>(),
99 m_covariance.template cast<NewScalarT>()
108 inline StateT &
crtp_state() noexcept {
return m_measurement;}
110 inline const StateT &
crtp_state() const noexcept {
return m_measurement;}
114 inline const typename StateT::Matrix &
crtp_covariance() const noexcept {
return m_covariance;}
131 template<
typename OtherStateT>
134 return other_state.template copy_into<StateT>();
147 template<
typename OtherStateT>
150 return m_measurement.copy_into(other_state);
166 template<
typename OtherStateT>
169 MappingMatrixFrom<OtherStateT>
m{MappingMatrixFrom<OtherStateT>::Zero()};
170 auto fill_mapping_matrix = [&
m,
this](
auto variable) {
172 using VariableT = std::decay_t<decltype(variable)>;
173 constexpr
auto index_in_this_state = StateT::template index_of<VariableT>();
174 constexpr
auto index_in_other_state = OtherStateT::template index_of<VariableT>();
175 m(index_in_this_state, index_in_other_state) = 1;
178 typename StateT::Variables,
typename OtherStateT::Variables>::type;
192 StateT m_measurement{};
194 typename StateT::Matrix m_covariance{StateT::Matrix::Zero()};
201 #endif // STATE_ESTIMATION__MEASUREMENT__LINEAR_MEASUREMENT_HPP_
OtherStateT crtp_map_into(const OtherStateT &other_state) const noexcept
Copy this measurement into another state space.
Definition: linear_measurement.hpp:148
auto & state()
Get measurement as a state vector.
Definition: measurement_interface.hpp:42
StateT & crtp_state() noexcept
Get state vector function that is to be called by the CRTP interface.
Definition: linear_measurement.hpp:108
MappingMatrixFrom< OtherStateT > crtp_mapping_matrix_from(const OtherStateT &) const
Get the mapping matrix between the two states called by the CRTP interface.
Definition: linear_measurement.hpp:167
const StateT::Matrix & crtp_covariance() const noexcept
Get covariance function that is to be called by the CRTP interface.
Definition: linear_measurement.hpp:114
StateT crtp_create_new_instance_from(const OtherStateT &other_state) const
Create a new instance of the measurement from another state.
Definition: linear_measurement.hpp:132
StateT State
Definition: linear_measurement.hpp:55
friend bool operator==(const LinearMeasurement &lhs, const LinearMeasurement &rhs)
An equality operator.
Definition: linear_measurement.hpp:184
A CRTP interface to any measurement.
Definition: measurement_interface.hpp:39
auto & covariance()
Get covariance of the measurement as a matrix.
Definition: measurement_interface.hpp:61
A class that represents a linear measurement.
Definition: linear_measurement.hpp:46
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
OnlineData m
Definition: linear_tire.snippet.hpp:36
StateT::Matrix & crtp_covariance() noexcept
Get covariance function that is to be called by the CRTP interface.
Definition: linear_measurement.hpp:112
const StateT & crtp_state() const noexcept
Get state vector function that is to be called by the CRTP interface.
Definition: linear_measurement.hpp:110
auto cast() const noexcept
Cast to another scalar type.
Definition: linear_measurement.hpp:94
LinearMeasurement(const typename StateT::Vector &measurement, const typename StateT::Matrix &covariance)
Construct a new instance of the measurement from a state vector.
Definition: linear_measurement.hpp:64
static LinearMeasurement create_with_stddev(const typename StateT::Vector &measurement, const typename StateT::Vector &standard_deviation)
Convenience factory function to construct a measurement from a vector of standard deviations.
Definition: linear_measurement.hpp:80
A trait used to intersect types stored in tuples at compile time. The resulting typedef type will hol...
Definition: type_traits.hpp:180
constexpr COMMON_PUBLIC std::enable_if_t< I==sizeof...(TypesT)> visit(std::tuple< TypesT... > &, Callable) noexcept
Visit every element in a tuple.
Definition: type_traits.hpp:80