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>
30
31#include "RGBDSensorMsgsImpl.h"
32
34
35namespace RGBDImpl {
36
37#define DEFAULT_THREAD_PERIOD 0.03 // s
38
39} // namespace RGBDImpl
40
61{
62private:
66 typedef unsigned int UInt;
67
68 enum SensorType{COLOR_SENSOR, DEPTH_SENSOR};
69
70 template <class T>
71 struct param
72 {
73 param(T& inVar, std::string inName)
74 {
75 var = &inVar;
76 parname = inName;
77 }
78 T* var;
79 std::string parname;
80 };
81
82 std::string colorFrame_StreamingPort_Name;
83 std::string depthFrame_StreamingPort_Name;
84 ImagePortType colorFrame_StreamingPort;
85 DepthPortType depthFrame_StreamingPort;
86
87 // One RPC port should be enough for the wrapper in all cases
88 yarp::os::Port rpcPort;
89 std::string rpcPort_Name;
90 yarp::sig::FlexImage colorImage;
92
93 //Helper class for RPCs
94 std::unique_ptr<RGBDSensorMsgsImpl> m_rgbd_RPC = nullptr;
95 std::mutex m_mutex;
96
97 // Image data specs
98 // int hDim, vDim;
99 yarp::dev::IRGBDSensor* m_rgbdsensor = nullptr;
100 yarp::dev::IFrameGrabberControls* m_fgCtrl = nullptr;
102 int verbose;
103
104 // Synch
105 yarp::os::Stamp colorStamp;
106 yarp::os::Stamp depthStamp;
107
108 bool writeData();
109 bool setCamInfo(const std::string& frame_id,
110 const UInt& seq,
111 const SensorType& sensorType);
112
113public:
119 ~RGBDSensor_nws_yarp() override;
120
121 bool open(yarp::os::Searchable &params) override;
122 bool close() override;
123
124 bool read(yarp::os::ConnectionReader& connection) override;
125
126 bool attach(yarp::dev::PolyDriver *poly) override;
127 bool detach() override;
128
129 bool threadInit() override;
130 void threadRelease() override;
131 void run() override;
132};
133
134#endif // YARP_DEV_RGBDSENSOR_NWS_YARP_H
contains the definition of a Vector type
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 ...
RGBDSensor_nws_yarp & operator=(const RGBDSensor_nws_yarp &)=delete
bool attach(yarp::dev::PolyDriver *poly) override
Attach to another object.
void run() override
Loop function.
bool close() override
Close the DeviceDriver.
RGBDSensor_nws_yarp(RGBDSensor_nws_yarp &&)=delete
void threadRelease() override
Release method.
bool threadInit() override
Initialization method.
RGBDSensor_nws_yarp & operator=(RGBDSensor_nws_yarp &&)=delete
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool detach() override
WrapperSingle interface.
RGBDSensor_nws_yarp(const RGBDSensor_nws_yarp &)=delete
bool open(yarp::os::Searchable &params) override
Device driver interface.
Interface implemented by all device drivers.
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
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 mini-server for performing network communication in the background.
An interface for reading from a network connection.
An abstraction for a periodic thread.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition PortReader.h:24
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:361
Typed image class.
Definition Image.h:603