YARP
Yet Another Robot Platform
IVisualParamsImpl.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #include <yarp/os/LogStream.h>
11 #include <yarp/dev/GenericVocabs.h>
12 #include <cstring>
13 
14 using namespace yarp::os;
15 using namespace yarp::dev;
16 
17 //
18 // Depth helper implementation
19 //
20 
21 // RGB Sender
22 Implement_RgbVisualParams_Sender::Implement_RgbVisualParams_Sender(yarp::os::Port &port) : _port(port) {};
23 
25 {
26  yarp::os::Bottle cmd, response;
28  cmd.addVocab(VOCAB_GET);
30  _port.write(cmd, response);
31  return response.get(3).asInt32();
32 }
33 
35 {
36  yarp::os::Bottle cmd, response;
38  cmd.addVocab(VOCAB_GET);
39  cmd.addVocab(VOCAB_WIDTH);
40  _port.write(cmd, response);
41  return response.get(3).asInt32();
42 }
44  yarp::os::Bottle cmd, response;
46  cmd.addVocab(VOCAB_GET);
48  _port.write(cmd, response);
49 
50  if((response.get(0).asVocab())== VOCAB_FAILED)
51  {
52  configurations.clear();
53  return false;
54  }
55  configurations.resize(response.get(3).asInt32());
56  for(int i=0; i<response.get(3).asInt32(); i++){
57  configurations[i].width=response.get(4 + i*4).asInt32();
58  configurations[i].height=response.get(4 + i*4 + 1).asInt32();
59  configurations[i].framerate=response.get(4 + i*4 + 2).asFloat64();
60  configurations[i].pixelCoding=static_cast<YarpVocabPixelTypesEnum>(response.get(4 + i*4 + 3).asVocab());
61  }
62  return true;
63 }
65  yarp::os::Bottle cmd, response;
67  cmd.addVocab(VOCAB_GET);
69  _port.write(cmd, response);
70 
71  // Minimal check on response, we suppose the response is always correctly formatted
72  if((response.get(0).asVocab()) == VOCAB_FAILED)
73  {
74  width = 0;
75  height= 0;
76  return false;
77  }
78  width = response.get(3).asInt32();
79  height = response.get(4).asInt32();
80  return true;
81 
82 }
83 
85 {
86  yarp::os::Bottle cmd, response;
88  cmd.addVocab(VOCAB_SET);
90  cmd.addInt32(width);
91  cmd.addInt32(height);
92  _port.write(cmd, response);
93  return response.get(2).asBool();
94 }
95 
96 bool Implement_RgbVisualParams_Sender::getRgbFOV(double &horizontalFov, double &verticalFov)
97 {
98  yarp::os::Bottle cmd, response;
100  cmd.addVocab(VOCAB_GET);
101  cmd.addVocab(VOCAB_FOV);
102  _port.write(cmd, response);
103 
104  // Minimal check on response, we suppose the response is always correctly formatted
105  if((response.get(0).asVocab()) == VOCAB_FAILED)
106  {
107  horizontalFov = 0;
108  verticalFov = 0;
109  return false;
110  }
111  horizontalFov = response.get(3).asFloat64();
112  verticalFov = response.get(4).asFloat64();
113  return true;
114 }
115 
116 bool Implement_RgbVisualParams_Sender::setRgbFOV(double horizontalFov, double verticalFov)
117 {
118  yarp::os::Bottle cmd, response;
120  cmd.addVocab(VOCAB_SET);
121  cmd.addVocab(VOCAB_FOV);
122  cmd.addFloat64(horizontalFov);
123  cmd.addFloat64(verticalFov);
124  _port.write(cmd, response);
125  return response.get(2).asBool();
126 }
127 
129 {
130  yarp::os::Bottle cmd, response;
132  cmd.addVocab(VOCAB_GET);
134  _port.write(cmd, response);
135 
136  // Minimal check on response, we suppose the response is always correctly formatted
137  if((response.get(0).asVocab()) == VOCAB_FAILED)
138  {
139  intrinsic.clear();
140  return false;
141  }
142  bool ret;
143  ret=Property::copyPortable(response.get(3), intrinsic);
144  if(!response.get(4).isNull())
145  {
146  Property& p=intrinsic.addGroup("right");
147  ret &= Property::copyPortable(response.get(4),p);
148  return ret;
149  }
150  return ret;
151 
152 }
153 
155 {
156  yarp::os::Bottle cmd, response;
158  cmd.addVocab(VOCAB_GET);
159  cmd.addVocab(VOCAB_MIRROR);
160  _port.write(cmd, response);
161  if((response.get(0).asVocab()) == VOCAB_FAILED)
162  {
163  return false;
164  }
165  mirror = response.get(3).asBool();
166  return true;
167 }
168 
170 {
171  yarp::os::Bottle cmd, response;
173  cmd.addVocab(VOCAB_SET);
174  cmd.addVocab(VOCAB_MIRROR);
175  cmd.addInt32(mirror);
176  _port.write(cmd, response);
177  return response.get(2).asBool();
178 }
179 
180 // RGB Parser
182 
183 // Implement_RgbVisualParams_Parser::~Implement_RgbVisualParams_Parser() { }
184 
186 {
187  bool ret = false;
188  if(interface)
189  {
190  iRgbVisual = interface;
191  ret = true;
192  }
193  else
194  {
195  iRgbVisual = nullptr;
196  ret = false;
197  }
198  return ret;
199 }
200 
202 {
203  bool ret = false;
204  response.clear();
205  if(!iRgbVisual)
206  {
207  yError() << "Rgb Visual parameter Parser has not been correctly configures. IRgbVisualParams interface is not valid";
208  response.addVocab(VOCAB_FAILED);
209  return false;
210  }
211 
212  int code = cmd.get(0).asVocab();
213  if(code != VOCAB_RGB_VISUAL_PARAMS)
214  {
215  yError() << "Rgb Visual Params Parser received a command not belonging to this interface. Required interface is " << yarp::os::Vocab::decode(code);
216  response.addVocab(VOCAB_FAILED);
217  return false;
218  }
219 
220  switch (cmd.get(1).asVocab())
221  {
222  case VOCAB_GET:
223  {
224  switch(cmd.get(2).asVocab())
225  {
226  case VOCAB_HEIGHT:
228  response.addVocab(VOCAB_HEIGHT);
229  response.addVocab(VOCAB_IS);
230  response.addInt32(iRgbVisual->getRgbHeight());
231  ret=true;
232  break;
233 
234  case VOCAB_WIDTH:
236  response.addVocab(VOCAB_WIDTH);
237  response.addVocab(VOCAB_IS);
238  response.addInt32(iRgbVisual->getRgbWidth());
239  ret=true;
240  break;
241 
243  {
245  ret = iRgbVisual->getRgbSupportedConfigurations(conf);
246  if(ret){
248  response.addVocab(VOCAB_SUPPORTED_CONF);
249  response.addVocab(VOCAB_IS);
250  response.addInt32(conf.size());
251  for(size_t i=0; i<conf.size(); i++){
252  response.addInt32(conf[i].width);
253  response.addInt32(conf[i].height);
254  response.addFloat64(conf[i].framerate);
255  response.addVocab(conf[i].pixelCoding);
256  }
257  }
258  else
259  response.addVocab(VOCAB_FAILED);
260  }
261  break;
262 
263 
264  case VOCAB_RESOLUTION:
265  {
266  int width, height;
267  ret = iRgbVisual->getRgbResolution(width, height);
268  if(ret)
269  {
271  response.addVocab(VOCAB_RESOLUTION);
272  response.addVocab(VOCAB_IS);
273  response.addInt32(width);
274  response.addInt32(height);
275  }
276  else
277  response.addVocab(VOCAB_FAILED);
278  }
279  break;
280 
281  case VOCAB_FOV:
282  {
283  double hFov, vFov;
284  ret = iRgbVisual->getRgbFOV(hFov, vFov);
285  if(ret)
286  {
288  response.addVocab(VOCAB_FOV);
289  response.addVocab(VOCAB_IS);
290  response.addFloat64(hFov);
291  response.addFloat64(vFov);
292  }
293  else
294  response.addVocab(VOCAB_FAILED);
295  }
296  break;
297 
299  {
300  yarp::os::Property params;
301  ret = iRgbVisual->getRgbIntrinsicParam(params);
302  if(ret)
303  {
306  response.addVocab(VOCAB_IS);
307  yarp::os::Bottle& tmp=response.addList();
308  ret &= Property::copyPortable(params, tmp);
309  }
310  else
311  response.addVocab(VOCAB_FAILED);
312  }
313  break;
314 
315  case VOCAB_MIRROR:
316  {
317  bool mirror;
318  ret = iRgbVisual->getRgbMirroring(mirror);
319  if(ret)
320  {
322  response.addVocab(VOCAB_MIRROR);
323  response.addVocab(VOCAB_IS);
324  response.addInt32(mirror);
325  }
326  else
327  response.addVocab(VOCAB_FAILED);
328  }
329  break;
330 
331  default:
332  {
333  yError() << "Rgb Visual Parameter interface parser received an unknown GET command. Command is " << cmd.toString();
334  response.addVocab(VOCAB_FAILED);
335  ret = false;
336  }
337  break;
338  }
339  }
340  break;
341 
342  case VOCAB_SET:
343  {
344  switch(cmd.get(2).asVocab())
345  {
346  case VOCAB_RESOLUTION:
347  ret = iRgbVisual->setRgbResolution(cmd.get(3).asInt32(), cmd.get(4).asInt32());
349  response.addVocab(VOCAB_SET);
350  response.addInt32(ret);
351  break;
352 
353  case VOCAB_FOV:
354  ret = iRgbVisual->setRgbFOV(cmd.get(3).asFloat64(), cmd.get(4).asFloat64());
356  response.addVocab(VOCAB_SET);
357  response.addInt32(ret);
358  break;
359 
360  case VOCAB_MIRROR:
361  {
362  ret = iRgbVisual->setRgbMirroring(cmd.get(3).asBool());
364  response.addVocab(VOCAB_SET);
365  response.addInt32(ret);
366  }
367  break;
368 
369  default:
370  {
371  yError() << "Rgb Visual Parameter interface parser received am unknown SET command. Command is " << cmd.toString();
372  response.addVocab(VOCAB_FAILED);
373  ret = false;
374  }
375  break;
376  }
377  } // end VOCAB
378  break;
379 
380  default:
381  {
382  yError() << "Rgb Visual parameter interface Parser received a malformed request. Command should either be 'set' or 'get', received " << cmd.toString();
383  response.addVocab(VOCAB_FAILED);
384  ret = false;
385  }
386  break;
387  }
388  return ret;
389 }
390 
391 //
392 // Depth helper implementation
393 //
394 
395 // Sender
396 
398 
399 // Implement_DepthVisualParams_Sender::~Implement_DepthVisualParams_Sender() { };
400 
402 {
403  yarp::os::Bottle cmd, response;
405  cmd.addVocab(VOCAB_GET);
406  cmd.addVocab(VOCAB_HEIGHT);
407  _port.write(cmd, response);
408  return response.get(3).asInt32();
409 }
410 
412 {
413  yarp::os::Bottle cmd, response;
415  cmd.addVocab(VOCAB_GET);
416  cmd.addVocab(VOCAB_WIDTH);
417  _port.write(cmd, response);
418  return response.get(3).asInt32();
419 }
420 
422 {
423  yarp::os::Bottle cmd, response;
425  cmd.addVocab(VOCAB_SET);
427  cmd.addInt32(_width);
428  cmd.addInt32(_height);
429  _port.write(cmd, response);
430  return response.get(2).asBool();
431 }
432 
433 bool Implement_DepthVisualParams_Sender::getDepthFOV(double &horizontalFov, double &verticalFov)
434 {
435  yarp::os::Bottle cmd, response;
437  cmd.addVocab(VOCAB_GET);
438  cmd.addVocab(VOCAB_FOV);
439  _port.write(cmd, response);
440 
441  // Minimal check on response, we suppose the response is always correctly formatted
442  if((response.get(0).asVocab()) == VOCAB_FAILED)
443  {
444  horizontalFov = 0;
445  verticalFov = 0;
446  return false;
447  }
448  horizontalFov = response.get(3).asFloat64();
449  verticalFov = response.get(4).asFloat64();
450  return true;
451 }
452 
453 bool Implement_DepthVisualParams_Sender::setDepthFOV(double horizontalFov, double verticalFov)
454 {
455  yarp::os::Bottle cmd, response;
457  cmd.addVocab(VOCAB_SET);
458  cmd.addVocab(VOCAB_FOV);
459  cmd.addFloat64(horizontalFov);
460  cmd.addFloat64(verticalFov);
461  _port.write(cmd, response);
462  return response.get(2).asBool();
463 }
464 
466 {
467  yarp::os::Bottle cmd, response;
469  cmd.addVocab(VOCAB_GET);
471  _port.write(cmd, response);
472  return response.get(3).asFloat64();
473 }
474 
476 {
477  yarp::os::Bottle cmd, response;
479  cmd.addVocab(VOCAB_SET);
481  cmd.addFloat64(accuracy);
482  _port.write(cmd, response);
483  return response.get(2).asBool();
484 }
485 
486 bool Implement_DepthVisualParams_Sender::getDepthClipPlanes(double &nearPlane, double &farPlane)
487 {
488  yarp::os::Bottle cmd, response;
490  cmd.addVocab(VOCAB_GET);
492  _port.write(cmd, response);
493 
494  // Minimal check on response, we suppose the response is always correctly formatted
495  if((response.get(0).asVocab()) == VOCAB_FAILED)
496  {
497  nearPlane = 0;
498  farPlane = 0;
499  return false;
500  }
501  nearPlane = response.get(3).asFloat64();
502  farPlane = response.get(4).asFloat64();
503  return true;
504 }
505 
506 bool Implement_DepthVisualParams_Sender::setDepthClipPlanes(double nearPlane, double farPlane)
507 {
508  yarp::os::Bottle cmd, response;
510  cmd.addVocab(VOCAB_SET);
512  cmd.addFloat64(nearPlane);
513  cmd.addFloat64(farPlane);
514  _port.write(cmd, response);
515  return response.get(2).asBool();
516 }
517 
519 {
520  yarp::os::Bottle cmd, response;
522  cmd.addVocab(VOCAB_GET);
524  _port.write(cmd, response);
525 
526  // Minimal check on response, we suppose the response is always correctly formatted
527  if((response.get(0).asVocab()) == VOCAB_FAILED)
528  {
529  intrinsic.clear();
530  return false;
531  }
532 
533  Property::copyPortable(response.get(3), intrinsic); // will it really work??
534  return true;
535 }
536 
538 {
539  yarp::os::Bottle cmd, response;
541  cmd.addVocab(VOCAB_GET);
542  cmd.addVocab(VOCAB_MIRROR);
543  _port.write(cmd, response);
544  if((response.get(0).asVocab()) == VOCAB_FAILED)
545  {
546  return false;
547  }
548  mirror = response.get(3).asBool();
549  return true;
550 }
551 
553 {
554  yarp::os::Bottle cmd, response;
556  cmd.addVocab(VOCAB_SET);
557  cmd.addVocab(VOCAB_MIRROR);
558  cmd.addInt32(mirror);
559  _port.write(cmd, response);
560  return response.get(2).asBool();
561 }
562 
564 // Implement_DepthVisualParams_Parser::~Implement_DepthVisualParams_Parser() { }
565 
567 {
568  bool ret = false;
569  if(interface)
570  {
571  iDepthVisual = interface;
572  ret = true;
573  }
574  else
575  {
576  iDepthVisual = nullptr;
577  ret = false;
578  }
579  return ret;
580 }
581 
583 {
584  bool ret = false;
585  response.clear();
586  if(!iDepthVisual)
587  {
588  yError() << "Depth Visual parameter Parser has not been correctly configured. IDepthVisualParams interface is not valid";
589  response.addVocab(VOCAB_FAILED);
590  return false;
591  }
592 
593  int code = cmd.get(0).asVocab();
594  if(code != VOCAB_DEPTH_VISUAL_PARAMS)
595  {
596  yError() << "Depth Visual Params Parser received a command not belonging to this interface. Required interface was " << yarp::os::Vocab::decode(code);
597  response.addVocab(VOCAB_FAILED);
598  return false;
599  }
600 
601  switch (cmd.get(1).asVocab())
602  {
603  case VOCAB_GET:
604  {
605  switch(cmd.get(2).asVocab())
606  {
607  case VOCAB_HEIGHT:
608  {
610  response.addVocab(VOCAB_HEIGHT);
611  response.addVocab(VOCAB_IS);
612  response.addInt32(iDepthVisual->getDepthHeight());
613  }
614  break;
615 
616  case VOCAB_WIDTH:
617  {
619  response.addVocab(VOCAB_WIDTH);
620  response.addVocab(VOCAB_IS);
621  response.addInt32(iDepthVisual->getDepthWidth());
622  }
623  break;
624 
625  case VOCAB_FOV:
626  {
627  double hFov, vFov;
628  ret = iDepthVisual->getDepthFOV(hFov, vFov);
629  if(ret)
630  {
632  response.addVocab(VOCAB_FOV);
633  response.addVocab(VOCAB_IS);
634  response.addFloat64(hFov);
635  response.addFloat64(vFov);
636  }
637  else
638  response.addVocab(VOCAB_FAILED);
639  }
640  break;
641 
643  {
644  yarp::os::Property params;
645  ret = iDepthVisual->getDepthIntrinsicParam(params);
646  if(ret)
647  {
650  response.addVocab(VOCAB_IS);
651  yarp::os::Bottle& tmp=response.addList();
652  ret &= Property::copyPortable(params, tmp);
653  }
654  else
655  {
656  response.addVocab(VOCAB_FAILED);
657  }
658  }
659  break;
660 
661  case VOCAB_ACCURACY:
662  {
664  response.addVocab(VOCAB_ACCURACY);
665  response.addVocab(VOCAB_IS);
666  response.addFloat64(iDepthVisual->getDepthAccuracy());
667  }
668  break;
669 
670  case VOCAB_CLIP_PLANES:
671  {
672  double nearPlane, farPlane;
673  iDepthVisual->getDepthClipPlanes(nearPlane, farPlane);
675  response.addVocab(VOCAB_CLIP_PLANES);
676  response.addVocab(VOCAB_IS);
677  response.addFloat64(nearPlane);
678  response.addFloat64(farPlane);
679  }
680  break;
681 
682  case VOCAB_MIRROR:
683  {
684  bool mirror;
685  ret = iDepthVisual->getDepthMirroring(mirror);
686  if(ret)
687  {
689  response.addVocab(VOCAB_MIRROR);
690  response.addVocab(VOCAB_IS);
691  response.addInt32(mirror);
692  }
693  else
694  response.addVocab(VOCAB_FAILED);
695  }
696  break;
697 
698  default:
699  {
700  yError() << "Depth Visual Parameter interface parser received am unknown GET command. Command is " << cmd.toString();
701  response.addVocab(VOCAB_FAILED);
702  ret = false;
703  }
704  break;
705  }
706  }
707  break;
708 
709  case VOCAB_SET:
710  {
711  switch(cmd.get(2).asVocab())
712  {
713  case VOCAB_RESOLUTION:
714  {
715  ret = iDepthVisual->setDepthResolution(cmd.get(3).asInt32(), cmd.get(4).asInt32());
717  response.addVocab(VOCAB_SET);
718  response.addInt32(ret);
719  }
720  break;
721 
722  case VOCAB_FOV:
723  {
724  ret = iDepthVisual->setDepthFOV(cmd.get(3).asFloat64(), cmd.get(4).asFloat64());
726  response.addVocab(VOCAB_SET);
727  response.addInt32(ret);
728  }
729  break;
730 
731  case VOCAB_ACCURACY:
732  {
733  ret = iDepthVisual->setDepthAccuracy(cmd.get(3).asFloat64());
735  response.addVocab(VOCAB_SET);
736  response.addInt32(ret);
737  }
738  break;
739 
740  case VOCAB_CLIP_PLANES:
741  {
742  ret = iDepthVisual->setDepthClipPlanes(cmd.get(3).asFloat64(), cmd.get(4).asFloat64());
744  response.addVocab(VOCAB_SET);
745  response.addInt32(ret);
746  }
747  break;
748 
749  case VOCAB_MIRROR:
750  {
751  ret = iDepthVisual->setDepthMirroring(cmd.get(3).asBool());
753  response.addVocab(VOCAB_SET);
754  response.addInt32(ret);
755  }
756  break;
757 
758  default:
759  {
760  yError() << "Rgb Visual Parameter interface parser received am unknown SET command. Command is " << cmd.toString();
761  response.addVocab(VOCAB_FAILED);
762  ret = false;
763  }
764  break;
765  }
766  }
767  break;
768 
769  default:
770  {
771  yError() << "Rgb Visual parameter interface Parser received a malformed request. Command should either be 'set' or 'get', received " << cmd.toString();
772  response.addVocab(VOCAB_FAILED);
773  ret = false;
774  }
775  break;
776  }
777  return ret;
778 }
LogStream.h
yarp::os::Bottle
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
yarp::os::Value::asVocab
virtual std::int32_t asVocab() const
Get vocabulary identifier as an integer.
Definition: Value.cpp:231
yarp::dev::IRgbVisualParams::getRgbFOV
virtual bool getRgbFOV(double &horizontalFov, double &verticalFov)=0
Get the field of view (FOV) of the rgb camera.
yarp::os::Bottle::toString
std::string toString() const override
Gives a human-readable textual representation of the bottle.
Definition: Bottle.cpp:214
yarp::os::Bottle::clear
void clear()
Empties the bottle of any objects it contains.
Definition: Bottle.cpp:124
yarp::dev::Implement_RgbVisualParams_Sender::setRgbMirroring
bool setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
Definition: IVisualParamsImpl.cpp:169
yarp::sig::VectorOf::resize
void resize(size_t size) override
Resize the vector.
Definition: Vector.h:254
yarp::dev::IDepthVisualParams::getDepthClipPlanes
virtual bool getDepthClipPlanes(double &nearPlane, double &farPlane)=0
Get the clipping planes of the sensor.
VOCAB_ACCURACY
constexpr yarp::conf::vocab32_t VOCAB_ACCURACY
Definition: IVisualParams.h:61
yarp::dev::Implement_DepthVisualParams_Sender::getDepthHeight
int getDepthHeight() override
Return the height of each frame.
Definition: IVisualParamsImpl.cpp:401
VOCAB_DEPTH_VISUAL_PARAMS
constexpr yarp::conf::vocab32_t VOCAB_DEPTH_VISUAL_PARAMS
Definition: IVisualParams.h:45
VOCAB_SUPPORTED_CONF
constexpr yarp::conf::vocab32_t VOCAB_SUPPORTED_CONF
Definition: IVisualParams.h:58
yarp::dev::IDepthVisualParams::getDepthMirroring
virtual bool getDepthMirroring(bool &mirror)=0
Get the mirroring setting of the sensor.
VOCAB_FOV
constexpr yarp::conf::vocab32_t VOCAB_FOV
Definition: IVisualParams.h:56
yarp::dev::IDepthVisualParams::getDepthFOV
virtual bool getDepthFOV(double &horizontalFov, double &verticalFov)=0
Get the field of view (FOV) of the depth camera.
yarp::dev::Implement_RgbVisualParams_Sender::setRgbFOV
bool setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
Definition: IVisualParamsImpl.cpp:116
yarp::dev::Implement_DepthVisualParams_Sender::getDepthMirroring
bool getDepthMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
Definition: IVisualParamsImpl.cpp:537
VOCAB_GET
constexpr yarp::conf::vocab32_t VOCAB_GET
Definition: GenericVocabs.h:16
VOCAB_INTRINSIC_PARAM
constexpr yarp::conf::vocab32_t VOCAB_INTRINSIC_PARAM
Definition: IVisualParams.h:57
yarp::dev::Implement_DepthVisualParams_Sender::getDepthClipPlanes
bool getDepthClipPlanes(double &nearPlane, double &farPlane) override
Get the clipping planes of the sensor.
Definition: IVisualParamsImpl.cpp:486
yarp::dev::IRgbVisualParams::setRgbResolution
virtual bool setRgbResolution(int width, int height)=0
Set the resolution of the rgb image from the camera.
yarp::dev::IDepthVisualParams::setDepthClipPlanes
virtual bool setDepthClipPlanes(double nearPlane, double farPlane)=0
Set the clipping planes of the sensor.
ret
bool ret
Definition: ImplementAxisInfo.cpp:72
yarp::sig::VectorOf::clear
void clear()
Definition: Vector.h:521
yarp::dev::Implement_RgbVisualParams_Sender::getRgbHeight
int getRgbHeight() override
Return the height of each frame.
Definition: IVisualParamsImpl.cpp:24
yarp::dev::IRgbVisualParams::setRgbFOV
virtual bool setRgbFOV(double horizontalFov, double verticalFov)=0
Set the field of view (FOV) of the rgb camera.
yarp::dev::IRgbVisualParams::getRgbSupportedConfigurations
virtual bool getRgbSupportedConfigurations(yarp::sig::VectorOf< yarp::dev::CameraConfig > &configurations)
Get the possible configurations of the camera.
Definition: IVisualParams.h:95
yarp::os::Bottle::addFloat64
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
Definition: Bottle.cpp:161
VOCAB_HEIGHT
constexpr yarp::conf::vocab32_t VOCAB_HEIGHT
Definition: GenericVocabs.h:45
yError
#define yError(...)
Definition: Log.h:282
VOCAB_CLIP_PLANES
constexpr yarp::conf::vocab32_t VOCAB_CLIP_PLANES
Definition: IVisualParams.h:62
yarp::dev
An interface for the device drivers.
Definition: audioBufferSizeData.cpp:17
yarp::os::Vocab::decode
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
Definition: Vocab.cpp:36
yarp::sig::VectorOf
Provides:
Definition: Vector.h:122
yarp::os::Port
A mini-server for network communication.
Definition: Port.h:50
yarp::dev::Implement_DepthVisualParams_Sender::setDepthAccuracy
bool setDepthAccuracy(double accuracy) override
Set the minimum detectable variation in distance [meter] when possible.
Definition: IVisualParamsImpl.cpp:475
yarp::dev::Implement_RgbVisualParams_Parser::respond
bool respond(const yarp::os::Bottle &cmd, yarp::os::Bottle &response) override
Respond to a message.
Definition: IVisualParamsImpl.cpp:201
VOCAB_SET
constexpr yarp::conf::vocab32_t VOCAB_SET
Definition: GenericVocabs.h:15
yarp::dev::IDepthVisualParams::getDepthHeight
virtual int getDepthHeight()=0
Return the height of each frame.
yarp::dev::Implement_RgbVisualParams_Sender::getRgbIntrinsicParam
bool getRgbIntrinsicParam(yarp::os::Property &intrinsic) override
Get the intrinsic parameters of the rgb camera.
Definition: IVisualParamsImpl.cpp:128
IVisualParamsImpl.h
yarp::os::Bottle::get
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Definition: Bottle.cpp:249
yarp::os::Bottle::addList
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
Definition: Bottle.cpp:185
yarp::dev::IDepthVisualParams::getDepthIntrinsicParam
virtual bool getDepthIntrinsicParam(yarp::os::Property &intrinsic)=0
Get the intrinsic parameters of the depth camera.
yarp::dev::Implement_DepthVisualParams_Sender::setDepthResolution
bool setDepthResolution(int width, int height) override
Set the resolution of the depth image from the camera.
Definition: IVisualParamsImpl.cpp:421
yarp::dev::Implement_RgbVisualParams_Sender::_port
yarp::os::Port & _port
Definition: IVisualParamsImpl.h:34
yarp::os::Value::asBool
virtual bool asBool() const
Get boolean value.
Definition: Value.cpp:189
yarp::dev::IRgbVisualParams::getRgbMirroring
virtual bool getRgbMirroring(bool &mirror)=0
Get the mirroring setting of the sensor.
VOCAB_FAILED
constexpr yarp::conf::vocab32_t VOCAB_FAILED
Definition: GenericVocabs.h:19
yarp::dev::Implement_DepthVisualParams_Parser::Implement_DepthVisualParams_Parser
Implement_DepthVisualParams_Parser()
Definition: IVisualParamsImpl.cpp:563
yarp::dev::Implement_DepthVisualParams_Sender::getDepthAccuracy
double getDepthAccuracy() override
Get the minimum detectable variation in distance [meter].
Definition: IVisualParamsImpl.cpp:465
yarp::dev::Implement_RgbVisualParams_Sender::setRgbResolution
bool setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
Definition: IVisualParamsImpl.cpp:84
yarp::dev::IDepthVisualParams::setDepthResolution
virtual bool setDepthResolution(int width, int height)=0
Set the resolution of the depth image from the camera.
yarp::os::Value::isNull
bool isNull() const override
Checks if the object is invalid.
Definition: Value.cpp:383
yarp::os::Bottle::addInt32
void addInt32(std::int32_t x)
Places a 32-bit integer in the bottle, at the end of the list.
Definition: Bottle.cpp:143
yarp::dev::IRgbVisualParams::getRgbIntrinsicParam
virtual bool getRgbIntrinsicParam(yarp::os::Property &intrinsic)=0
Get the intrinsic parameters of the rgb camera.
yarp::os::Bottle::addVocab
void addVocab(int x)
Places a vocabulary item in the bottle, at the end of the list.
Definition: Bottle.cpp:167
yarp::os::Property::clear
void clear()
Remove all associations.
Definition: Property.cpp:1040
VOCAB_MIRROR
constexpr yarp::conf::vocab32_t VOCAB_MIRROR
Definition: IVisualParams.h:52
yarp::dev::Implement_DepthVisualParams_Sender::setDepthFOV
bool setDepthFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the depth camera.
Definition: IVisualParamsImpl.cpp:453
yarp::dev::Implement_RgbVisualParams_Parser::configure
bool configure(IRgbVisualParams *interface)
Definition: IVisualParamsImpl.cpp:185
yarp::dev::Implement_RgbVisualParams_Sender::getRgbSupportedConfigurations
bool getRgbSupportedConfigurations(yarp::sig::VectorOf< CameraConfig > &configurations) override
Get the possible configurations of the camera.
Definition: IVisualParamsImpl.cpp:43
yarp::dev::IDepthVisualParams::setDepthFOV
virtual bool setDepthFOV(double horizontalFov, double verticalFov)=0
Set the field of view (FOV) of the depth camera.
VOCAB_WIDTH
constexpr yarp::conf::vocab32_t VOCAB_WIDTH
Definition: GenericVocabs.h:44
VOCAB_RGB_VISUAL_PARAMS
constexpr yarp::conf::vocab32_t VOCAB_RGB_VISUAL_PARAMS
Definition: IVisualParams.h:44
yarp::os::Value::asInt32
virtual std::int32_t asInt32() const
Get 32-bit integer value.
Definition: Value.cpp:207
yarp::dev::Implement_RgbVisualParams_Sender::getRgbFOV
bool getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
Definition: IVisualParamsImpl.cpp:96
yarp::dev::Implement_RgbVisualParams_Sender::getRgbResolution
bool getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
Definition: IVisualParamsImpl.cpp:64
yarp::os::Port::write
bool write(const PortWriter &writer, const PortWriter *callback=nullptr) const override
Write an object to the port.
Definition: Port.cpp:430
yarp::dev::IRgbVisualParams
An interface for retrieving intrinsic parameter from a rgb camera.
Definition: IVisualParams.h:73
yarp::dev::IDepthVisualParams::getDepthAccuracy
virtual double getDepthAccuracy()=0
Get the minimum detectable variation in distance [meter].
yarp::dev::Implement_RgbVisualParams_Parser::Implement_RgbVisualParams_Parser
Implement_RgbVisualParams_Parser()
Definition: IVisualParamsImpl.cpp:181
yarp::os
An interface to the operating system, including Port based communication.
Definition: AbstractCarrier.h:17
yarp::dev::Implement_DepthVisualParams_Sender::getDepthIntrinsicParam
bool getDepthIntrinsicParam(yarp::os::Property &intrinsic) override
Get the intrinsic parameters of the depth camera.
Definition: IVisualParamsImpl.cpp:518
yarp::dev::Implement_DepthVisualParams_Sender::setDepthMirroring
bool setDepthMirroring(bool mirror) override
Set the mirroring setting of the sensor.
Definition: IVisualParamsImpl.cpp:552
yarp::os::Property::addGroup
Property & addGroup(const std::string &key)
Add a nested group.
Definition: Property.cpp:1215
yarp::dev::IDepthVisualParams::setDepthMirroring
virtual bool setDepthMirroring(bool mirror)=0
Set the mirroring setting of the sensor.
yarp::dev::Implement_RgbVisualParams_Sender::getRgbMirroring
bool getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
Definition: IVisualParamsImpl.cpp:154
yarp::dev::Implement_RgbVisualParams_Sender::getRgbWidth
int getRgbWidth() override
Return the width of each frame.
Definition: IVisualParamsImpl.cpp:34
VOCAB_RESOLUTION
constexpr yarp::conf::vocab32_t VOCAB_RESOLUTION
Definition: IVisualParams.h:55
yarp::dev::IRgbVisualParams::setRgbMirroring
virtual bool setRgbMirroring(bool mirror)=0
Set the mirroring setting of the sensor.
yarp::sig::VectorOf::size
size_t size() const
Definition: Vector.h:355
yarp::dev::IRgbVisualParams::getRgbResolution
virtual bool getRgbResolution(int &width, int &height)
Get the resolution of the rgb image from the camera.
Definition: IVisualParams.h:103
VOCAB_IS
constexpr yarp::conf::vocab32_t VOCAB_IS
Definition: GenericVocabs.h:17
yarp::dev::Implement_DepthVisualParams_Parser::respond
bool respond(const yarp::os::Bottle &cmd, yarp::os::Bottle &response) override
Respond to a message.
Definition: IVisualParamsImpl.cpp:582
yarp::dev::IDepthVisualParams
An interface for retrieving intrinsic parameter from a depth camera.
Definition: IVisualParams.h:183
yarp::dev::IRgbVisualParams::getRgbWidth
virtual int getRgbWidth()=0
Return the width of each frame.
yarp::dev::IRgbVisualParams::getRgbHeight
virtual int getRgbHeight()=0
Return the height of each frame.
GenericVocabs.h
YarpVocabPixelTypesEnum
YarpVocabPixelTypesEnum
Definition: Image.h:46
yarp::dev::Implement_DepthVisualParams_Sender::getDepthWidth
int getDepthWidth() override
Return the height of each frame.
Definition: IVisualParamsImpl.cpp:411
yarp::os::Value::asFloat64
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Definition: Value.cpp:225
yarp::dev::IDepthVisualParams::setDepthAccuracy
virtual bool setDepthAccuracy(double accuracy)=0
Set the minimum detectable variation in distance [meter] when possible.
yarp::os::Property
A class for storing options and configuration information.
Definition: Property.h:37
yarp::dev::Implement_DepthVisualParams_Sender::Implement_DepthVisualParams_Sender
Implement_DepthVisualParams_Sender(os::Port &port)
Definition: IVisualParamsImpl.cpp:397
yarp::dev::Implement_DepthVisualParams_Sender::getDepthFOV
bool getDepthFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the depth camera.
Definition: IVisualParamsImpl.cpp:433
yarp::dev::IDepthVisualParams::getDepthWidth
virtual int getDepthWidth()=0
Return the height of each frame.
yarp::dev::Implement_DepthVisualParams_Sender::setDepthClipPlanes
bool setDepthClipPlanes(double nearPlane, double farPlane) override
Set the clipping planes of the sensor.
Definition: IVisualParamsImpl.cpp:506
yarp::dev::Implement_DepthVisualParams_Parser::configure
bool configure(IDepthVisualParams *interface)
Definition: IVisualParamsImpl.cpp:566