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);
76 CHECK(pf == 2.0);
77 }
78 {
79 yarp::os::Property intrinsic;
81 r = irgbd->getDepthIntrinsicParam(intrinsic);
82 CHECK(r);
83 }
84 {
85 bool mir=false;
87 r = irgbd->getDepthMirroring(mir);
88 CHECK(r);
89 CHECK(mir==false);
90 r = irgbd->setDepthMirroring(true);
91 CHECK(r);
92 r = irgbd->getDepthMirroring(mir);
93 CHECK(r);
94 CHECK(mir==true);
95 }
96 {
97 int w;
98 w = irgbd->getDepthWidth();
99 CHECK(w>0);
100 }
101 {
102 int w = 0;
103 int h = 0;
104 ReturnValue r;
105 r = irgbd->getDepthResolution(w, h);
106 CHECK(r);
107 CHECK(w != 10);
108 CHECK(h != 11);
109 r = irgbd->setDepthResolution(10, 11);
110 CHECK(r);
111 r = irgbd->getDepthResolution(w, h);
112 CHECK(r);
113 CHECK(w == 10);
114 CHECK(h == 11);
115 int ht = 0;
116 ht = irgbd->getDepthHeight();
117 CHECK(ht == 11);
118 int wt = 0;
119 wt = irgbd->getDepthWidth();
120 CHECK(wt == 10);
121 }
122 {
123 ReturnValue r;
125 r = irgbd->getExtrinsicParam(matr);
126 CHECK(r);
127 }
128 {
133 yarp::os::Stamp rgbstamp;
134 yarp::os::Stamp depthstamp;
137 r1 = irgbd->getImages(rgb, depth);
138 r2 = irgbd->getImages(rgb,depth,&rgbstamp);
139 r3 = irgbd->getImages(rgb,depth,&rgbstamp,&depthstamp);
140 CHECK(r1);
141 CHECK(r2);
142 CHECK(r3);
143 }
144 {
147 std::string mesg;
148 yarp::os::Stamp stamp;
149 r1 = irgbd->getLastErrorMsg(mesg);
150 r2 = irgbd->getLastErrorMsg(mesg,&stamp);
151 CHECK(r1);
152 CHECK(r2);
153 }
154 {
155 double hfov = 0;
156 double vfov = 0;
157 ReturnValue r1 = irgbd->getRgbFOV(hfov,vfov);
158 CHECK(r1);
159 CHECK(hfov != 31.0);
160 CHECK(vfov != 41.0);
161 ReturnValue r2 = irgbd->setRgbFOV(31.0,41.0);
162 CHECK(r2);
163 ReturnValue r3 = irgbd->getRgbFOV(hfov,vfov);
164 CHECK(r3);
165 CHECK(hfov == 31.0);
166 CHECK(vfov == 41.0);
167 }
168 {
169 double h = 0;
170 h = irgbd->getRgbHeight();
171 CHECK(h>0);
172 }
173 {
176 yarp::os::Stamp stamp;
178 r1 = irgbd->getRgbImage(rgb);
179 r2 = irgbd->getRgbImage(rgb,&stamp);
180 CHECK(r1);
181 CHECK(r2);
182 }
183 {
184 ReturnValue r;
185 yarp::os::Property intrinsic;
186 r = irgbd->getRgbIntrinsicParam(intrinsic);
187 CHECK(r);
188 }
189 {
190 bool mir=false;
191 ReturnValue r;
192 r = irgbd->getRgbMirroring(mir);
193 CHECK(r);
194 CHECK(mir==false);
195 r = irgbd->setRgbMirroring(true);
196 CHECK(r);
197 r = irgbd->getRgbMirroring(mir);
198 CHECK(r);
199 CHECK(mir==true);
200 }
201 {
202 int w = 0;
203 int h = 0;
204 ReturnValue r;
205 r = irgbd->getRgbResolution(w, h);
206 CHECK(r);
207 CHECK(w != 30);
208 CHECK(h != 31);
209 r = irgbd->setRgbResolution(30, 31);
210 CHECK(r);
211 r = irgbd->getRgbResolution(w, h);
212 CHECK(r);
213 CHECK(w == 30);
214 CHECK(h == 31);
215 }
216 {
217 ReturnValue r;
218 std::vector<yarp::dev::CameraConfig> cfg;
219 r = irgbd->getRgbSupportedConfigurations(cfg);
220 CHECK(r);
221 CHECK(cfg.size()>0);
222 }
223 {
224 ReturnValue r;
225 int w = irgbd->getRgbWidth();
226 CHECK(w>0);
227 }
228 {
229 ReturnValue r;
231 r = irgbd->getSensorStatus(status);
232 CHECK(r);
233 }
234 }
235}
236
237#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
T & safePixel(size_t x, size_t y)
Definition Image.h:635
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.
Definition OSTestMsg.cpp:13
constexpr char accuracy[]