KinematicInertialPoseObserver.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
3  *
4  * This file is inspired by Stephane's Caron implementation as part of
5  * lipm_walking_controller <https://github.com/stephane-caron/lipm_walking_controller>
6  */
7 
8 #pragma once
9 
10 #include <mc_observers/Observer.h>
11 #include <mc_observers/api.h>
12 #include <mc_rbdyn/Robot.h>
13 
14 #include <SpaceVecAlg/SpaceVecAlg>
15 
16 namespace mc_observers
17 {
18 
39 {
41  KinematicInertialPoseObserver(const std::string & type, double dt) : Observer(type, dt) {}
42 
44  void configure(const mc_control::MCController & ctl, const mc_rtc::Configuration & config) override;
45 
47  void reset(const mc_control::MCController & ctl) override;
48 
67  bool run(const mc_control::MCController & ctl) override;
68 
70  void update(mc_control::MCController & ctl) override;
71 
73  const sva::PTransformd & posW() const { return pose_; }
74 
75 protected:
76  void addToLogger(const mc_control::MCController & ctl, mc_rtc::Logger &, const std::string & category) override;
79  const std::vector<std::string> & category) override;
80 
91  void estimateOrientation(const mc_rbdyn::Robot & robot, const mc_rbdyn::Robot & realRobot);
92 
103 
104 protected:
105  std::string robot_;
106  std::string realRobot_;
107  std::string imuSensor_;
109  std::string anchorFrameFunction_ = "";
110  sva::PTransformd X_0_anchorFrame_ =
111  sva::PTransformd::Identity();
112  sva::PTransformd X_0_anchorFrameReal_ =
113  sva::PTransformd::Identity();
114 
115  double maxAnchorFrameDiscontinuity_ =
116  0.01;
117  bool anchorFrameJumped_ = false;
118  bool firstIter_ = true;
120 private:
121  sva::PTransformd pose_ = sva::PTransformd::Identity();
122  bool showAnchorFrame_ = false;
123  bool showAnchorFrameReal_ = false;
124  bool showPose_ = false;
125  bool advancedGUI_ = false;
126 
127  bool logPose_ = true;
128  bool logAnchorFrame_ = true;
129 };
130 
131 } // namespace mc_observers
#define MC_OBSERVER_DLLAPI
Definition: api.h:92
Definition: BodySensorObserver.h:14
MCController is the base class to implement all controllers. It assumes that at least two robots are ...
Definition: MCController.h:99
Definition: KinematicInertialPoseObserver.h:39
void update(mc_control::MCController &ctl) override
std::string realRobot_
Definition: KinematicInertialPoseObserver.h:106
void addToLogger(const mc_control::MCController &ctl, mc_rtc::Logger &, const std::string &category) override
Add observer from logger.
std::string imuSensor_
Definition: KinematicInertialPoseObserver.h:107
void reset(const mc_control::MCController &ctl) override
const sva::PTransformd & posW() const
Get floating-base pose in the world frame.
Definition: KinematicInertialPoseObserver.h:73
KinematicInertialPoseObserver(const std::string &type, double dt)
Definition: KinematicInertialPoseObserver.h:41
void estimateOrientation(const mc_rbdyn::Robot &robot, const mc_rbdyn::Robot &realRobot)
std::string robot_
Definition: KinematicInertialPoseObserver.h:105
bool run(const mc_control::MCController &ctl) override
void configure(const mc_control::MCController &ctl, const mc_rtc::Configuration &config) override
void addToGUI(const mc_control::MCController &, mc_rtc::gui::StateBuilder &, const std::vector< std::string > &category) override
Add observer information the GUI.
void estimatePosition(const mc_control::MCController &ctl)
State observation API.
Definition: Observer.h:51
Definition: Robot.h:63
Simplify access to values hold within a JSON file.
Definition: Configuration.h:166
Logs controller data to disk.
Definition: Logger.h:30
Definition: StateBuilder.h:28