PositionInput.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00007 #include "PositionInput.h"
00008 
00009 // Module specification
00010 // <rtc-template block="module_spec">
00011 static const char* positioninput_spec[] =
00012   {
00013     "implementation_id", "PositionInput",
00014     "type_name",         "PositionInput",
00015     "description",       "compornent",
00016     "version",           "1.0",
00017     "vendor",            "MyName",
00018     "category",          "example",
00019     "activity_type",     "SPORADIC",
00020     "kind",              "DataFlowComponent",
00021     "max_instance",      "10",
00022     "language",          "C++",
00023     "lang_type",         "compile",
00024     // Configuration variables
00025     "conf.default.01_x", "3.4",
00026     "conf.default.02_y", "7.7",
00027     "conf.default.03_th", "-1.57",
00028     ""
00029   };
00030 // </rtc-template>
00031 
00032 PositionInput::PositionInput(RTC::Manager* manager)
00033     // <rtc-template block="initializer">
00034   : RTC::DataFlowComponentBase(manager),
00035     m_positionOut("position", m_position)
00036 
00037     // </rtc-template>
00038 {
00039   // Registration: InPort/OutPort/Service
00040   // <rtc-template block="registration">
00041   // Set InPort buffers
00042 
00043   // Set OutPort buffer
00044   registerOutPort("position", m_positionOut);
00045 
00046   // Set service provider to Ports
00047 
00048   // Set service consumers to Ports
00049 
00050   // Set CORBA Service Ports
00051 
00052   // </rtc-template>
00053 
00054 }
00055 
00056 PositionInput::~PositionInput()
00057 {
00058 }
00059 
00060 
00061 RTC::ReturnCode_t PositionInput::onInitialize()
00062 {
00063   // <rtc-template block="bind_config">
00064   // Bind variables and configuration variable
00065   bindParameter("01_x", m_01_x, "3.4");
00066   bindParameter("02_y", m_02_y, "7.7");
00067   bindParameter("03_th", m_03_th, "-1.57");
00068   // </rtc-template>
00069   return RTC::RTC_OK;
00070 }
00071 
00072 
00073 /*
00074 RTC::ReturnCode_t PositionInput::onFinalize()
00075 {
00076   return RTC::RTC_OK;
00077 }
00078 */
00079 /*
00080 RTC::ReturnCode_t PositionInput::onStartup(RTC::UniqueId ec_id)
00081 {
00082   return RTC::RTC_OK;
00083 }
00084 */
00085 /*
00086 RTC::ReturnCode_t PositionInput::onShutdown(RTC::UniqueId ec_id)
00087 {
00088   return RTC::RTC_OK;
00089 }
00090 */
00091 
00092 RTC::ReturnCode_t PositionInput::onActivated(RTC::UniqueId ec_id)
00093 {
00094   m_position.data.position.x = m_01_x;
00095   m_position.data.position.y = m_02_y;
00096   m_position.data.heading    = m_03_th;
00097   RTC_INFO(("input goal position"))
00098   RTC_INFO(("%lf %lf %lf",m_position.data.position.x, m_position.data.position.y, m_position.data.heading))
00099   m_positionOut.write();
00100   return RTC::RTC_OK;
00101 }
00102 
00103 /*
00104 RTC::ReturnCode_t PositionInput::onDeactivated(RTC::UniqueId ec_id)
00105 {
00106   return RTC::RTC_OK;
00107 }
00108 */
00109 
00110 RTC::ReturnCode_t PositionInput::onExecute(RTC::UniqueId ec_id)
00111 {
00112   //printf("input position(x y theta)>");
00113   //scanf("%lf %lf %lf",&m_position.data.position.x,&m_position.data.position.y,&m_position.data.heading);
00114   //m_positionOut.write();
00115 
00116   return RTC::RTC_OK;
00117 }
00118 
00119 /*
00120 RTC::ReturnCode_t PositionInput::onAborting(RTC::UniqueId ec_id)
00121 {
00122   return RTC::RTC_OK;
00123 }
00124 */
00125 /*
00126 RTC::ReturnCode_t PositionInput::onError(RTC::UniqueId ec_id)
00127 {
00128   return RTC::RTC_OK;
00129 }
00130 */
00131 /*
00132 RTC::ReturnCode_t PositionInput::onReset(RTC::UniqueId ec_id)
00133 {
00134   return RTC::RTC_OK;
00135 }
00136 */
00137 /*
00138 RTC::ReturnCode_t PositionInput::onStateUpdate(RTC::UniqueId ec_id)
00139 {
00140   return RTC::RTC_OK;
00141 }
00142 */
00143 /*
00144 RTC::ReturnCode_t PositionInput::onRateChanged(RTC::UniqueId ec_id)
00145 {
00146   return RTC::RTC_OK;
00147 }
00148 */
00149 
00150 
00151 extern "C"
00152 {
00153  
00154   void PositionInputInit(RTC::Manager* manager)
00155   {
00156     RTC::Properties profile(positioninput_spec);
00157     manager->registerFactory(profile,
00158                              RTC::Create<PositionInput>,
00159                              RTC::Delete<PositionInput>);
00160   }
00161   
00162 };
00163 
00164 
00165 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


RS003
Author(s):
autogenerated on Thu Jun 27 2013 14:58:49