RobotsIO
Loading...
Searching...
No Matches
YarpCamera.h
1/*
2 * Copyright (C) 2019 Istituto Italiano di Tecnologia (IIT)
3 *
4 * This software may be modified and distributed under the terms of the
5 * BSD 3-Clause license. See the accompanying LICENSE file for details.
6 */
7
8#ifndef ROBOTSIO_YARPCAMERA_H
9#define ROBOTSIO_YARPCAMERA_H
10
11#include <RobotsIO/Camera/Camera.h>
12
13#include <Eigen/Dense>
14
15#include <opencv2/opencv.hpp>
16
17#include <string>
18
19#include <yarp/os/BufferedPort.h>
20#include <yarp/os/Network.h>
21#include <yarp/sig/Image.h>
22#include <yarp/sig/Vector.h>
23
24namespace RobotsIO {
25 namespace Camera {
26 class YarpCamera;
27 }
28}
29
31{
32public:
33
34 YarpCamera(const std::string& port_prefix, const bool& network_bootstrap = false);
35
36 YarpCamera(const std::size_t& width, const std::size_t& height, const double& fx, const double& cx, const double& fy, const double& cy, const std::string& port_prefix, const bool& enable_camera_pose);
37
38 YarpCamera(const std::string& data_path, const std::size_t& width, const double& height, const double& fx, const double& cx, const double& fy, const double& cy);
39
41
46 std::pair<bool, Eigen::Transform<double, 3, Eigen::Affine>> pose(const bool& blocking) override;
47
48 std::pair<bool, cv::Mat> rgb(const bool& blocking) override;
49
50 std::pair<bool, Eigen::MatrixXf> depth(const bool& blocking) override;
51
52 std::pair<bool, double> time_stamp_rgb() const override;
53
54 std::pair<bool, double> time_stamp_depth() const override;
55
56private:
57 yarp::os::Network yarp_;
58
63 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelFloat>> port_depth_;
64
65 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb>> port_rgb_;
66
71 yarp::os::BufferedPort<yarp::sig::Vector> port_pose_;
72
73 bool enable_camera_pose_ = false;
74
75 yarp::sig::Vector last_camera_pose_;
76
81 double time_stamp_rgb_;
82
83 double time_stamp_depth_;
84
85 bool is_time_stamp_rgb_ = false;
86
87 bool is_time_stamp_depth_ = false;
88
93 const std::string log_name_ = "YarpCamera";
94};
95
96#endif /* ROBOTSIO_YARPCAMERA_H */
std::pair< bool, Eigen::MatrixXf > depth(const bool &blocking) override
Definition: YarpCamera.cpp:169
std::pair< bool, Eigen::Transform< double, 3, Eigen::Affine > > pose(const bool &blocking) override
Definition: YarpCamera.cpp:189