Skip to content

Commit 134d609

Browse files
committed
support SR306 camera
1 parent a25bfc7 commit 134d609

File tree

13 files changed

+97
-11
lines changed

13 files changed

+97
-11
lines changed

common/fw/firmware-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
#pragma once
55

66
#define D4XX_RECOMMENDED_FIRMWARE_VERSION "5.12.12.100"
7-
#define SR3XX_RECOMMENDED_FIRMWARE_VERSION "3.26.1.0"
7+
#define SR305_RECOMMENDED_FIRMWARE_VERSION "3.26.1.0"
88
#define T26X_FIRMWARE_VERSION "0.2.0.951"
99
#define L5XX_RECOMMENDED_FIRMWARE_VERSION "1.5.5.0"

examples/align/rs-align.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ void render_slider(rect location, float* alpha, direction* dir);
3333

3434
int main(int argc, char * argv[]) try
3535
{
36+
auto serial = depth_with_stream_type_present(RS2_STREAM_COLOR);
37+
if (serial.empty())
38+
{
39+
std::cerr << "The demo requires Realsense Depth camera with RGB sensor";
40+
return EXIT_SUCCESS;;
41+
}
42+
3643
// Create and initialize GUI related objects
3744
window app(1280, 720, "RealSense Align Example"); // Simple window handling
3845
ImGui_ImplGlfw_Init(app, false); // ImGui library intializition
@@ -42,6 +49,7 @@ int main(int argc, char * argv[]) try
4249
// Create a pipeline to easily configure and start the camera
4350
rs2::pipeline pipe;
4451
rs2::config cfg;
52+
cfg.enable_device(serial);
4553
cfg.enable_stream(RS2_STREAM_DEPTH);
4654
cfg.enable_stream(RS2_STREAM_COLOR);
4755
pipe.start(cfg);

examples/ar-advanced/rs-ar-advanced.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ std::vector<uint8_t> bytes_from_raw_file(const std::string& filename);
5454

5555
int main(int argc, char * argv[]) try
5656
{
57+
auto serial = depth_with_stream_type_present(RS2_STREAM_POSE);
58+
if (serial.empty())
59+
{
60+
std::cerr << "The demo requires Realsense Depth camera with POSE sensor";
61+
return EXIT_SUCCESS;;
62+
}
5763
std::string out_map_filepath, in_map_filepath, default_filepath = "map.raw";
5864
for (int c = 1; c < argc; ++c) {
5965
if (!std::strcmp(argv[c], "-m") || !std::strcmp(argv[c], "--load_map")) {
@@ -76,6 +82,7 @@ int main(int argc, char * argv[]) try
7682
rs2::pipeline pipe;
7783
// Create a configuration for configuring the pipeline with a non default profile
7884
rs2::config cfg;
85+
cfg.enable_device(serial);
7986
// Enable fisheye and pose streams
8087
cfg.enable_stream(RS2_STREAM_POSE, RS2_FORMAT_6DOF);
8188
cfg.enable_stream(RS2_STREAM_FISHEYE, 1);

examples/example.hpp

+18
Original file line numberDiff line numberDiff line change
@@ -1070,3 +1070,21 @@ void register_glfw_callbacks(window& app, glfw_state& app_state)
10701070
}
10711071
};
10721072
}
1073+
1074+
// Find devices with specified streams
1075+
std::string depth_with_stream_type_present(rs2_stream type)
1076+
{
1077+
rs2::context ctx;
1078+
for (auto dev : ctx.query_devices(RS2_PRODUCT_LINE_DEPTH))
1079+
{
1080+
for (auto sensor : dev.query_sensors())
1081+
{
1082+
for (auto profile : sensor.get_stream_profiles())
1083+
{
1084+
if (profile.stream_type() == type)
1085+
return dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER);
1086+
}
1087+
}
1088+
}
1089+
return "";
1090+
}

examples/measure/rs-measure.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ void render_simple_distance(const rs2::depth_frame& depth,
9999

100100
int main(int argc, char * argv[]) try
101101
{
102+
auto serial = depth_with_stream_type_present(RS2_STREAM_COLOR);
103+
if (serial.empty())
104+
{
105+
std::cerr << "The demo requires Realsense Depth camera with RGB sensor";
106+
return EXIT_SUCCESS;;
107+
}
108+
102109
// OpenGL textures for the color and depth frames
103110
texture depth_image, color_image;
104111

@@ -133,6 +140,7 @@ int main(int argc, char * argv[]) try
133140
rs2::pipeline pipe;
134141

135142
rs2::config cfg;
143+
cfg.enable_device(serial);
136144
cfg.enable_stream(RS2_STREAM_DEPTH); // Enable default depth
137145
// For the color stream, set format to RGBA
138146
// To allow blending of the color frame on top of the depth frame

examples/pose-and-image/rs-pose-and-image.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@
66
#include <chrono>
77
#include <thread>
88
#include <mutex>
9+
#include "../example.hpp"
910

1011
int main(int argc, char * argv[]) try
1112
{
13+
auto serial = depth_with_stream_type_present(RS2_STREAM_POSE);
14+
if (serial.empty())
15+
{
16+
std::cerr << "The demo requires Realsense Depth camera with POSE sensor";
17+
return EXIT_SUCCESS;;
18+
}
1219
// Declare RealSense pipeline, encapsulating the actual device and sensors
1320
rs2::pipeline pipe;
1421
// Create a configuration for configuring the pipeline with a non default profile

examples/pose-predict/rs-pose-predict.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <math.h>
1111
#include <float.h>
12+
#include "../example.hpp"
1213

1314
inline rs2_quaternion quaternion_exp(rs2_vector v)
1415
{
@@ -46,6 +47,13 @@ rs2_pose predict_pose(rs2_pose & pose, float dt_s)
4647

4748
int main(int argc, char * argv[]) try
4849
{
50+
auto serial = depth_with_stream_type_present(RS2_STREAM_POSE);
51+
if (serial.empty())
52+
{
53+
std::cerr << "The demo requires Realsense Depth camera with POSE sensor";
54+
return EXIT_SUCCESS;;
55+
}
56+
4957
// Declare RealSense pipeline, encapsulating the actual device and sensors
5058
rs2::pipeline pipe;
5159
// Create a configuration for configuring the pipeline with a non default profile

examples/pose/rs-pose.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
#include <librealsense2/rs.hpp>
44
#include <iostream>
55
#include <iomanip>
6+
#include "../example.hpp"
67

78
int main(int argc, char * argv[]) try
89
{
10+
auto serial = depth_with_stream_type_present(RS2_STREAM_POSE);
11+
if (serial.empty())
12+
{
13+
std::cerr << "The demo requires Realsense Depth camera with POSE sensor";
14+
return EXIT_SUCCESS;;
15+
}
16+
917
// Declare RealSense pipeline, encapsulating the actual device and sensors
1018
rs2::pipeline pipe;
1119
// Create a configuration for configuring the pipeline with a non default profile

examples/trajectory/rs-trajectory.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,13 @@ class split_screen_renderer
439439
// In this example, we show how to track the camera's motion using a T265 device
440440
int main(int argc, char * argv[]) try
441441
{
442+
auto serial = depth_with_stream_type_present(RS2_STREAM_POSE);
443+
if (serial.empty())
444+
{
445+
std::cerr << "The demo requires Realsense Depth camera with POSE sensor";
446+
return EXIT_SUCCESS;;
447+
}
448+
442449
// Initialize window for rendering
443450
window app(1280, 720, "RealSense Trajectory Example");
444451

src/ivcam/sr300.cpp

+6-10
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,18 @@ namespace librealsense
9191
return results;
9292
}
9393
}
94-
9594
if (mi_present(group, 2))
9695
{
9796
depth = get_mi(group, 2);
9897
chosen.push_back(depth);
9998
}
99+
if (!depth.pid) // SR306 : only mi=0 is defined
100+
std::swap(color, depth);
101+
auto info = std::make_shared<sr300_info>(ctx, color, depth, hwm);
102+
results.push_back(info);
100103

101104
if (!color.pid && !depth.pid)
102105
LOG_WARNING("SR300 group_devices is empty.");
103-
else
104-
{
105-
if (!depth.pid) // SR306 : only mi=0 is defined
106-
std::swap(color, depth);
107-
auto info = std::make_shared<sr300_info>(ctx, color, depth, hwm);
108-
results.push_back(info);
109-
}
110106
}
111107

112108
trim_device_list(uvc, chosen);
@@ -534,9 +530,9 @@ namespace librealsense
534530
device(ctx, group, register_device_notifications) {
535531

536532
static auto device_name = "Intel RealSense SR305";
537-
//auto recommended_fw_version = firmware_version(SR3XX_RECOMMENDED_FIRMWARE_VERSION);
533+
auto recommended_fw_version = firmware_version(SR305_RECOMMENDED_FIRMWARE_VERSION);
538534
update_info(RS2_CAMERA_INFO_NAME, device_name);
539-
//register_info(RS2_CAMERA_INFO_RECOMMENDED_FIRMWARE_VERSION, recommended_fw_version);
535+
register_info(RS2_CAMERA_INFO_RECOMMENDED_FIRMWARE_VERSION, recommended_fw_version);
540536

541537
roi_sensor_interface* roi_sensor;
542538
if ((roi_sensor = dynamic_cast<roi_sensor_interface*>(&get_sensor(_color_device_idx))))

wrappers/python/examples/align-depth2color.py

+5
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@
2020
config = rs.config()
2121

2222
# Get device product line for setting a supporting resolution
23+
# And product id to skip SR306
2324
pipeline_wrapper = rs.pipeline_wrapper(pipeline)
2425
pipeline_profile = config.resolve(pipeline_wrapper)
2526
device = pipeline_profile.get_device()
2627
device_product_line = str(device.get_info(rs.camera_info.product_line))
28+
device_product_id = str(device.get_info(rs.camera_info.product_id))
29+
if device_product_id == "0AA3":
30+
print("The connected device does not support RGB stream")
31+
exit(0)
2732

2833
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
2934

wrappers/python/examples/opencv_pointcloud_viewer.py

+9
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ def pivot(self):
6767
pipeline = rs.pipeline()
6868
config = rs.config()
6969

70+
# Get device product id to skip SR306
71+
pipeline_wrapper = rs.pipeline_wrapper(pipeline)
72+
pipeline_profile = config.resolve(pipeline_wrapper)
73+
device = pipeline_profile.get_device()
74+
device_product_id = str(device.get_info(rs.camera_info.product_id))
75+
if device_product_id == "0AA3":
76+
print("The connected device does not support RGB stream")
77+
exit(0)
78+
7079
config.enable_stream(rs.stream.depth, rs.format.z16, 30)
7180
config.enable_stream(rs.stream.color, rs.format.bgr8, 30)
7281

wrappers/python/examples/opencv_viewer_example.py

+5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@
1414
config = rs.config()
1515

1616
# Get device product line for setting a supporting resolution
17+
# And product id to skip SR306
1718
pipeline_wrapper = rs.pipeline_wrapper(pipeline)
1819
pipeline_profile = config.resolve(pipeline_wrapper)
1920
device = pipeline_profile.get_device()
2021
device_product_line = str(device.get_info(rs.camera_info.product_line))
22+
device_product_id = str(device.get_info(rs.camera_info.product_id))
23+
if device_product_id == "0AA3":
24+
print("The connected device does not support RGB stream")
25+
exit(0)
2126

2227
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
2328

0 commit comments

Comments
 (0)