YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
IRGBDSensorTest.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 IRGBDSENSORTEST_H
7#define IRGBDSENSORTEST_H
8
10#include <catch2/catch_amalgamated.hpp>
11
12using namespace yarp::dev;
13using namespace yarp::os;
14
15namespace yarp::dev::tests
16{
18 {
19 REQUIRE(irgbd != nullptr);
20
21 {
22 double accuracy = 0;
24 r = irgbd->getDepthAccuracy(accuracy);
25 CHECK(r);
26 CHECK(accuracy != 5.0);
27 r = irgbd->setDepthAccuracy(5.0);
28 CHECK(r);
29 r = irgbd->getDepthAccuracy(accuracy);
30 CHECK(r);
31 CHECK(accuracy == 5.0);
32 }
33 {
34 double near = 0;
35 double far = 0;
36 ReturnValue r1 = irgbd->getDepthClipPlanes(near,far);
37 CHECK(r1);
38 CHECK(near != 1.0);
39 CHECK(far != 2.0 );
40 ReturnValue r2 = irgbd->setDepthClipPlanes(1.0,2.0);
41 CHECK(r2);
42 ReturnValue r3 = irgbd->getDepthClipPlanes(near,far);
43 CHECK(r3);
44 CHECK(near == 1.0);
45 CHECK(far == 2.0 );
46 }
47 {
48 double hfov = 0;
49 double vfov = 0;
50 ReturnValue r1 = irgbd->getDepthFOV(hfov,vfov);
51 CHECK(r1);
52 CHECK(hfov != 3.0);
53 CHECK(vfov != 4.0);
54 ReturnValue r2 = irgbd->setDepthFOV(3.0,4.0);
55 CHECK(r2);
56 ReturnValue r3 = irgbd->getDepthFOV(hfov,vfov);
57 CHECK(r3);
58 CHECK(hfov == 3.0);
59 CHECK(vfov == 4.0 );
60 }
61 {
62 int h = 0;
63 h = irgbd->getDepthHeight();
64 CHECK(h > 0);
65 }
66 {
67 yarp::os::Stamp stamp;
71 r1 = irgbd->getDepthImage(img, nullptr);
72 r2 = irgbd->getDepthImage(img, &stamp);
73 CHECK(r1);
74 CHECK(r2);
75 }
76 {
77 yarp::os::Property intrinsic;
79 r = irgbd->getDepthIntrinsicParam(intrinsic);
80 CHECK(r);
81 }
82 {
83 bool mir=false;
85 r = irgbd->getDepthMirroring(mir);
86 CHECK(r);
87 CHECK(mir==false);
88 r = irgbd->setDepthMirroring(true);
89 CHECK(r);
90 r = irgbd->getDepthMirroring(mir);
91 CHECK(r);
92 CHECK(mir==true);
93 }
94 {
95 int w;
96 w = irgbd->getDepthWidth();
97 CHECK(w>0);
98 }
99 {
100 int w = 0;
101 int h = 0;
102 ReturnValue r;
103 r = irgbd->getDepthResolution(w, h);
104 CHECK(r);
105 CHECK(w != 10);
106 CHECK(h != 11);
107 r = irgbd->setDepthResolution(10, 11);
108 CHECK(r);
109 r = irgbd->getDepthResolution(w, h);
110 CHECK(r);
111 CHECK(w == 10);
112 CHECK(h == 11);
113 }
114 {
115 ReturnValue r;
117 r = irgbd->getExtrinsicParam(matr);
118 CHECK(r);
119 }
120 {
125 yarp::os::Stamp rgbstamp;
126 yarp::os::Stamp depthstamp;
129 r1 = irgbd->getImages(rgb, depth);
130 r2 = irgbd->getImages(rgb,depth,&rgbstamp);
131 r3 = irgbd->getImages(rgb,depth,&rgbstamp,&depthstamp);
132 CHECK(r1);
133 CHECK(r2);
134 CHECK(r3);
135 }
136 {
139 std::string mesg;
140 yarp::os::Stamp stamp;
141 r1 = irgbd->getLastErrorMsg(mesg);
142 r2 = irgbd->getLastErrorMsg(mesg,&stamp);
143 CHECK(r1);
144 CHECK(r2);
145 }
146 {
147 double hfov = 0;
148 double vfov = 0;
149 ReturnValue r1 = irgbd->getRgbFOV(hfov,vfov);
150 CHECK(r1);
151 CHECK(hfov != 31.0);
152 CHECK(vfov != 41.0);
153 ReturnValue r2 = irgbd->setRgbFOV(31.0,41.0);
154 CHECK(r2);
155 ReturnValue r3 = irgbd->getRgbFOV(hfov,vfov);
156 CHECK(r3);
157 CHECK(hfov == 31.0);
158 CHECK(vfov == 41.0);
159 }
160 {
161 double h = 0;
162 h = irgbd->getRgbHeight();
163 CHECK(h>0);
164 }
165 {
168 yarp::os::Stamp stamp;
170 r1 = irgbd->getRgbImage(rgb);
171 r2 = irgbd->getRgbImage(rgb,&stamp);
172 CHECK(r1);
173 CHECK(r2);
174 }
175 {
176 ReturnValue r;
177 yarp::os::Property intrinsic;
178 r = irgbd->getRgbIntrinsicParam(intrinsic);
179 CHECK(r);
180 }
181 {
182 bool mir=false;
183 ReturnValue r;
184 r = irgbd->getRgbMirroring(mir);
185 CHECK(r);
186 CHECK(mir==false);
187 r = irgbd->setRgbMirroring(true);
188 CHECK(r);
189 r = irgbd->getRgbMirroring(mir);
190 CHECK(r);
191 CHECK(mir==true);
192 }
193 {
194 int w = 0;
195 int h = 0;
196 ReturnValue r;
197 r = irgbd->getRgbResolution(w, h);
198 CHECK(r);
199 CHECK(w != 30);
200 CHECK(h != 31);
201 r = irgbd->setRgbResolution(30, 31);
202 CHECK(r);
203 r = irgbd->getRgbResolution(w, h);
204 CHECK(r);
205 CHECK(w == 30);
206 CHECK(h == 31);
207 }
208 {
209 ReturnValue r;
210 std::vector<yarp::dev::CameraConfig> cfg;
211 r = irgbd->getRgbSupportedConfigurations(cfg);
212 CHECK(r);
213 CHECK(cfg.size()>0);
214 }
215 {
216 ReturnValue r;
217 int w = irgbd->getRgbWidth();
218 CHECK(w>0);
219 }
220 {
221 ReturnValue r;
223 r = irgbd->getSensorStatus(status);
224 CHECK(r);
225 }
226 }
227}
228
229#endif
A generic interface for cameras that have both color camera as well as depth camera sensor,...
Definition IRGBDSensor.h:39
A mini-server for performing network communication in the background.
A class for storing options and configuration information.
Definition Property.h:33
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
A class for a Matrix.
Definition Matrix.h:39
void exec_iRGBDSensor_test_1(IRGBDSensor *irgbd)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.
constexpr char accuracy[]