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;
73  void addToGUI(const mc_control::MCController &,
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
mc_rtc::Configuration
Simplify access to values hold within a JSON file.
Definition: Configuration.h:165
mc_rbdyn::Sensor
Device Sensor
Definition: Device.h:21
MC_OBSERVER_DLLAPI
#define MC_OBSERVER_DLLAPI
Definition: api.h:92
Observer.h
mc_observers::BodySensorObserver::guiAccConfig_
mc_rtc::gui::ArrowConfig guiAccConfig_
Definition: BodySensorObserver.h:100
mc_observers::BodySensorObserver::posW
const sva::PTransformd & posW() const
Get floating-base pose in the world frame.
Definition: BodySensorObserver.h:66
mc_rtc::gui::ArrowConfig
Definition: types.h:205
mc_observers::BodySensorObserver::updateRobot_
std::string updateRobot_
Definition: BodySensorObserver.h:89
mc_observers::BodySensorObserver::fbSensorName_
std::string fbSensorName_
Definition: BodySensorObserver.h:84
mc_rtc::Logger
Logs controller data to disk.
Definition: Logger.h:29
mc_observers::BodySensorObserver::velW
const sva::MotionVecd & velW() const
Get floating-base velocity in the world frame.
Definition: BodySensorObserver.h:69
mc_observers::Observer
State observation API.
Definition: Observer.h:50
mc_rtc::gui::StateBuilder
Definition: StateBuilder.h:27
Robot.h
mc_observers
Definition: BodySensorObserver.h:13
mc_observers::BodySensorObserver::robot_
std::string robot_
Definition: BodySensorObserver.h:88
mc_observers::BodySensorObserver::BodySensorObserver
BodySensorObserver(const std::string &type, double dt)
Definition: BodySensorObserver.h:26
mc_observers::BodySensorObserver
Definition: BodySensorObserver.h:24
mc_observers::BodySensorObserver::guiVelConfig_
mc_rtc::gui::ArrowConfig guiVelConfig_
Definition: BodySensorObserver.h:98
mc_control::MCController
MCController is the base class to implement all controllers. It assumes that at least two robots are ...
Definition: MCController.h:98
mc_observers::BodySensorObserver::Update
Update
Definition: BodySensorObserver.h:78
api.h