00001 /************************************************************************************ 00002 GamePad RT-Component 00003 Copyright (c) 2010, Segway-Japan, Ltd. 00004 All rights reserved. 00005 00006 Contact us if you use this software for sell. 00007 If you use this software not for sell, you can use this software under BSD lisence. 00008 See the files LICENSE.TXT and LICENSE-BSD.TXT for more details. 00009 ************************************************************************************/ 00010 00011 #ifndef GAMEPAD_H 00012 #define GAMEPAD_H 00013 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 00022 //If you use windows, you should add additional include path to srcwin 00023 #include "intellirobotStub.h" 00024 00025 // Service implementation headers 00026 // <rtc-template block="service_impl_h"> 00027 00028 // </rtc-template> 00029 00030 // Service Consumer stub headers 00031 // <rtc-template block="consumer_stub_h"> 00032 00033 // </rtc-template> 00034 00035 using namespace RTC; 00036 00037 00045 class GamePad 00046 : public RTC::DataFlowComponentBase 00047 { 00048 public: 00049 GamePad(RTC::Manager* manager); 00050 ~GamePad(); 00051 00052 // The initialize action (on CREATED->ALIVE transition) 00053 // formaer rtc_init_entry() 00054 virtual RTC::ReturnCode_t onInitialize(); 00055 00056 // The finalize action (on ALIVE->END transition) 00057 // formaer rtc_exiting_entry() 00058 // virtual RTC::ReturnCode_t onFinalize(); 00059 00060 // The startup action when ExecutionContext startup 00061 // former rtc_starting_entry() 00062 // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id); 00063 00064 // The shutdown action when ExecutionContext stop 00065 // former rtc_stopping_entry() 00066 // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id); 00067 00068 // The activated action (Active state entry action) 00069 // former rtc_active_entry() 00070 virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id); 00071 00072 // The deactivated action (Active state exit action) 00073 // former rtc_active_exit() 00074 virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id); 00075 00076 // The execution action that is invoked periodically 00077 // former rtc_active_do() 00078 virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id); 00079 00080 // The aborting action when main logic error occurred. 00081 // former rtc_aborting_entry() 00082 // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id); 00083 00084 // The error action in ERROR state 00085 // former rtc_error_do() 00086 // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id); 00087 00088 // The reset action that is invoked resetting 00089 // This is same but different the former rtc_init_entry() 00090 // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id); 00091 00092 // The state update action that is invoked after onExecute() action 00093 // no corresponding operation exists in OpenRTm-aist-0.2.0 00094 // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id); 00095 00096 // The action that is invoked when execution context's rate is changed 00097 // no corresponding operation exists in OpenRTm-aist-0.2.0 00098 // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id); 00099 00100 00101 protected: 00102 // Configuration variable declaration 00103 // <rtc-template block="config_declare"> 00109 float m_Klx; 00115 float m_Kly; 00121 float m_Krx; 00127 float m_Kry; 00133 std::string m_str_port; 00134 00135 // </rtc-template> 00136 00137 // DataInPort declaration 00138 // <rtc-template block="inport_declare"> 00139 00140 // </rtc-template> 00141 00142 // DataOutPort declaration 00143 // <rtc-template block="outport_declare"> 00144 RTC::TimedULong m_Button; 00147 OutPort<RTC::TimedULong> m_ButtonOut; 00148 RTC::TimedFloat m_StickLX; 00151 OutPort<RTC::TimedFloat> m_StickLXOut; 00152 RTC::TimedFloat m_StickLY; 00155 OutPort<RTC::TimedFloat> m_StickLYOut; 00156 RTC::TimedFloat m_StickRX; 00159 OutPort<RTC::TimedFloat> m_StickRXOut; 00160 RTC::TimedFloat m_StickRY; 00163 OutPort<RTC::TimedFloat> m_StickRYOut; 00164 RTC::TimedDouble m_StickLXd; 00167 OutPort<RTC::TimedDouble> m_StickLXdOut; 00168 RTC::TimedDouble m_StickLYd; 00171 OutPort<RTC::TimedDouble> m_StickLYdOut; 00172 RTC::TimedDouble m_StickRXd; 00175 OutPort<RTC::TimedDouble> m_StickRXdOut; 00176 RTC::TimedDouble m_StickRYd; 00179 OutPort<RTC::TimedDouble> m_StickRYdOut; 00180 RTC::TimedVelocity m_Velocity; 00183 OutPort<RTC::TimedVelocity> m_VelocityOut; 00184 00185 00186 IIS::TimedVelocity m_VelocityIIS; 00189 OutPort<IIS::TimedVelocity> m_VelocityIISOut; 00190 00191 IIS::TimedVelocity2D m_Velocity2DIIS; 00194 OutPort<IIS::TimedVelocity2D> m_Velocity2DIISOut; 00195 00196 // </rtc-template> 00197 00198 // CORBA Port declaration 00199 // <rtc-template block="corbaport_declare"> 00200 00201 // </rtc-template> 00202 00203 // Service declaration 00204 // <rtc-template block="service_declare"> 00205 00206 // </rtc-template> 00207 00208 // Consumer declaration 00209 // <rtc-template block="consumer_declare"> 00210 00211 // </rtc-template> 00212 00213 private: 00214 int dummy; 00215 00216 }; 00217 00218 00219 extern "C" 00220 { 00221 void GamePadInit(RTC::Manager* manager); 00222 }; 00223 00224 #endif // GAMEPAD_H