ModifiedServo.h
Go to the documentation of this file.
1 // -*- C++ -*-
10 #ifndef MODIFIEDSERVO_H
11 #define MODIFIEDSERVO_H
12 
13 #include <rtm/idl/BasicDataTypeSkel.h>
14 #include <rtm/Manager.h>
15 #include <rtm/DataFlowComponentBase.h>
16 #include <rtm/CorbaPort.h>
17 #include <rtm/CorbaNaming.h>
18 #include <rtm/DataInPort.h>
19 #include <rtm/DataOutPort.h>
20 
21 #include <hrpUtil/EigenTypes.h>
22 #include <hrpModel/ModelLoaderUtil.h>
23 #include <hrpModel/Body.h>
24 #include <hrpModel/Link.h>
25 
26 // Service implementation headers
27 // <rtc-template block="service_impl_h">
28 
29 // </rtc-template>
30 
31 // Service Consumer stub headers
32 // <rtc-template block="consumer_stub_h">
33 
34 // </rtc-template>
35 
36 using namespace RTC;
37 
39 {
40  public:
42  ~ModifiedServo();
43 
44  // The initialize action (on CREATED->ALIVE transition)
45  // formaer rtc_init_entry()
46  virtual RTC::ReturnCode_t onInitialize();
47 
48  // The finalize action (on ALIVE->END transition)
49  // formaer rtc_exiting_entry()
50  // virtual RTC::ReturnCode_t onFinalize();
51 
52  // The startup action when ExecutionContext startup
53  // former rtc_starting_entry()
54  // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
55 
56  // The shutdown action when ExecutionContext stop
57  // former rtc_stopping_entry()
58  // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
59 
60  // The activated action (Active state entry action)
61  // former rtc_active_entry()
62  virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
63 
64  // The deactivated action (Active state exit action)
65  // former rtc_active_exit()
66  virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
67 
68  // The execution action that is invoked periodically
69  // former rtc_active_do()
70  virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
71 
72  // The aborting action when main logic error occurred.
73  // former rtc_aborting_entry()
74  // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
75 
76  // The error action in ERROR state
77  // former rtc_error_do()
78  // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
79 
80  // The reset action that is invoked resetting
81  // This is same but different the former rtc_init_entry()
82  // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
83 
84  // The state update action that is invoked after onExecute() action
85  // no corresponding operation exists in OpenRTm-aist-0.2.0
86  // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
87 
88  // The action that is invoked when execution context's rate is changed
89  // no corresponding operation exists in OpenRTm-aist-0.2.0
90  // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
91 
92 
93  protected:
94  // Configuration variable declaration
95  // <rtc-template block="config_declare">
96 
97  // </rtc-template>
98 
99  // DataInPort declaration
100  // <rtc-template block="inport_declare">
101  TimedDoubleSeq m_tauRef;
103  TimedDoubleSeq m_qRef;
105  TimedDoubleSeq m_q;
107  TimedBooleanSeq m_torqueMode;
109 
110  // </rtc-template>
111 
112  // DataOutPort declaration
113  // <rtc-template block="outport_declare">
114  TimedDoubleSeq m_tau;
116 
117  // </rtc-template>
118 
119  // CORBA Port declaration
120  // <rtc-template block="corbaport_declare">
121 
122  // </rtc-template>
123 
124  // Service declaration
125  // <rtc-template block="service_declare">
126 
127  // </rtc-template>
128 
129  // Consumer declaration
130  // <rtc-template block="consumer_declare">
131 
132  // </rtc-template>
133 
134  private:
135 
136  void readGainFile();
137 
139 
140  double dt; // sampling time of the controller
141  double ref_dt; // sampling time of reference angles
142  double step; // current interpolation step
143  double nstep; // number of steps to interpolate references
144 
145  size_t dof;
146 
147  std::string gain_fname;
148  std::ifstream gain;
149 
152 };
153 
154 
155 extern "C"
156 {
158 };
159 
160 #endif // MODIFIEDSERVO_H
161 
ec_id
hrp::dvector qRef_old
hrp::dvector Pgain
hrp::BodyPtr m_robot
manager
InPort< TimedDoubleSeq > m_qRefIn
Eigen::VectorXd dvector
std::ifstream gain
DLL_EXPORT void ModifiedServoInit(RTC::Manager *manager)
ExecutionContextHandle_t UniqueId
std::string gain_fname
TimedDoubleSeq m_tauRef
OutPort< TimedDoubleSeq > m_tauOut
TimedDoubleSeq m_tau
TimedDoubleSeq m_q
TimedBooleanSeq m_torqueMode
TimedDoubleSeq m_qRef
InPort< TimedBooleanSeq > m_torqueModeIn
InPort< TimedDoubleSeq > m_qIn
InPort< TimedDoubleSeq > m_tauRefIn
#define DLL_EXPORT


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