unit-tests-live-f200.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
5 // This set of tests is valid only for the F200 camera //
7 
8 #if !defined(MAKEFILE) || ( defined(F200_TEST) && defined(LIVE_TEST) )
9 
10 #define CATCH_CONFIG_MAIN
11 #include "catch/catch.hpp"
12 
13 #include "unit-tests-common.h"
14 
15 #include <sstream>
16 
17 // due to F200 timestamp spikes it will be not tested in video callbacks mode
18 inline void test_f200_streaming(rs_device * device, std::initializer_list<stream_mode> modes)
19 {
20  std::map<rs_stream, test_duration> duration_per_stream;
21  for(auto & mode : modes)
22  {
23  duration_per_stream.insert(std::pair<rs_stream, test_duration>(mode.stream, test_duration()));
24  rs_enable_stream(device, mode.stream, mode.width, mode.height, mode.format, mode.framerate, require_no_error());
25  REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 );
26  }
27 
28  test_wait_for_frames(device, modes, duration_per_stream);
29 
30  for(auto & mode : modes)
31  {
32  rs_disable_stream(device, mode.stream, require_no_error());
33  REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 0 );
34  }
35 }
36 
37 TEST_CASE( "F200 metadata enumerates correctly", "[live] [f200]" )
38 {
39  // Require at least one device to be plugged in
41  const int device_count = rs_get_device_count(ctx, require_no_error());
42  REQUIRE(device_count > 0);
43 
44  // For each device
45  for(int i=0; i<device_count; ++i)
46  {
48  REQUIRE(dev != nullptr);
49 
50  SECTION( "device name is Intel RealSense F200" )
51  {
52  const char * name = rs_get_device_name(dev, require_no_error());
53  REQUIRE(name == std::string("Intel RealSense F200"));
54  }
55  }
56 }
57 
58 TEST_CASE( "F200 devices support all required options", "[live] [f200]" )
59 {
60  // Require at least one device to be plugged in
62  const int device_count = rs_get_device_count(ctx, require_no_error());
63  REQUIRE(device_count > 0);
64 
65  // For each device
66  for(int i=0; i<device_count; ++i)
67  {
69  REQUIRE(dev != nullptr);
70 
71  SECTION( "device supports standard picture options and F200 extension options, and nothing else" )
72  {
73  const int supported_options[] = {
93  };
94 
95  for(int i=0; i<RS_OPTION_COUNT; ++i)
96  {
97  if(std::find(std::begin(supported_options), std::end(supported_options), i) != std::end(supported_options))
98  {
100  }
101  else
102  {
104  }
105  }
106  }
107  }
108 }
110 // Calibration information tests //
112 
113 TEST_CASE( "F200 device extrinsics are within expected parameters", "[live] [f200]" )
114 {
115  // Require at least one device to be plugged in
117  const int device_count = rs_get_device_count(ctx, require_no_error());
118  REQUIRE(device_count > 0);
119 
120  // For each device
121  for(int i=0; i<device_count; ++i)
122  {
124  REQUIRE(dev != nullptr);
125 
126  SECTION( "no extrinsic transformation between DEPTH and INFRARED" )
127  {
128  rs_extrinsics extrin;
130 
133  }
134 
135  SECTION( "depth scale is 1/32 mm" )
136  {
138  }
139  }
140 }
141 
143 // Depth streaming tests //
145 
146 TEST_CASE("F200 streams depth (Z16)", "[live] [f200] [one-camera]")
147 {
150 
152  REQUIRE(dev != nullptr);
153  REQUIRE(rs_get_device_name(dev, require_no_error()) == std::string("Intel RealSense F200"));
154 
155  SECTION("F200 streams depth 640x480 (VGA), [15,30,60] fps")
156  {
157  for (auto & fps : { /*2, 5,*/ 15, 30, 60 })
158  {
159  INFO("Testing " << fps << " fps");
160  test_f200_streaming(dev, { { RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, fps } });
161  }
162  }
163 
164  SECTION("F200 streams depth 640x240 (HVGA), [15,30,60] fps")
165  {
166  for (auto & fps : {/* 2, 5,*/ 15, 30, 60})
167  {
168  INFO("Testing " << fps << " fps");
169  test_f200_streaming(dev, { { RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, fps } });
170  }
171  }
172 }
173 
175 // Infrared streaming tests //
177 
178 TEST_CASE("F200 streams infrared (Y16)", "[live] [f200] [one-camera]")
179 {
182 
183  rs_device * dev = rs_get_device(ctx, 0, require_no_error());
184  REQUIRE(dev != nullptr);
185  REQUIRE(rs_get_device_name(dev, require_no_error()) == std::string("Intel RealSense F200"));
186 
187  SECTION("F200 streams infrared 640x480 depth (VGA), [30,60,120] fps")
188  {
189  for (auto & fps : { 30, 60, 120/*, 240, 300*/ })
190  {
191  INFO("Testing " << fps << " fps")
192  test_f200_streaming(dev, { { RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y16, fps } });
193  }
194  }
195 
196  SECTION("F200 streams infrared 640x240 depth (HVGA), [30,60,120] fps")
197  {
198  for (auto & fps : { 30, 60, 120/*, 240, 300*/ })
199  {
200  INFO("Testing " << fps << " fps")
201  test_f200_streaming(dev, { { RS_STREAM_INFRARED, 640, 240, RS_FORMAT_Y16, fps } });
202  }
203  }
204 }
205 
206 TEST_CASE( "F200 has no INFRARED2 streaming modes", "[live] [f200]" )
207 {
208  // Require at least one device to be plugged in
210  const int device_count = rs_get_device_count(ctx, require_no_error());
211  REQUIRE(device_count > 0);
212 
213  // For each device
214  for(int i=0; i<device_count; ++i)
215  {
216  rs_device * dev = rs_get_device(ctx, 0, require_no_error());
217  REQUIRE(dev != nullptr);
219  }
220 }
221 
223 // Streaming tests //
225 
226 TEST_CASE( "a single F200 can stream a variety of reasonable streaming mode combinations", "[live] [f200] [one-camera]" )
227 {
229 
230  SECTION( "exactly one device is connected" )
231  {
232  int device_count = rs_get_device_count(ctx, require_no_error());
233  REQUIRE(device_count == 1);
234  }
235 
236  rs_device * dev = rs_get_device(ctx, 0, require_no_error());
237  REQUIRE(dev != nullptr);
238 
239  SECTION( "device name is Intel RealSense F200" )
240  {
241  const char * name = rs_get_device_name(dev, require_no_error());
242  REQUIRE(name == std::string("Intel RealSense F200"));
243  }
244 
245  SECTION( "streaming is possible in some reasonable configurations" )
246  {
247  test_f200_streaming(dev, {
248  {RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60}
249  });
250 
251  test_f200_streaming(dev, {
252  {RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60},
253  {RS_STREAM_COLOR, 640, 480, RS_FORMAT_RGB8, 60}
254  });
255 
256  test_f200_streaming(dev, {
257  {RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60},
258  {RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y8, 60}
259  });
260 
261  test_f200_streaming(dev, {
262  {RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y8, 60},
263  });
264 
265  test_f200_streaming(dev, {
266  {RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60},
267  {RS_STREAM_COLOR, 640, 480, RS_FORMAT_RGB8, 60},
268  {RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y8, 60}
269  });
270  }
271 }
272 
273 #endif /* !defined(MAKEFILE) || ( defined(F200_TEST) && defined(LIVE_TEST) ) */
int rs_get_device_count(const rs_context *context, rs_error **error)
Determines number of connected devices.
Definition: rs.cpp:113
void test_f200_streaming(rs_device *device, std::initializer_list< stream_mode > modes)
GLsizei const GLchar *const * string
Definition: glext.h:683
const char * rs_get_device_name(const rs_device *device, rs_error **error)
Retrieves human-readable device model string.
Definition: rs.cpp:128
rs_option
Defines general configuration controls.
Definition: rs.h:128
float rs_get_device_depth_scale(const rs_device *device, rs_error **error)
Retrieves mapping between the units of the depth image and meters.
Definition: rs.cpp:420
void require_zero_vector(const float(&vector)[3])
int rs_get_stream_mode_count(const rs_device *device, rs_stream stream, rs_error **error)
Determines the number of streaming modes available for a given stream.
Definition: rs.cpp:190
float translation[3]
Definition: rs.h:335
TEST_CASE("F200 metadata enumerates correctly","[live] [f200]")
void rs_disable_stream(rs_device *device, rs_stream stream, rs_error **error)
Disables a specific stream.
Definition: rs.cpp:241
void rs_get_device_extrinsics(const rs_device *device, rs_stream from_stream, rs_stream to_stream, rs_extrinsics *extrin, rs_error **error)
Retrieves extrinsic transformation between the viewpoints of two different streams.
Definition: rs.cpp:163
GLuint GLuint end
Definition: glext.h:111
GLfloat f
Definition: glext.h:1868
int rs_device_supports_option(const rs_device *device, rs_option option, rs_error **error)
Determines if the device allows a specific option to be queried and set.
Definition: rs.cpp:182
void rs_enable_stream(rs_device *device, rs_stream stream, int width, int height, rs_format format, int framerate, rs_error **error)
Enables a specific stream and requests specific properties.
Definition: rs.cpp:220
void test_wait_for_frames(rs_device *device, std::initializer_list< stream_mode > &modes, std::map< rs_stream, test_duration > &duration_per_stream)
auto ctx
REQUIRE(rs_get_device_count(ctx, require_no_error())==1)
GLenum mode
Definition: glext.h:1117
void require_identity_matrix(const float(&matrix)[9])
Cross-stream extrinsics: encode the topology describing how the different devices are connected...
Definition: rs.h:332
float rotation[9]
Definition: rs.h:334
GLuint const GLchar * name
Definition: glext.h:655
rs_device * dev
rs_device * rs_get_device(rs_context *context, int index, rs_error **error)
Retrieves connected device by index.
Definition: rs.cpp:120
#define SECTION(name, description)
Definition: catch.hpp:9370
#define INFO(msg)
Definition: catch.hpp:9353
int rs_is_stream_enabled(const rs_device *device, rs_stream stream, rs_error **error)
Determines if a specific stream is enabled.
Definition: rs.cpp:249


librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Fri Mar 13 2020 03:16:18