mc_rtc  2.12.0
BodySensorObserver.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
8 #include <mc_observers/api.h>
9 #include <mc_rbdyn/Robot.h>
10 
11 #include <SpaceVecAlg/SpaceVecAlg>
12 
13 namespace mc_observers
14 {
25 {
26  BodySensorObserver(const std::string & type, double dt) : Observer(type, dt) {}
27 
29  void configure(const mc_control::MCController & ctl, const mc_rtc::Configuration & /*config*/) override;
30 
38  void reset(const mc_control::MCController & ctl) override;
39 
55  bool run(const mc_control::MCController & ctl) override;
56 
63  void update(mc_control::MCController & ctl) override;
64 
66  const sva::PTransformd & posW() const { return posW_; }
67 
69  const sva::MotionVecd & velW() const { return velW_; }
70 
71 protected:
72  void addToLogger(const mc_control::MCController &, mc_rtc::Logger &, const std::string & category) override;
75  const std::vector<std::string> & category) override;
76 
77 protected:
78  enum class Update
79  {
80  Control,
81  Sensor
82  };
83  Update updateFrom_ = Update::Sensor;
84  std::string fbSensorName_;
85  sva::PTransformd posW_ = sva::PTransformd::Identity();
86  sva::MotionVecd velW_ = sva::MotionVecd::Zero();
87  sva::MotionVecd accW_ = sva::MotionVecd::Zero();
88  std::string robot_;
89  std::string updateRobot_;
90  bool updatePose_ = true;
91  bool updateVel_ = true;
92 
93  bool logPos_ = true;
94  bool logVel_ = true;
95  bool logAcc_ = true;
96  bool guiPos_ = false;
97  bool guiVel_ = true;
99  bool guiAcc_ = false;
101  bool advancedGUI_ = false;
102 };
103 
104 } // namespace mc_observers
#define MC_OBSERVER_DLLAPI
Definition: api.h:92
Definition: BodySensorObserver.h:14
Device Sensor
Definition: Device.h:21
MCController is the base class to implement all controllers. It assumes that at least two robots are ...
Definition: MCController.h:99
Definition: BodySensorObserver.h:25
void reset(const mc_control::MCController &ctl) override
Resets the observer.
bool run(const mc_control::MCController &ctl) override
Determines the pose of the floating base.
const sva::PTransformd & posW() const
Get floating-base pose in the world frame.
Definition: BodySensorObserver.h:66
void addToLogger(const mc_control::MCController &, mc_rtc::Logger &, const std::string &category) override
Add observer from logger.
BodySensorObserver(const std::string &type, double dt)
Definition: BodySensorObserver.h:26
std::string fbSensorName_
Definition: BodySensorObserver.h:84
std::string robot_
Definition: BodySensorObserver.h:88
void configure(const mc_control::MCController &ctl, const mc_rtc::Configuration &) override
void addToGUI(const mc_control::MCController &, mc_rtc::gui::StateBuilder &, const std::vector< std::string > &category) override
Add observer information the GUI.
mc_rtc::gui::ArrowConfig guiAccConfig_
Definition: BodySensorObserver.h:100
const sva::MotionVecd & velW() const
Get floating-base velocity in the world frame.
Definition: BodySensorObserver.h:69
std::string updateRobot_
Definition: BodySensorObserver.h:89
void update(mc_control::MCController &ctl) override
Update the robot's floating base from its estimated pose.
mc_rtc::gui::ArrowConfig guiVelConfig_
Definition: BodySensorObserver.h:98
Update
Definition: BodySensorObserver.h:79
State observation API.
Definition: Observer.h:51
Simplify access to values hold within a JSON file.
Definition: Configuration.h:166
Logs controller data to disk.
Definition: Logger.h:30
Definition: types.h:206
Definition: StateBuilder.h:28