YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
RGBDSensorClient_StreamingMsgParser.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_RGBDSENSORCLIENT_RGBDSENSORCLIENT_STREAMINGMSGPARSER_H
7#define YARP_DEV_RGBDSENSORCLIENT_RGBDSENSORCLIENT_STREAMINGMSGPARSER_H
8
9#include <yarp/os/LogStream.h>
11#include <yarp/os/Stamp.h>
12#include <yarp/sig/Image.h>
14
15#include <list>
16#include <tuple>
17#include <mutex>
18
19
21 public yarp::os::BufferedPort<yarp::sig::FlexImage>
22{
23private:
24 double local_arrival_time {0.0};
25 yarp::os::Stamp stamp;
26 yarp::sig::FlexImage last_rgb;
27 mutable std::mutex mutex;
28
29public:
31 ~RgbImageBufferedPort() override = default;
32
34 void onRead(yarp::sig::FlexImage& datum) override;
35 std::tuple<bool, yarp::sig::FlexImage, yarp::os::Stamp> getImage() const;
36};
37
38
40 public yarp::os::BufferedPort<yarp::sig::ImageOf< yarp::sig::PixelFloat>>
41{
42private:
43 double local_arrival_time {0.0};
44 yarp::os::Stamp stamp;
46 mutable std::mutex mutex;
47
48public:
50 ~FloatImageBufferedPort() override = default;
51
54 std::tuple<bool, yarp::sig::ImageOf<yarp::sig::PixelFloat>, yarp::os::Stamp> getImage() const;
55};
56
57
59{
60private:
61 RgbImageBufferedPort *port_rgb {nullptr};
62 FloatImageBufferedPort *port_depth {nullptr};
63
64public:
66
68 yarp::os::Stamp *timeStamp = nullptr);
69
71 yarp::os::Stamp *timeStamp = nullptr);
72
73 bool read(yarp::sig::FlexImage &rgbImage,
75 yarp::os::Stamp *rgbStamp = nullptr,
76 yarp::os::Stamp *depthStamp = nullptr);
77
78 void attach(RgbImageBufferedPort* _port_rgb,
79 FloatImageBufferedPort* _port_depth);
80};
81
82#endif // YARP_DEV_RGBDSENSORCLIENT_RGBDSENSORCLIENT_STREAMINGMSGPARSER_H
FloatImageBufferedPort()=default
~FloatImageBufferedPort() override=default
void onRead(yarp::sig::ImageOf< yarp::sig::PixelFloat > &datum) override
std::tuple< bool, yarp::sig::ImageOf< yarp::sig::PixelFloat >, yarp::os::Stamp > getImage() const
bool read(yarp::sig::FlexImage &rgbImage, yarp::sig::ImageOf< yarp::sig::PixelFloat > &depthImage, yarp::os::Stamp *rgbStamp=nullptr, yarp::os::Stamp *depthStamp=nullptr)
void attach(RgbImageBufferedPort *_port_rgb, FloatImageBufferedPort *_port_depth)
bool readDepth(yarp::sig::ImageOf< yarp::sig::PixelFloat > &data, yarp::os::Stamp *timeStamp=nullptr)
bool readRgb(yarp::sig::FlexImage &data, yarp::os::Stamp *timeStamp=nullptr)
void onRead(yarp::sig::FlexImage &datum) override
std::tuple< bool, yarp::sig::FlexImage, yarp::os::Stamp > getImage() const
~RgbImageBufferedPort() override=default
RgbImageBufferedPort()=default
A mini-server for performing network communication in the background.
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21
A callback for typed data from a port.
Image class with user control of representation details.
Definition Image.h:374
Typed image class.
Definition Image.h:616