10 #ifndef PROJECT_STATEESTIMATOR_H 11 #define PROJECT_STATEESTIMATOR_H 17 #include "state_estimator_lcmt.hpp" 24 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
37 void setLcm(state_estimator_lcmt& lcm_data) {
38 for(
int i = 0; i < 3; i++) {
39 lcm_data.p[i] = position[i];
40 lcm_data.vWorld[i] = vWorld[i];
41 lcm_data.vBody[i] = vBody[i];
42 lcm_data.rpy[i] = rpy[i];
43 lcm_data.omegaBody[i] = omegaBody[i];
44 lcm_data.omegaWorld[i] = omegaWorld[i];
47 for(
int i = 0; i < 4; i++) {
48 lcm_data.quat[i] = orientation[i];
75 virtual void run() = 0;
76 virtual void setup() = 0;
91 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
101 _data.cheaterState = cheaterState;
102 _data.vectorNavData = vectorNavData;
103 _data.legControllerData = legControllerData;
104 _data.result = stateEstimate;
106 _data.contactPhase = &_phase;
107 _data.parameters = parameters;
114 for (
auto estimator : _estimators) {
118 visualization->quat = _data.result->orientation.template cast<float>();
119 visualization->p = _data.result->position.template cast<float>();
138 template <
typename EstimatorToAdd>
140 auto* estimator =
new EstimatorToAdd();
141 estimator->setData(_data);
143 _estimators.push_back(estimator);
150 template <
typename EstimatorToRemove>
154 std::remove_if(_estimators.begin(), _estimators.end(),
156 if (dynamic_cast<EstimatorToRemove*>(e)) {
171 for (
auto estimator : _estimators) {
178 for (
auto estimator : _estimators) {
189 #endif // PROJECT_STATEESTIMATOR_H RobotControlParameters * parameters
CheaterState< double > * cheaterState
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Vec4< T > contactEstimate
typename Eigen::Matrix< T, 4, 1 > Quat
~StateEstimatorContainer()
LegControllerData< T > * legControllerData
typename Eigen::Matrix< T, 3, 1 > Vec3
void removeAllEstimators()
std::vector< GenericEstimator< T > * > _estimators
const StateEstimate< T > & getResult()
void setData(StateEstimatorData< T > data)
StateEstimate< T > * result
StateEstimatorData< T > _data
void run(CheetahVisualization *visualization=nullptr)
Common Leg Control Interface and Leg Control Algorithms.
typename Eigen::Matrix< T, 4, 1 > Vec4
void setLcm(state_estimator_lcmt &lcm_data)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW StateEstimatorContainer(CheaterState< double > *cheaterState, VectorNavData *vectorNavData, LegControllerData< T > *legControllerData, StateEstimate< T > *stateEstimate, RobotControlParameters *parameters)
void setContactPhase(Vec4< T > &phase)
VectorNavData * vectorNavData
typename Eigen::Matrix< T, 3, 3 > RotMat
StateEstimatorData< T > _stateEstimatorData