Пример #1
0

depth_sensor.open(dp)
depth_sensor.start(depth_frame_call_back)
color_sensor.open(cp)
color_sensor.start(color_frame_call_back)

#############################################################################################
# Test #1
test.start("Checking for frame drops in", n_cal, "calibrations")
for i in range(n_cal):
    try:
        dcs.reset_calibration()
        ccs.reset_calibration()
        d2r.trigger_device_calibration(rs.calibration_type.manual_depth_to_rgb)
        ac.wait_for_calibration()
    except:
        test.unexpected_exception()
test.finish()

#############################################################################################
# Test #2
test.start("Checking for frame drops in a failed calibration")
ac.reset_status_list()
try:
    d2r.trigger_device_calibration(rs.calibration_type.manual_depth_to_rgb)
    try:
        d2r.trigger_device_calibration(rs.calibration_type.manual_depth_to_rgb)
        ac.wait_for_calibration()
    except Exception as e:  # Second trigger should throw exception
        test.check_exception(e, RuntimeError,
Пример #2
0
dp = next(
    p for p in depth_sensor.profiles
    if p.fps() == 30 and p.stream_type() == rs.stream.depth and p.format() ==
    rs.format.z16 and p.as_video_stream_profile().width() == 1024
    and p.as_video_stream_profile().height() == 768)

depth_sensor.open(dp)
depth_sensor.start(lambda f: None)
color_sensor.open(cp)
color_sensor.start(lambda f: None)

#############################################################################################
test.start("Failing check_conditions function")
# If ambient light is RS2_DIGITAL_GAIN_LOW (2) receiver_gain must be 18
# If ambient light is RS2_DIGITAL_GAIN_HIGH (1) receiver_gain must be 9
old_receiver_gain = depth_sensor.get_option(rs.option.receiver_gain)
depth_sensor.set_option(rs.option.receiver_gain, 15)
try:
    d2r.trigger_device_calibration(rs.calibration_type.manual_depth_to_rgb)
    test.unreachable()
    ac.wait_for_calibration()
except Exception as e:
    test.check_exception(e, RuntimeError)
else:
    test.unexpected_exception()
test.check_equal_lists(ac.status_list, [rs.calibration_status.bad_conditions])
depth_sensor.set_option(rs.option.receiver_gain, old_receiver_gain)
test.finish()
#############################################################################################
test.print_results_and_exit()