Enabling LRS examples/tutorials on SR306 - #8749
Conversation
383a508 to
134d609
Compare
| { | ||
| 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.
Check for dev.supports(RS2_CAMERA_INFO_SERIAL_NUMBER) before the attribute query
| } | ||
| } | ||
| } | ||
| if (out_serial.empty()) |
There was a problem hiding this comment.
I think the flow will select device even if not all the required streams are supported.
Please check and refactor accordingly
| for (auto type : types) | ||
| { | ||
| bool stream_found = false; | ||
| for (auto dev : ctx.query_devices()) |
| 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)) |
| { | ||
| bool stream_found = false; | ||
| for (auto dev : ctx.query_devices()) | ||
| for (auto& dev : devs) |
There was a problem hiding this comment.
The check must be reset between iterations and counted per device to avoid false positives
| 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.
Should be handled as two separate entities
| 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.
is not supported by this demo! " for the demo is not supported by connected devices"
| 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.
Move the && dev.supports(RS2_CAMERA_INFO_SERIAL_NUMBER) within the clause, as discussed
|
|
||
| rs2::config cfg; | ||
| cfg.enable_device(serial); | ||
| if (!serial.empty()) |
There was a problem hiding this comment.
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.
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.
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 ) ?
ev-mp
left a comment
There was a problem hiding this comment.
A minor remark for python part
| # Import OpenCV for easy image rendering | ||
| import cv2 | ||
|
|
||
| context = rs.context() |
| import numpy as np | ||
| import pyrealsense2 as rs | ||
|
|
||
| context = rs.context() |
| # Configure depth and color streams | ||
| pipeline = rs.pipeline() | ||
| config = rs.config() | ||
| context = rs.context() |
|
|
||
| #include <librealsense2/rs.hpp> | ||
| #include "example-imgui.hpp" | ||
| #include "../examples/example-utils.hpp" |
There was a problem hiding this comment.
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"
| 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.
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.
The connected device does not support RGB stream - " The demo requires Depth camera with Color sensor".
| #include <chrono> | ||
| #include <thread> | ||
| #include <mutex> | ||
| #include "example.hpp" |
There was a problem hiding this comment.
replace with example-utils.hpp
|
|
||
| #include <math.h> | ||
| #include <float.h> | ||
| #include "example.hpp" |
| #include <librealsense2/rs.hpp> | ||
| #include <iostream> | ||
| #include <iomanip> | ||
| #include "example.hpp" |
| 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.
~~ a device~~ Depth Camera ... RGB stream or Infrared streams
|
|
||
| # Create a pipeline | ||
| pipeline = rs.pipeline() | ||
|
|
| # Create a config and configure the pipeline to stream | ||
| # different resolutions of color and depth streams | ||
| config = rs.config() | ||
|
|
0f74d33 to
e18e01c
Compare
e18e01c to
79d01ea
Compare
Track on: DSO-16721