Skip to content

Commit 383a508

Browse files
committed
support SR306 camera
1 parent 7dc5666 commit 383a508

21 files changed

+209
-185
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"

common/model-views.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3818,7 +3818,7 @@ namespace rs2
38183818
auto s = std::make_shared<sensor>(sub);
38193819
auto objects = std::make_shared< atomic_objects_in_frame >();
38203820
// checking if the sensor is color_sensor or is D405 (with integrated RGB in depth sensor)
3821-
if (s->is<color_sensor>() || !strcmp(dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID), "0B5B"))
3821+
if (s->is<color_sensor>() || (dev.supports(RS2_CAMERA_INFO_PRODUCT_ID) && !strcmp(dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID), "0B5B")))
38223822
objects = _detected_objects;
38233823
auto model = std::make_shared<subdevice_model>(dev, std::make_shared<sensor>(sub), objects, error_message, viewer, new_device_connected);
38243824
subdevices.push_back(model);

config/99-realsense-libusb.rules

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b0d", MODE:="066
2626
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3a", MODE:="0666", GROUP:="plugdev"
2727
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3d", MODE:="0666", GROUP:="plugdev"
2828
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b48", MODE:="0666", GROUP:="plugdev"
29+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0aa3", MODE:="0666", GROUP:="plugdev"
2930
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b49", MODE:="0666", GROUP:="plugdev"
3031
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4b", MODE:="0666", GROUP:="plugdev"
3132
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4d", MODE:="0666", GROUP:="plugdev"

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/context.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,6 @@ namespace librealsense
348348

349349
if (mask & RS2_PRODUCT_LINE_SR300)
350350
{
351-
// first create depth device
352-
auto sr300_depth_devices = sr300_depth_info::pick_sr300_devices(ctx, devices.uvc_devices, devices.usb_devices);
353-
std::copy(begin(sr300_depth_devices), end(sr300_depth_devices), std::back_inserter(list));
354-
355-
// if sr300_depth_devices are found then no sr300_devices will be available
356351
auto sr300_devices = sr300_info::pick_sr300_devices(ctx, devices.uvc_devices, devices.usb_devices);
357352
std::copy(begin(sr300_devices), end(sr300_devices), std::back_inserter(list));
358353
}

src/ivcam/ivcam-private.cpp

+1-22
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,11 @@ namespace librealsense
1313
{
1414
for (auto it = devices.begin(); it != devices.end(); ++it)
1515
{
16-
auto pid = it->pid;
1716
if (it->unique_id == info.unique_id)
1817
{
1918

2019
result = *it;
21-
if (result.mi == 4)
22-
{
23-
devices.erase(it);
24-
return true;
25-
}
26-
}
27-
}
28-
return false;
29-
}
30-
31-
bool try_fetch_usb_depth_device(std::vector<platform::usb_device_info>& devices,
32-
const platform::uvc_device_info& info, platform::usb_device_info& result)
33-
{
34-
for (auto it = devices.begin(); it != devices.end(); ++it)
35-
{
36-
auto pid = it->pid;
37-
if (it->unique_id == info.unique_id)
38-
{
39-
40-
result = *it;
41-
if ((pid == 0x0B48 &&result.mi == 4) || (pid == 0x0aa3 && result.mi == 2))
20+
if(result.mi == 4 || result.mi == 2)
4221
{
4322
devices.erase(it);
4423
return true;

src/ivcam/ivcam-private.h

-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ namespace librealsense {
111111
};
112112
bool try_fetch_usb_device(std::vector<platform::usb_device_info>& devices,
113113
const platform::uvc_device_info& info, platform::usb_device_info& result);
114-
bool try_fetch_usb_depth_device(std::vector<platform::usb_device_info>& devices,
115-
const platform::uvc_device_info& info, platform::usb_device_info& result);
116114

117115
} // librealsense::ivcam
118116
} // namespace librealsense

0 commit comments

Comments
 (0)