25 #ifndef INCLUDED_StateHistory_h_GUID_07D9DAEE_6733_46AA_772C_43A51B2BAC10 26 #define INCLUDED_StateHistory_h_GUID_07D9DAEE_6733_46AA_772C_43A51B2BAC10 38 #include <type_traits> 42 namespace pose_externalized_rotation {
46 namespace orient_externalized_rotation {
59 template <
typename StateType>
63 kalman::pose_externalized_rotation::State> : std::true_type {};
66 kalman::orient_externalized_rotation::State> : std::true_type {};
78 using StateVectorBackup =
79 std::array<kalman::types::Scalar, StateDim::value>;
80 using StateCovarianceBackup =
82 StateDim::value * StateDim::value>;
87 StateVec::Map(m_stateVector.data()) = state.
stateVector();
91 void restore(
State &state)
const {
93 state.setErrorCovariance(StateMatrix::Map(m_covariance.data()));
98 StateVectorBackup m_stateVector;
99 StateCovarianceBackup m_covariance;
101 struct NoExternalState;
102 struct HasExternalQuaternion;
104 template <
typename State>
107 HasExternalQuaternion, NoExternalState>::type;
114 template <
typename State,
123 template <
typename State>
130 Eigen::Vector4d::Map(m_quatBackup.data()) =
131 state.getQuaternion().
coeffs();
135 m_baseEntry.restore(state);
138 quat.
coeffs() = Eigen::Vector4d::Map(m_quatBackup.data());
143 BaseEntry m_baseEntry;
144 std::array<kalman::types::Scalar, 4> m_quatBackup;
149 #endif // INCLUDED_StateHistory_h_GUID_07D9DAEE_6733_46AA_772C_43A51B2BAC10 typename detail::Dimension_impl< T >::type Dimension
Given a state or measurement, get the dimension as a std::integral_constant.
Definition: FlexibleKalmanBase.h:87
const Coefficients & coeffs() const
Definition: Quaternion.h:93
void setQuaternion(Eigen::Quaterniond const &quaternion)
Intended for startup use.
Definition: PoseState.h:189
void restore(State &state) const
Definition: StateHistory.h:134
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
StateHistoryEntryBase(State const &state)
Constructor - saves the state vector and error covariance.
Definition: StateHistory.h:86
Does the specified state type also have an "external" quaternion we should save and restore...
Definition: StateHistory.h:60
Definition: newuoa.h:1888
StateHistoryEntry(State const &state)
Definition: StateHistory.h:128
StateVector const & stateVector() const
xhat
Definition: PoseState.h:177
State history entry template - default implementation is for those that don't have added extras...
Definition: StateHistory.h:116
Base state history entry - handles standard states with everything in the state vector and error cova...
Definition: StateHistory.h:70
Header providing a C++ wrapper around TimeValueC.h.
StateSquareMatrix const & errorCovariance() const
P.
Definition: PoseState.h:183
Definition: Quaternion.h:47
Definition: PoseState.h:164
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
void setStateVector(StateVector const &state)
set xhat
Definition: PoseState.h:175
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48
typename std::conditional< detail::StateHasExternalQuaternion< State >::value, HasExternalQuaternion, NoExternalState >::type StateHistoryEntryTagSelector
Select the tag for tag dispatching.
Definition: StateHistory.h:107