RemoveForceSensorLinkOffset.h
Go to the documentation of this file.
1 // -*- C++ -*-
10 #ifndef REMOVEFORCESENSORLINKOFFSET_H
11 #define REMOVEFORCESENSORLINKOFFSET_H
12 
13 #include <rtm/idl/BasicDataType.hh>
14 #include <rtm/idl/ExtendedDataTypes.hh>
15 #include <rtm/Manager.h>
16 #include <rtm/DataFlowComponentBase.h>
17 #include <rtm/CorbaPort.h>
18 #include <rtm/DataInPort.h>
19 #include <rtm/DataOutPort.h>
20 #include <rtm/idl/BasicDataTypeSkel.h>
21 #include <rtm/idl/ExtendedDataTypesSkel.h>
22 #include <hrpModel/Body.h>
23 #include <hrpModel/Link.h>
24 #include <hrpModel/JointPath.h>
25 #include <hrpUtil/EigenTypes.h>
26 
28 #include "../ImpedanceController/RatsMatrix.h"
29 #include <semaphore.h>
30 
31 // Service implementation headers
32 // <rtc-template block="service_impl_h">
33 
34 // </rtc-template>
35 
36 // Service Consumer stub headers
37 // <rtc-template block="consumer_stub_h">
38 
39 // </rtc-template>
40 
41 using namespace RTC;
42 
48 {
49  public:
58  virtual ~RemoveForceSensorLinkOffset();
59 
60  // The initialize action (on CREATED->ALIVE transition)
61  // formaer rtc_init_entry()
62  virtual RTC::ReturnCode_t onInitialize();
63 
64  // The finalize action (on ALIVE->END transition)
65  // formaer rtc_exiting_entry()
66  // virtual RTC::ReturnCode_t onFinalize();
67 
68  // The startup action when ExecutionContext startup
69  // former rtc_starting_entry()
70  // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
71 
72  // The shutdown action when ExecutionContext stop
73  // former rtc_stopping_entry()
74  // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
75 
76  // The activated action (Active state entry action)
77  // former rtc_active_entry()
78  virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
79 
80  // The deactivated action (Active state exit action)
81  // former rtc_active_exit()
82  virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
83 
84  // The execution action that is invoked periodically
85  // former rtc_active_do()
86  virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
87 
88  // The aborting action when main logic error occurred.
89  // former rtc_aborting_entry()
90  // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
91 
92  // The error action in ERROR state
93  // former rtc_error_do()
94  // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
95 
96  // The reset action that is invoked resetting
97  // This is same but different the former rtc_init_entry()
98  // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
99 
100  // The state update action that is invoked after onExecute() action
101  // no corresponding operation exists in OpenRTm-aist-0.2.0
102  // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
103 
104  // The action that is invoked when execution context's rate is changed
105  // no corresponding operation exists in OpenRTm-aist-0.2.0
106  // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
107  bool setForceMomentOffsetParam(const std::string& i_name_, const OpenHRP::RemoveForceSensorLinkOffsetService::forcemomentOffsetParam &i_param_);
108  bool getForceMomentOffsetParam(const std::string& i_name_, OpenHRP::RemoveForceSensorLinkOffsetService::forcemomentOffsetParam& i_param_);
109  bool loadForceMomentOffsetParams(const std::string& filename);
110  bool dumpForceMomentOffsetParams(const std::string& filename);
111  bool removeForceSensorOffset (const ::OpenHRP::RemoveForceSensorLinkOffsetService::StrSequence& names, const double tm);
112 
113  protected:
114  // Configuration variable declaration
115  // <rtc-template block="config_declare">
116 
117  // </rtc-template>
118  // TimedDoubleSeq m_qRef;
119  TimedDoubleSeq m_qCurrent;
120  TimedOrientation3D m_rpy;
121 
122  // DataInPort declaration
123  // <rtc-template block="inport_declare">
126 
127 
128  // </rtc-template>
129 
130  // DataOutPort declaration
131  // <rtc-template block="outport_declare">
132  std::vector<TimedDoubleSeq> m_force;
133  std::vector<InPort<TimedDoubleSeq> *> m_forceIn;
134  std::vector<OutPort<TimedDoubleSeq> *> m_forceOut;
135 
136  // </rtc-template>
137 
138  // DataOutPort declaration
139  // <rtc-template block="outport_declare">
140 
141  // </rtc-template>
142 
143  // CORBA Port declaration
144  // <rtc-template block="corbaport_declare">
145 
146  // </rtc-template>
147 
148  // Service declaration
149  // <rtc-template block="service_declare">
151 
152  // </rtc-template>
153 
154  // Consumer declaration
155  // <rtc-template block="consumer_declare">
157 
158  // </rtc-template>
159 
160  private:
162  hrp::Vector3 force_offset, moment_offset, link_offset_centroid;
165  // Members for sensor offset calib
166  hrp::Vector3 force_offset_sum, moment_offset_sum;
168  sem_t wait_sem;
169 
171  : force_offset(hrp::Vector3::Zero()), moment_offset(hrp::Vector3::Zero()),
172  off_force(hrp::Vector3::Zero()), off_moment(hrp::Vector3::Zero()),
173  link_offset_centroid(hrp::Vector3::Zero()), link_offset_mass(0),
174  force_offset_sum(hrp::Vector3::Zero()), moment_offset_sum(hrp::Vector3::Zero()),
175  sensor_offset_calib_counter(0), wait_sem()
176  {
177  sem_init(&wait_sem, 0, 0);
178  };
179  };
180  void updateRootLinkPosRot (const hrp::Vector3& rpy);
181  void printForceMomentOffsetParam(const std::string& i_name_);
182 
183  std::map<std::string, ForceMomentOffsetParam> m_forcemoment_offset_param;
184 #if __cplusplus >= 201103L
185  constexpr
186 #endif
187  static const double grav = 9.80665; /* [m/s^2] */
188  double m_dt;
190  unsigned int m_debugLevel;
193 };
194 
195 
196 extern "C"
197 {
199 };
200 
201 #endif // REMOVEFORCESENSORLINKOFFSET_H
ec_id
char * filename
InPort< TimedOrientation3D > m_rpyIn
static std::vector< std::vector< double > > force_offset
Definition: iob.cpp:13
manager
Eigen::Vector3d Vector3
OpenHRP::vector3 Vector3
ExecutionContextHandle_t UniqueId
std::vector< OutPort< TimedDoubleSeq > * > m_forceOut
std::vector< InPort< TimedDoubleSeq > * > m_forceIn
RemoveForceSensorLinkOffsetService_impl m_service0
std::map< std::string, ForceMomentOffsetParam > m_forcemoment_offset_param
std::vector< TimedDoubleSeq > m_force
void RemoveForceSensorLinkOffsetInit(RTC::Manager *manager)
sample RT component which has one data input port and one data output port


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:51