8 #if !defined(MAKEFILE) || ( defined(LIVE_TEST) && defined(ZR300_TEST) ) 50 TEST_CASE(
"ZR300 devices support all required options",
"[live] [DS-device]")
58 for (
int i = 0; i<device_count; ++i)
66 SECTION(
"ZR300 supports DS-Line standard UVC controls and ZR300 Motion Module controls, and nothing else")
68 const int supported_options[] = {
118 if (std::find(std::begin(supported_options),
std::end(supported_options), i) !=
std::end(supported_options))
131 TEST_CASE(
"ZR300 Motion Module Data Streaming Validation",
"[live] [DS-device]")
146 unsigned int active_period_ms = 5000;
147 const unsigned int gyro_bandwidth_fps = 200;
148 const unsigned int accel_bandwidth_fps = 250;
149 const double allowed_deviation = 0.03;
150 const int video_fps = 60;
152 for (
int ii = 0; ii < 2; ii++)
154 INFO(
"Iteration num " << ii + 1 <<
" has started ");
178 std::this_thread::sleep_for(std::chrono::milliseconds(active_period_ms));
191 INFO(
gyro_frames.size() <<
" Gyro packets received over " << active_period_ms*0.001 <<
"sec sampling");
210 for (
size_t i = 0; i < (
gyro_frames.size() - 1); i++)
223 std::vector<unsigned long long> gyro_frame_numbers, accel_frame_numbers, fisheye_frame_numbers, depth_cam_frame_numbers;
224 std::vector<unsigned long long> gyro_adjacent_diff, accel_adjacent_diff, fisheye_adjacent_diff, depth_adjacent_diff;
227 for (
size_t i = 0; i <
gyro_frames.size(); i++) gyro_frame_numbers.push_back(
gyro_frames[i].timestamp_data.frame_number);
228 for (
size_t i = 0; i <
accel_frames.size(); i++) accel_frame_numbers.push_back(
accel_frames[i].timestamp_data.frame_number);
232 gyro_adjacent_diff.resize(gyro_frame_numbers.size());
233 accel_adjacent_diff.resize(accel_frame_numbers.size());
234 fisheye_adjacent_diff.resize(fisheye_frame_numbers.size());
235 depth_adjacent_diff.resize(depth_cam_frame_numbers.size());
237 std::adjacent_difference(gyro_frame_numbers.begin(), gyro_frame_numbers.end(), gyro_adjacent_diff.begin());
238 std::adjacent_difference(accel_frame_numbers.begin(), accel_frame_numbers.end(), accel_adjacent_diff.begin());
239 std::adjacent_difference(fisheye_frame_numbers.begin(), fisheye_frame_numbers.end(), fisheye_adjacent_diff.begin());
240 std::adjacent_difference(depth_cam_frame_numbers.begin(), depth_cam_frame_numbers.end(), depth_adjacent_diff.begin());
242 accel_adjacent_diff[0] = gyro_adjacent_diff[0] = fisheye_adjacent_diff[0] = depth_adjacent_diff[0] = 1;
244 std::vector<unsigned int> gyro_frame_diff_bins, accel_frame_diff_bins, fisheye_frame_bins, depth_cam_frames_bins;
245 const uint32_t max_frame_diff_allowed = 100;
246 gyro_frame_diff_bins.resize(max_frame_diff_allowed);
247 accel_frame_diff_bins.resize(max_frame_diff_allowed);
248 fisheye_frame_bins.resize(max_frame_diff_allowed);
249 depth_cam_frames_bins.resize(max_frame_diff_allowed);
252 std::for_each(gyro_adjacent_diff.begin(), gyro_adjacent_diff.end(), [max_frame_diff_allowed, &gyro_frame_diff_bins](
unsigned long n)
253 {
REQUIRE(
n < max_frame_diff_allowed); gyro_frame_diff_bins[
n]++; });
254 std::for_each(accel_adjacent_diff.begin(), accel_adjacent_diff.end(), [max_frame_diff_allowed, &accel_frame_diff_bins](
unsigned long n)
255 {
REQUIRE(
n < max_frame_diff_allowed); accel_frame_diff_bins[
n]++; });
256 std::for_each(fisheye_adjacent_diff.begin(), fisheye_adjacent_diff.end(), [max_frame_diff_allowed, &fisheye_frame_bins](
unsigned long n)
257 {
REQUIRE(
n < max_frame_diff_allowed); fisheye_frame_bins[
n]++; });
258 std::for_each(depth_adjacent_diff.begin(), depth_adjacent_diff.end(), [max_frame_diff_allowed, &depth_cam_frames_bins](
unsigned long n)
259 {
REQUIRE(
n < max_frame_diff_allowed); depth_cam_frames_bins[
n]++; });
262 INFO(
" gyro frame num differences: ");
263 for (
size_t i = 0; i < gyro_frame_diff_bins.size(); i++)
if (gyro_frame_diff_bins[i])
INFO(
"[" << i <<
" = " << gyro_frame_diff_bins[i] <<
"], ");
264 INFO(
" accel frame num differences: ");
265 for (
size_t i = 0; i < accel_frame_diff_bins.size(); i++)
if (accel_frame_diff_bins[i])
INFO(
"[" << i <<
" = " << accel_frame_diff_bins[i] <<
"], ");
266 INFO(
" fisheye frame num differences: ");
267 for (
size_t i = 0; i < fisheye_frame_bins.size(); i++)
if (fisheye_frame_bins[i])
INFO(
"[" << i <<
" = " << fisheye_frame_bins[i] <<
"], ");
268 INFO(
" depth frame num differences: ");
269 for (
size_t i = 0; i < depth_cam_frames_bins.size(); i++)
if (depth_cam_frames_bins[i])
INFO(
"[" << i <<
" = " << depth_cam_frames_bins[i] <<
"], ");
272 double gyro_consecutive_frames_percentage = gyro_frame_diff_bins[1] / (double)
gyro_frames.size() * 100;
273 double accel_consecutive_frames_percentage = accel_frame_diff_bins[1] / (double)
accel_frames.size() * 100;
274 double fisheye_consecutive_frames_percentage = fisheye_frame_bins[1] / (double)
fisheye_timestamp_events.size() * 100;
275 double depth_consecutive_frames_percentage = depth_cam_frames_bins[1] / (double)
depth_timestamp_events.size() * 100;
277 INFO(
"Gyro frames- consecutive frames " << gyro_frame_diff_bins[1] <<
" out of " <<
gyro_frames.size() <<
", consistency rate:" << gyro_consecutive_frames_percentage <<
"% \n" 278 <<
"Accel frames- consecutive frames " << accel_frame_diff_bins[1] <<
" out of " <<
accel_frames.size() <<
", consistency rate:" << accel_consecutive_frames_percentage <<
"% \n" 279 <<
"Fisheye frames- consecutive frames " << fisheye_frame_bins[1] <<
" out of " <<
fisheye_timestamp_events.size() <<
", consistency rate:" << fisheye_consecutive_frames_percentage <<
"% \n" 280 <<
"Depth frames- consecutive frames " << depth_cam_frames_bins[1] <<
" out of " <<
depth_timestamp_events.size() <<
", consistency rate:" << depth_consecutive_frames_percentage <<
"% \n");
285 TEST_CASE(
"ZR300 correctly recognizes invalid options",
"[live] [DS-device]")
293 const char *
name = dev->get_name();
305 dev->set_options(&opt,1, &val);
314 TEST_CASE(
"Test ZR300 streaming mode combinations",
"[live] [ZR300] [one-camera]" )
318 SECTION(
"exactly one device is connected" )
327 SECTION(
"device name is Intel RealSense ZR300" )
333 SECTION(
"streaming with some configurations" )
Provides convenience methods relating to devices.
TEST_CASE("ZR300 devices support all required options","[live] [DS-device]")
int rs_supports(rs_device *device, rs_capabilities capability, rs_error **error)
Determines device capabilities.
void rs_start_source(rs_device *device, rs_source source, rs_error **error)
Begins streaming on all enabled streams for this device.
void rs_disable_motion_tracking(rs_device *device, rs_error **error)
Disables motion-tracking handlers.
int rs_get_device_count(const rs_context *context, rs_error **error)
Determines number of connected devices.
static std::vector< rs::motion_data > gyro_frames
GLsizei const GLchar *const * string
Motion data from gyroscope and accelerometer from the microcontroller.
void rs_set_device_option(rs_device *device, rs_option option, double value, rs_error **error)
Sets the current value of a single option.
Exposes librealsense functionality for C++ compilers.
const char * rs_get_device_name(const rs_device *device, rs_error **error)
Retrieves human-readable device model string.
rs_option
Defines general configuration controls.
option
Defines general configuration controls.
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.
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
void test_streaming(rs_device *device, std::initializer_list< stream_mode > modes)
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.
void rs_stop_source(rs_device *device, rs_source source, rs_error **error)
Ends data acquisition for the specified source providers.
static std::vector< rs::timestamp_data > fisheye_timestamp_events
GLuint const GLchar * name
static std::vector< rs::motion_data > accel_frames
rs_device * rs_get_device(rs_context *context, int index, rs_error **error)
Retrieves connected device by index.
#define SECTION(name, description)
static std::vector< rs::timestamp_data > depth_timestamp_events
device * get_device(int index)
Timestamp data from the motion microcontroller.
int get_device_count() const
Approx & epsilon(double newEpsilon)
static const std::vector< std::string > ds_names
void rs_enable_motion_tracking_cpp(rs_device *device, rs_motion_callback *motion_callback, rs_timestamp_callback *timestamp_callback, rs_error **error)
Enables and configures motion-tracking data handlers.