TorqueController.h
Go to the documentation of this file.
1 // -*- C++ -*-
10 #ifndef TORQUE_CONTROLLER_H
11 #define TPRQUE_CONTROLLER_H
12 
13 #include <rtm/idl/BasicDataType.hh>
14 #include <rtm/Manager.h>
15 #include <rtm/DataFlowComponentBase.h>
16 #include <rtm/CorbaPort.h>
17 #include <rtm/DataInPort.h>
18 #include <rtm/DataOutPort.h>
19 #include <rtm/idl/BasicDataTypeSkel.h>
20 
21 #include <hrpModel/Body.h>
22 #include <hrpModel/Link.h>
23 #include <hrpModel/JointPath.h>
24 
25 #include "MotorTorqueController.h"
26 
27 // Service implementation headers
28 // <rtc-template block="service_impl_h">
29 
31 
32 // </rtc-template>
33 
34 // Service Consumer stub headers
35 // <rtc-template block="consumer_stub_h">
36 
37 // </rtc-template>
38 
39 using namespace RTC;
40 
46 {
47 public:
56  virtual ~TorqueController();
57 
58 // The initialize action (on CREATED->ALIVE transition)
59 // formaer rtc_init_entry()
60  virtual RTC::ReturnCode_t onInitialize();
61 
62 // The finalize action (on ALIVE->END transition)
63 // formaer rtc_exiting_entry()
64 // virtual RTC::ReturnCode_t onFinalize();
65 
66 // The startup action when ExecutionContext startup
67 // former rtc_starting_entry()
68 // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
69 
70 // The shutdown action when ExecutionContext stop
71 // former rtc_stopping_entry()
72 // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
73 
74 // The activated action (Active state entry action)
75 // former rtc_active_entry()
76  virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
77 
78 // The deactivated action (Active state exit action)
79 // former rtc_active_exit()
80  virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
81 
82 // The execution action that is invoked periodically
83 // former rtc_active_do()
84  virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
85 
86 // The aborting action when main logic error occurred.
87 // former rtc_aborting_entry()
88 // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
89 
90 // The error action in ERROR state
91 // former rtc_error_do()
92 // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
93 
94 // The reset action that is invoked resetting
95 // This is same but different the former rtc_init_entry()
96 // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
97 
98 // The state update action that is invoked after onExecute() action
99 // no corresponding operation exists in OpenRTm-aist-0.2.0
100 // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
101 
102 // The action that is invoked when execution context's rate is changed
103 // no corresponding operation exists in OpenRTm-aist-0.2.0
104 // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
105  bool enableTorqueController(std::string jname);
106  bool enableMultipleTorqueControllers(const OpenHRP::TorqueControllerService::StrSequence& jnames);
107  bool disableTorqueController(std::string jname);
108  bool disableMultipleTorqueControllers(const OpenHRP::TorqueControllerService::StrSequence& jnames);
109  bool startTorqueControl(std::string jname);
110  bool startMultipleTorqueControls(const OpenHRP::TorqueControllerService::StrSequence& jnames);
111  bool stopTorqueControl(std::string jname);
112  bool stopMultipleTorqueControls(const OpenHRP::TorqueControllerService::StrSequence& jnames);
113  bool setReferenceTorque(std::string jname, double tauRef);
114  bool setMultipleReferenceTorques(const OpenHRP::TorqueControllerService::StrSequence& jnames, const OpenHRP::TorqueControllerService::dSequence& tauRefs);
115  bool setTorqueControllerParam(const std::string jname, const OpenHRP::TorqueControllerService::torqueControllerParam& i_param);
116  bool getTorqueControllerParam(const std::string jname, OpenHRP::TorqueControllerService::torqueControllerParam& i_param);
117 
118 protected:
119 // Configuration variable declaration
120 // <rtc-template block="config_declare">
121 
122 // </rtc-template>
123  TimedDoubleSeq m_tauCurrentIn;
124  TimedDoubleSeq m_tauMaxIn;
125  TimedDoubleSeq m_qCurrentIn;
126  TimedDoubleSeq m_qRefIn;
127 
128  TimedDoubleSeq m_qRefOut;
129 
130 // DataInPort declaration
131 // <rtc-template block="inport_declare">
136 
137 // </rtc-template>
138 
139 // DataOutPort declaration
140 // <rtc-template block="outport_declare">
142 
143 // </rtc-template>
144 
145 // CORBA Port declaration
146 // <rtc-template block="corbaport_declare">
147 
148 // </rtc-template>
149 
150 // Service declaration
151 // <rtc-template block="service_declare">
153 
154 // </rtc-template>
155 
156 // Consumer declaration
157 // <rtc-template block="consumer_declare">
159 
160 // </rtc-template>
161 
162 private:
163  double m_dt;
164  unsigned int m_debugLevel;
165  long long m_loop;
167  std::vector<MotorTorqueController> m_motorTorqueControllers;
169  void executeTorqueControl(hrp::dvector &dq);
170  void updateParam(double &val, double &val_new);
171  bool isDebug(int cycle = 20);
172 };
173 
174 
175 extern "C"
176 {
177  void TorqueControllerInit(RTC::Manager* manager);
178 };
179 
180 #endif // NULL_COMPONENT_H
ec_id
InPort< TimedDoubleSeq > m_tauCurrentInIn
TimedDoubleSeq m_tauCurrentIn
InPort< TimedDoubleSeq > m_tauMaxInIn
InPort< TimedDoubleSeq > m_qCurrentInIn
void TorqueControllerInit(RTC::Manager *manager)
manager
InPort< TimedDoubleSeq > m_qRefInIn
Eigen::VectorXd dvector
std::vector< MotorTorqueController > m_motorTorqueControllers
unsigned int m_debugLevel
OutPort< TimedDoubleSeq > m_qRefOutOut
ExecutionContextHandle_t UniqueId
RTC::CorbaPort m_TorqueControllerServicePort
sample RT component which has one data input port and one data output port
torque controller for single motor
TimedDoubleSeq m_qRefOut
TimedDoubleSeq m_qRefIn
TorqueControllerService_impl m_service0
TimedDoubleSeq m_qCurrentIn
TimedDoubleSeq m_tauMaxIn
hrp::BodyPtr m_robot


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Sat Dec 17 2022 03:52:21