-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabling LRS examples/tutorials on SR306 #8749
Conversation
383a508
to
134d609
Compare
examples/example.hpp
Outdated
@@ -1082,9 +1082,8 @@ std::string depth_with_stream_type_present(rs2_stream type) | |||
for (auto profile : sensor.get_stream_profiles()) | |||
{ | |||
if (profile.stream_type() == type) | |||
return dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER); | |||
out_serial = dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check for dev.supports(RS2_CAMERA_INFO_SERIAL_NUMBER)
before the attribute query
examples/example.hpp
Outdated
} | ||
} | ||
} | ||
if (out_serial.empty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the flow will select device even if not all the required streams are supported.
Please check and refactor accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still applies
examples/example.hpp
Outdated
for (auto type : types) | ||
{ | ||
bool stream_found = false; | ||
for (auto dev : ctx.query_devices()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use auto&
here and below
examples/measure/rs-measure.cpp
Outdated
types.push_back(RS2_STREAM_COLOR); | ||
types.push_back(RS2_STREAM_DEPTH); | ||
if (!device_with_streams(types, serial)) | ||
if (!device_with_streams({ RS2_STREAM_POSE,RS2_STREAM_FISHEYE }, serial)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request Depth +RGB
examples/example.hpp
Outdated
{ | ||
bool stream_found = false; | ||
for (auto dev : ctx.query_devices()) | ||
for (auto& dev : devs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check must be reset between iterations and counted per device to avoid false positives
examples/example.hpp
Outdated
std::cerr << "Connect T26X and rerun the demo"; | ||
return false; | ||
case RS2_STREAM_DEPTH: | ||
case RS2_STREAM_COLOR: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be handled as two separate entities
examples/example.hpp
Outdated
std::cerr << "The demo requires Realsense camera with DEPTH and RGB sensors"; | ||
return false; | ||
default: | ||
throw std::runtime_error("The requested stream: " + std::to_string(type) + ", is not supported by this demo!"); // stream type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is not supported by this demo! " for the demo is not supported by connected devices"
examples/example.hpp
Outdated
{ | ||
for (auto profile : sensor.get_stream_profiles()) | ||
for (auto& profile : sensor.get_stream_profiles()) | ||
{ | ||
if (profile.stream_type() == type && dev.supports(RS2_CAMERA_INFO_SERIAL_NUMBER)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the && dev.supports(RS2_CAMERA_INFO_SERIAL_NUMBER)
within the clause, as discussed
@@ -137,7 +137,8 @@ int main(int argc, char * argv[]) try | |||
rs2::pipeline pipe; | |||
|
|||
rs2::config cfg; | |||
cfg.enable_device(serial); | |||
if (!serial.empty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the Pose/FE demos needs to be retested with T265
try: | ||
next(s for s in sensorsList if s.get_info(rs.camera_info.name) == 'RGB Camera') | ||
except Exception as e: | ||
print("The connected device does not support RGB stream") | ||
exit(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace try/catch
with check routine in python similar to C++ examples. Here and in the next two demos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need more clarification here:
- There is no common file for python examples where I can put the check method and I don't think creating a common file especially for that is reasonable. What do you suggest ?
- Should the method be exactly as in C++ (checking serial etc ) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor remark for python part
@@ -12,19 +12,27 @@ | |||
# Import OpenCV for easy image rendering | |||
import cv2 | |||
|
|||
context = rs.context() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it used?
@@ -30,7 +30,7 @@ | |||
import cv2 | |||
import numpy as np | |||
import pyrealsense2 as rs | |||
|
|||
context = rs.context() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
@@ -12,13 +12,23 @@ | |||
# Configure depth and color streams | |||
pipeline = rs.pipeline() | |||
config = rs.config() | |||
context = rs.context() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
examples/align/rs-align.cpp
Outdated
@@ -3,6 +3,7 @@ | |||
|
|||
#include <librealsense2/rs.hpp> | |||
#include "example-imgui.hpp" | |||
#include "../examples/example-utils.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor so that examples-utils.hpp
is listed in examples.hpp
so the change will be transparent to the users of the latter
Drop relative path and use local notation "examples-utils.hpp"
tools/benchmark/rs-benchmark.cpp
Outdated
@@ -206,6 +207,10 @@ class gl_blocks : public suite | |||
|
|||
int main(int argc, char** argv) try | |||
{ | |||
std::string serial; | |||
if (!device_with_streams({ RS2_STREAM_COLOR,RS2_STREAM_DEPTH }, serial)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make the demo utilize IR stream if color is not present.
test flow-
- Depth stream - must
2 . Color or Infrared stream (2nd priority) - must
found_rgb = True | ||
break | ||
if not found_rgb: | ||
print("The connected device does not support RGB stream") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The connected device does not support RGB stream - " The demo requires Depth camera with Color sensor".
@@ -6,13 +6,20 @@ | |||
#include <chrono> | |||
#include <thread> | |||
#include <mutex> | |||
#include "example.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace with example-utils.hpp
@@ -9,6 +9,7 @@ | |||
|
|||
#include <math.h> | |||
#include <float.h> | |||
#include "example.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
examples/pose/rs-pose.cpp
Outdated
@@ -3,13 +3,20 @@ | |||
#include <librealsense2/rs.hpp> | |||
#include <iostream> | |||
#include <iomanip> | |||
#include "example.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
tools/benchmark/rs-benchmark.cpp
Outdated
second_stream = ir_stream; | ||
else | ||
{ | ||
std::cout<< " Connect a device that supports either RGB stream or Infrared stream." <<std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~~ a device~~ Depth Camera ... RGB stream or Infrared streams
@@ -14,17 +14,24 @@ | |||
|
|||
# Create a pipeline | |||
pipeline = rs.pipeline() | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
# Create a config and configure the pipeline to stream | ||
# different resolutions of color and depth streams | ||
config = rs.config() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor fix in rs-benchmark
0f74d33
to
e18e01c
Compare
e18e01c
to
79d01ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved
Track on: DSO-16721