16 std::lock_guard<std::mutex> lock(mutex);
18 std::swap(datum, last_rgb);
24 std::lock_guard<std::mutex> lock(mutex);
25 if (local_arrival_time <= 0.0) {
34 return std::make_tuple(
true, last_rgb, stamp);
41 std::lock_guard<std::mutex> lock(mutex);
43 std::swap(datum, last_depth);
49 std::lock_guard<std::mutex> lock(mutex);
50 if (local_arrival_time <= 0.0) {
60 return std::make_tuple(
true, last_depth, stamp);
67 auto result = port_rgb->getImage();
69 if (!std::get<0>(result)) {
73 data = std::get<1>(result);
75 *timeStamp = std::get<2>(result);
83 auto result = port_depth->getImage();
85 if (!std::get<0>(result)) {
89 data = std::get<1>(result);
91 *timeStamp = std::get<2>(result);
99 auto resultRgb = port_rgb->getImage();
100 auto resultDepth = port_depth->getImage();
102 bool retRgb = std::get<0>(resultRgb);
103 bool retDepth = std::get<0>(resultDepth);
105 if (!retRgb || !retDepth) {
109 rgbImage = std::get<1>(resultRgb);
112 port_rgb->getEnvelope(*rgbStamp);
116 port_depth->getEnvelope(*depthStamp);
124 port_rgb = _port_rgb;
125 port_depth = _port_depth;
127 port_depth->useCallback();
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
void useCallback(TypedReaderCallback< T > &callback) override
Set an object whose onRead method will be called when data is available.
An abstraction for a time stamp and/or sequence number.
Image class with user control of representation details.
An interface for the device drivers.
double now()
Return the current time in seconds, relative to an arbitrary starting point.