ThermoLimiter.h
Go to the documentation of this file.
1 // -*- C++ -*-
10 #ifndef THERMO_LIMITER_SERVICE_H
11 #define THERMO_LIMITER_SERVICE_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 "../ThermoEstimator/MotorHeatParam.h"
26 
27 // Service implementation headers
28 // <rtc-template block="service_impl_h">
30 #include "../SoftErrorLimiter/beep.h"
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 ~ThermoLimiter();
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 setParameter(const OpenHRP::ThermoLimiterService::tlParam& i_tlp);
106  bool getParameter(OpenHRP::ThermoLimiterService::tlParam& i_tlp);
107 
108 
109  protected:
110  // Configuration variable declaration
111  // <rtc-template block="config_declare">
112 
113  // </rtc-template>
114  TimedDoubleSeq m_tempIn;
115  TimedDoubleSeq m_tauMaxOut;
116  TimedLongSeq m_beepCommandOut;
117 
118  // DataInPort declaration
119  // <rtc-template block="inport_declare">
121 
122  // </rtc-template>
123 
124  // DataOutPort declaration
125  // <rtc-template block="outport_declare">
128 
129  // </rtc-template>
130 
131  // CORBA Port declaration
132  // <rtc-template block="corbaport_declare">
133 
134  // </rtc-template>
135 
136  // Service declaration
137  // <rtc-template block="service_declare">
139 
140  // </rtc-template>
141 
142  // Consumer declaration
143  // <rtc-template block="consumer_declare">
145 
146  // </rtc-template>
147 
148  private:
149  double m_dt;
150  long long m_loop;
151  unsigned int m_debugLevel, m_debug_print_freq;
152  double m_alarmRatio;
155  std::vector<MotorHeatParam> m_motorHeatParams;
158 
159  void calcMaxTorqueFromTemperature(hrp::dvector &tauMax);
160  double calcEmergencyRatio(RTC::TimedDoubleSeq &current, hrp::dvector &max, double alarmRatio, std::string &prefix);
161  void callBeep(double ratio, double alarmRatio);
162  bool isDebug(int cycle = 200);
163 };
164 
165 
166 extern "C"
167 {
168  void ThermoLimiterInit(RTC::Manager* manager);
169 };
170 
171 #endif // NULL_COMPONENT_H
OutPort< TimedDoubleSeq > m_tauMaxOutOut
ec_id
#define max(a, b)
coil::Mutex m_mutex
TimedDoubleSeq m_tempIn
manager
TimedDoubleSeq m_tauMaxOut
Eigen::VectorXd dvector
unsigned int m_debugLevel
OutPort< TimedLongSeq > m_beepCommandOutOut
hrp::dvector m_motorTemperatureLimit
ExecutionContextHandle_t UniqueId
std::vector< MotorHeatParam > m_motorHeatParams
sample RT component which has one data input port and one data output port
Definition: ThermoLimiter.h:44
TimedLongSeq m_beepCommandOut
long long m_loop
BeepClient bc
InPort< TimedDoubleSeq > m_tempInIn
ThermoLimiterService_impl m_ThermoLimiterService
hrp::BodyPtr m_robot
RTC::CorbaPort m_ThermoLimiterServicePort
double m_alarmRatio
void ThermoLimiterInit(RTC::Manager *manager)


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