00001 // -*- C++ -*- 00010 #ifndef HG_CONTROLLER_H 00011 #define HG_CONTROLLER_H 00012 00013 #include <rtm/idl/BasicDataType.hh> 00014 #include <rtm/Manager.h> 00015 #include <rtm/DataFlowComponentBase.h> 00016 #include <rtm/CorbaPort.h> 00017 #include <rtm/DataInPort.h> 00018 #include <rtm/DataOutPort.h> 00019 #include <rtm/idl/BasicDataTypeSkel.h> 00020 00021 // Service implementation headers 00022 // <rtc-template block="service_impl_h"> 00023 00024 // </rtc-template> 00025 00026 // Service Consumer stub headers 00027 // <rtc-template block="consumer_stub_h"> 00028 00029 // </rtc-template> 00030 00031 using namespace RTC; 00032 00036 class HGcontroller 00037 : public RTC::DataFlowComponentBase 00038 { 00039 public: 00044 HGcontroller(RTC::Manager* manager); 00048 virtual ~HGcontroller(); 00049 00050 // The initialize action (on CREATED->ALIVE transition) 00051 // formaer rtc_init_entry() 00052 virtual RTC::ReturnCode_t onInitialize(); 00053 00054 // The finalize action (on ALIVE->END transition) 00055 // formaer rtc_exiting_entry() 00056 // virtual RTC::ReturnCode_t onFinalize(); 00057 00058 // The startup action when ExecutionContext startup 00059 // former rtc_starting_entry() 00060 // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id); 00061 00062 // The shutdown action when ExecutionContext stop 00063 // former rtc_stopping_entry() 00064 // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id); 00065 00066 // The activated action (Active state entry action) 00067 // former rtc_active_entry() 00068 virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id); 00069 00070 // The deactivated action (Active state exit action) 00071 // former rtc_active_exit() 00072 virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id); 00073 00074 // The execution action that is invoked periodically 00075 // former rtc_active_do() 00076 virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id); 00077 00078 // The aborting action when main logic error occurred. 00079 // former rtc_aborting_entry() 00080 // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id); 00081 00082 // The error action in ERROR state 00083 // former rtc_error_do() 00084 // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id); 00085 00086 // The reset action that is invoked resetting 00087 // This is same but different the former rtc_init_entry() 00088 // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id); 00089 00090 // The state update action that is invoked after onExecute() action 00091 // no corresponding operation exists in OpenRTm-aist-0.2.0 00092 // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id); 00093 00094 // The action that is invoked when execution context's rate is changed 00095 // no corresponding operation exists in OpenRTm-aist-0.2.0 00096 // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id); 00097 00098 00099 protected: 00100 // Configuration variable declaration 00101 // <rtc-template block="config_declare"> 00102 00103 // </rtc-template> 00104 00105 TimedDoubleSeq m_q; 00106 00107 // DataInPort declaration 00108 // <rtc-template block="inport_declare"> 00109 InPort<TimedDoubleSeq> m_qIn; 00110 00111 // </rtc-template> 00112 00113 TimedDoubleSeq m_dq, m_ddq; 00114 00115 // DataOutPort declaration 00116 // <rtc-template block="outport_declare"> 00117 OutPort<TimedDoubleSeq> m_qOut; 00118 OutPort<TimedDoubleSeq> m_dqOut; 00119 OutPort<TimedDoubleSeq> m_ddqOut; 00120 00121 // </rtc-template> 00122 00123 // CORBA Port declaration 00124 // <rtc-template block="corbaport_declare"> 00125 00126 // </rtc-template> 00127 00128 // Service declaration 00129 // <rtc-template block="service_declare"> 00130 00131 // </rtc-template> 00132 00133 // Consumer declaration 00134 // <rtc-template block="consumer_declare"> 00135 00136 // </rtc-template> 00137 00138 private: 00139 double m_dt; 00140 TimedDoubleSeq m_qOld, m_dqOld; 00141 int dummy; 00142 }; 00143 00144 00145 extern "C" 00146 { 00147 void HGcontrollerInit(RTC::Manager* manager); 00148 }; 00149 00150 #endif // HG_CONTROLLER_H