YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
RgbdSensor_nws_yarp.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_DEV_RGBDSENSOR_NWS_YARP_H
7#define YARP_DEV_RGBDSENSOR_NWS_YARP_H
8
9#include <vector>
10#include <iostream>
11#include <string>
12#include <sstream>
13
14#include <yarp/os/Port.h>
15#include <yarp/os/Time.h>
16#include <yarp/os/Stamp.h>
17#include <yarp/os/Bottle.h>
18#include <yarp/os/Network.h>
19#include <yarp/os/Property.h>
22
23
24#include <yarp/sig/Vector.h>
25
27#include <yarp/dev/PolyDriver.h>
29
33
35
36namespace RGBDImpl {
37
38#define DEFAULT_THREAD_PERIOD 0.03 // s
39
40// Following three definitions would fit better in a header file
41// shared between client and server ... where to place it?
43#define RGBD_WRAPPER_PROTOCOL_VERSION_MAJOR 1
44#define RGBD_WRAPPER_PROTOCOL_VERSION_MINOR 0
45
46
47
65
66} // namespace RGBDImpl
67
87{
88private:
92 typedef unsigned int UInt;
93
94 enum SensorType{COLOR_SENSOR, DEPTH_SENSOR};
95
96 template <class T>
97 struct param
98 {
99 param(T& inVar, std::string inName)
100 {
101 var = &inVar;
102 parname = inName;
103 }
104 T* var;
105 std::string parname;
106 };
107
108 std::string colorFrame_StreamingPort_Name;
109 std::string depthFrame_StreamingPort_Name;
110 ImagePortType colorFrame_StreamingPort;
111 DepthPortType depthFrame_StreamingPort;
112
113 // One RPC port should be enough for the wrapper in all cases
114 yarp::os::Port rpcPort;
115 std::string rpcPort_Name;
116 std::string nodeName;
117 yarp::sig::FlexImage colorImage;
119
120 // It should be possible to attach this guy to more than one port, try to see what
121 // will happen when receiving 2 calls at the same time (receive one calls while serving
122 // another one, it will result in concurrent thread most probably) and buffering issues.
123// sensor::depth::RGBDSensor_RPCMgsParser RPC_parser;
124
125 //Helper class for RPCs
127
128 // Image data specs
129 // int hDim, vDim;
130 yarp::dev::IRGBDSensor* sensor_p;
133 int verbose;
134
135 // Synch
136 yarp::os::Stamp colorStamp;
137 yarp::os::Stamp depthStamp;
138
139 bool writeData();
140 bool setCamInfo(const std::string& frame_id,
141 const UInt& seq,
142 const SensorType& sensorType);
143
144public:
150 ~RgbdSensor_nws_yarp() override;
151
152 bool open(yarp::os::Searchable &params) override;
153 bool close() override;
154
159 bool attach(yarp::dev::PolyDriver *poly) override;
160 bool detach() override;
161
162 bool threadInit() override;
163 void threadRelease() override;
164 void run() override;
165};
166
167#endif // YARP_DEV_RGBDSENSOR_NWS_YARP_H
contains the definition of a Vector type
bool configure(yarp::dev::IRGBDSensor *interface)
bool respond(const yarp::os::Bottle &cmd, yarp::os::Bottle &response) override
Respond to a message.
~RGBDSensorParser() override=default
This class is the parameters parser for class RgbdSensor_nws_yarp.
rgbdSensor_nws_yarp: A Network grabber for kinect-like devices. This device will produce two streams ...
void run() override
Loop function.
bool threadInit() override
Initialization method.
RgbdSensor_nws_yarp & operator=(RgbdSensor_nws_yarp &&)=delete
bool detach() override
WrapperSingle interface.
RgbdSensor_nws_yarp(RgbdSensor_nws_yarp &&)=delete
bool close() override
Close the DeviceDriver.
RgbdSensor_nws_yarp(const RgbdSensor_nws_yarp &)=delete
RgbdSensor_nws_yarp & operator=(const RgbdSensor_nws_yarp &)=delete
bool open(yarp::os::Searchable &params) override
Device driver interface.
void threadRelease() override
Release method.
bool attach(yarp::dev::PolyDriver *poly) override
Specify which sensor this thread has to read from.
Interface implemented by all device drivers.
A cheap and cheerful framework for human readable/writable forms of messages to devices.
An interface for retrieving intrinsic parameter from a depth camera.
Control interface for frame grabber devices.
A generic interface for cameras that have both color camera as well as depth camera sensor,...
Definition IRGBDSensor.h:39
An interface for retrieving intrinsic parameter from a rgb camera.
A container for a device driver.
Definition PolyDriver.h:23
Helper interface for an object that can wrap/or "attach" to a single other device.
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
A mini-server for performing network communication in the background.
An abstraction for a periodic thread.
A mini-server for network communication.
Definition Port.h:46
A base class for nested structures that can be searched.
Definition Searchable.h:31
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21
Image class with user control of representation details.
Definition Image.h:363
Typed image class.
Definition Image.h:605
constexpr yarp::conf::vocab32_t VOCAB_PROTOCOL_VERSION
std::int32_t vocab32_t
Definition numeric.h:78
constexpr yarp::conf::vocab32_t createVocab32(char a, char b=0, char c=0, char d=0)
Create a vocab from chars.
Definition Vocab.h:27