ExtractCameraImage.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
10 #include "ExtractCameraImage.h"
11 
12 // Module specification
13 // <rtc-template block="module_spec">
14 static const char* extractcameraimage_spec[] =
15  {
16  "implementation_id", "ExtractCameraImage",
17  "type_name", "ExtractCameraImage",
18  "description", "extractcameraimage component",
19  "version", HRPSYS_PACKAGE_VERSION,
20  "vendor", "AIST",
21  "category", "example",
22  "activity_type", "DataFlowComponent",
23  "max_instance", "10",
24  "language", "C++",
25  "lang_type", "compile",
26  // Configuration variables
27  "conf.default.index","0",
28 
29  ""
30  };
31 // </rtc-template>
32 
34  : RTC::DataFlowComponentBase(manager),
35  // <rtc-template block="initializer">
36  m_imagesIn("images", m_images),
37  m_imageOut("image", m_image),
38  // </rtc-template>
39  m_index(0),
40  dummy(0)
41 {
42 }
43 
45 {
46 }
47 
48 
49 
51 {
52  std::cout << m_profile.instance_name << ": onInitialize()" << std::endl;
53  // <rtc-template block="bind_config">
54  // Bind variables and configuration variable
55  bindParameter("index", m_index, "0");
56 
57  // </rtc-template>
58 
59  // Registration: InPort/OutPort/Service
60  // <rtc-template block="registration">
61  // Set InPort buffers
62  addInPort("imagesIn", m_imagesIn);
63 
64  // Set OutPort buffer
65  addOutPort("imageOut", m_imageOut);
66 
67  // Set service provider to Ports
68 
69  // Set service consumers to Ports
70 
71  // Set CORBA Service Ports
72 
73  // </rtc-template>
74 
75  return RTC::RTC_OK;
76 }
77 
78 
79 
80 /*
81 RTC::ReturnCode_t ExtractCameraImage::onFinalize()
82 {
83  return RTC::RTC_OK;
84 }
85 */
86 
87 /*
88 RTC::ReturnCode_t ExtractCameraImage::onStartup(RTC::UniqueId ec_id)
89 {
90  return RTC::RTC_OK;
91 }
92 */
93 
94 /*
95 RTC::ReturnCode_t ExtractCameraImage::onShutdown(RTC::UniqueId ec_id)
96 {
97  return RTC::RTC_OK;
98 }
99 */
100 
102 {
103  std::cout << m_profile.instance_name<< ": onActivated(" << ec_id << ")" << std::endl;
104  return RTC::RTC_OK;
105 }
106 
108 {
109  std::cout << m_profile.instance_name<< ": onDeactivated(" << ec_id << ")" << std::endl;
110  return RTC::RTC_OK;
111 }
112 
114 {
115  if (m_imagesIn.isNew()){
116  m_imagesIn.read();
117  if (m_images.data.image_seq.length() > m_index){
118  m_image.tm = m_images.tm;
119  m_image.data = m_images.data.image_seq[m_index];
120  m_image.error_code = m_images.error_code;
121  m_imageOut.write();
122  }else{
123  std::cerr << m_profile.instance_name << ": invalid index of image(" << m_index
124  << "), length of images = " << m_images.data.image_seq.length() << std::endl;
125  }
126  }
127  return RTC::RTC_OK;
128 }
129 
130 /*
131 RTC::ReturnCode_t ExtractCameraImage::onAborting(RTC::UniqueId ec_id)
132 {
133  return RTC::RTC_OK;
134 }
135 */
136 
137 /*
138 RTC::ReturnCode_t ExtractCameraImage::onError(RTC::UniqueId ec_id)
139 {
140  return RTC::RTC_OK;
141 }
142 */
143 
144 /*
145 RTC::ReturnCode_t ExtractCameraImage::onReset(RTC::UniqueId ec_id)
146 {
147  return RTC::RTC_OK;
148 }
149 */
150 
151 /*
152 RTC::ReturnCode_t ExtractCameraImage::onStateUpdate(RTC::UniqueId ec_id)
153 {
154  return RTC::RTC_OK;
155 }
156 */
157 
158 /*
159 RTC::ReturnCode_t ExtractCameraImage::onRateChanged(RTC::UniqueId ec_id)
160 {
161  return RTC::RTC_OK;
162 }
163 */
164 
165 
166 
167 extern "C"
168 {
169 
171  {
173  manager->registerFactory(profile,
174  RTC::Create<ExtractCameraImage>,
175  RTC::Delete<ExtractCameraImage>);
176  }
177 
178 };
179 
180 
ComponentProfile m_profile
png_infop png_charpp int png_charpp profile
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
null component
Img::TimedCameraImage m_image
virtual RTC::ReturnCode_t onInitialize()
OutPort< Img::TimedCameraImage > m_imageOut
InPort< Img::TimedMultiCameraImage > m_imagesIn
bool addOutPort(const char *name, OutPortBase &outport)
ExtractCameraImage(RTC::Manager *manager)
Constructor.
ExecutionContextHandle_t UniqueId
bool bindParameter(const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id)
Img::TimedMultiCameraImage m_images
virtual bool isNew()
void ExtractCameraImageInit(RTC::Manager *manager)
static const char * extractcameraimage_spec[]
virtual bool write(DataType &value)
virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id)
virtual ~ExtractCameraImage()
Destructor.
bool addInPort(const char *name, InPortBase &inport)
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)


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