00001 // -*- C++ -*- 00002 /* 00003 * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc. 00004 * All rights reserved. This program is made available under the terms of the 00005 * Eclipse Public License v1.0 which accompanies this distribution, and is 00006 * available at http://www.eclipse.org/legal/epl-v10.html 00007 * Contributors: 00008 * National Institute of Advanced Industrial Science and Technology (AIST) 00009 * General Robotix Inc. 00010 */ 00019 #ifndef JOYSTICKCONTROLLER_H 00020 #define JOYSTICKCONTROLLER_H 00021 00022 #include <rtm/idl/BasicDataType.hh> 00023 #include <rtm/Manager.h> 00024 #include <rtm/DataFlowComponentBase.h> 00025 #include <rtm/CorbaPort.h> 00026 #include <rtm/DataInPort.h> 00027 #include <rtm/DataOutPort.h> 00028 #include <rtm/idl/BasicDataTypeSkel.h> 00029 00030 // Service implementation headers 00031 // <rtc-template block="service_impl_h"> 00032 00033 // </rtc-template> 00034 00035 // Service Consumer stub headers 00036 // <rtc-template block="consumer_stub_h"> 00037 00038 // </rtc-template> 00039 00040 using namespace RTC; 00041 00042 class JoystickController 00043 : public RTC::DataFlowComponentBase 00044 { 00045 public: 00046 JoystickController(RTC::Manager* manager); 00047 ~JoystickController(); 00048 00049 // <rtc-template block="public_attribute"> 00050 00051 // </rtc-template> 00052 00053 // <rtc-template block="public_operation"> 00054 00055 // </rtc-template> 00056 00057 // The initialize action (on CREATED->ALIVE transition) 00058 // formaer rtc_init_entry() 00059 virtual RTC::ReturnCode_t onInitialize(); 00060 00061 // The finalize action (on ALIVE->END transition) 00062 // formaer rtc_exiting_entry() 00063 // virtual RTC::ReturnCode_t onFinalize(); 00064 00065 // The startup action when ExecutionContext startup 00066 // former rtc_starting_entry() 00067 // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id); 00068 00069 // The shutdown action when ExecutionContext stop 00070 // former rtc_stopping_entry() 00071 // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id); 00072 00073 // The activated action (Active state entry action) 00074 // former rtc_active_entry() 00075 // virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id); 00076 00077 // The deactivated action (Active state exit action) 00078 // former rtc_active_exit() 00079 // virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id); 00080 00081 // The execution action that is invoked periodically 00082 // former rtc_active_do() 00083 virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id); 00084 00085 // The aborting action when main logic error occurred. 00086 // former rtc_aborting_entry() 00087 // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id); 00088 00089 // The error action in ERROR state 00090 // former rtc_error_do() 00091 // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id); 00092 00093 // The reset action that is invoked resetting 00094 // This is same but different the former rtc_init_entry() 00095 // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id); 00096 00097 // The state update action that is invoked after onExecute() action 00098 // no corresponding operation exists in OpenRTm-aist-0.2.0 00099 // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id); 00100 00101 // The action that is invoked when execution context's rate is changed 00102 // no corresponding operation exists in OpenRTm-aist-0.2.0 00103 // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id); 00104 00105 00106 protected: 00107 // <rtc-template block="protected_attribute"> 00108 00109 // </rtc-template> 00110 00111 // <rtc-template block="protected_operation"> 00112 00113 // </rtc-template> 00114 00115 // DataInPort declaration 00116 // <rtc-template block="inport_declare"> 00117 TimedDoubleSeq m_angle; 00118 InPort<TimedDoubleSeq> m_angleIn; 00119 TimedDoubleSeq m_velocity; 00120 InPort<TimedDoubleSeq> m_velocityIn; 00121 TimedFloatSeq m_command; 00122 InPort<TimedFloatSeq> m_commandIn; 00123 00124 // </rtc-template> 00125 00126 00127 // DataOutPort declaration 00128 // <rtc-template block="outport_declare"> 00129 TimedDoubleSeq m_torque; 00130 OutPort<TimedDoubleSeq> m_torqueOut; 00131 00132 // </rtc-template> 00133 00134 // CORBA Port declaration 00135 // <rtc-template block="corbaport_declare"> 00136 00137 // </rtc-template> 00138 00139 // Service declaration 00140 // <rtc-template block="service_declare"> 00141 00142 // </rtc-template> 00143 00144 // Consumer declaration 00145 // <rtc-template block="consumer_declare"> 00146 00147 // </rtc-template> 00148 00149 private: 00150 int dummy; 00151 // <rtc-template block="private_attribute"> 00152 00153 // </rtc-template> 00154 00155 // <rtc-template block="private_operation"> 00156 00157 // </rtc-template> 00158 00159 }; 00160 00161 00162 extern "C" 00163 { 00164 DLL_EXPORT void JoystickControllerInit(RTC::Manager* manager); 00165 }; 00166 00167 #endif // JOYSTICKCONTROLLER_H