9 import pyrealsense2
as rs
13 DS5_product_ids = [
"0AD1",
"0AD2",
"0AD3",
"0AD4",
"0AD5",
"0AF6",
"0AFE",
"0AFF",
"0B00",
"0B01",
"0B03",
"0B07",
"0B3A",
"0B5C"]
18 devices = ctx.query_devices();
20 if dev.supports(rs.camera_info.product_id)
and str(dev.get_info(rs.camera_info.product_id))
in DS5_product_ids:
21 if dev.supports(rs.camera_info.name):
22 print(
"Found device that supports advanced mode:", dev.get_info(rs.camera_info.name))
24 raise Exception(
"No D400 product line device that supports advanced mode was found")
28 advnc_mode = rs.rs400_advanced_mode(dev)
29 print(
"Advanced mode is",
"enabled" if advnc_mode.is_enabled()
else "disabled")
32 while not advnc_mode.is_enabled():
33 print(
"Trying to enable advanced mode...")
34 advnc_mode.toggle_advanced_mode(
True)
36 print(
"Sleeping for 5 seconds...")
40 advnc_mode = rs.rs400_advanced_mode(dev)
41 print(
"Advanced mode is",
"enabled" if advnc_mode.is_enabled()
else "disabled")
44 print(
"Depth Control: \n", advnc_mode.get_depth_control())
45 print(
"RSM: \n", advnc_mode.get_rsm())
46 print(
"RAU Support Vector Control: \n", advnc_mode.get_rau_support_vector_control())
47 print(
"Color Control: \n", advnc_mode.get_color_control())
48 print(
"RAU Thresholds Control: \n", advnc_mode.get_rau_thresholds_control())
49 print(
"SLO Color Thresholds Control: \n", advnc_mode.get_slo_color_thresholds_control())
50 print(
"SLO Penalty Control: \n", advnc_mode.get_slo_penalty_control())
51 print(
"HDAD: \n", advnc_mode.get_hdad())
52 print(
"Color Correction: \n", advnc_mode.get_color_correction())
53 print(
"Depth Table: \n", advnc_mode.get_depth_table())
54 print(
"Auto Exposure Control: \n", advnc_mode.get_ae_control())
55 print(
"Census: \n", advnc_mode.get_census())
58 query_min_values_mode = 1
59 query_max_values_mode = 2
60 current_std_depth_control_group = advnc_mode.get_depth_control()
61 min_std_depth_control_group = advnc_mode.get_depth_control(query_min_values_mode)
62 max_std_depth_control_group = advnc_mode.get_depth_control(query_max_values_mode)
63 print(
"Depth Control Min Values: \n ", min_std_depth_control_group)
64 print(
"Depth Control Max Values: \n ", max_std_depth_control_group)
67 current_std_depth_control_group.scoreThreshA = int((max_std_depth_control_group.scoreThreshA - min_std_depth_control_group.scoreThreshA) / 2)
68 advnc_mode.set_depth_control(current_std_depth_control_group)
69 print(
"After Setting new value, Depth Control: \n", advnc_mode.get_depth_control())
72 serialized_string = advnc_mode.serialize_json()
73 print(
"Controls as JSON: \n", serialized_string)
74 as_json_object = json.loads(serialized_string)
78 if type(
next(iter(as_json_object))) != str:
79 as_json_object = {k.encode(
'utf-8'): v.encode(
"utf-8")
for k, v
in as_json_object.items()}
82 json_string =
str(as_json_object).replace(
"'",
'\"')
83 advnc_mode.load_json(json_string)
85 except Exception
as e:
def find_device_that_supports_advanced_mode()
static std::string print(const transformation &tf)
void next(auto_any_t cur, type2type< T, C > *)