-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
cdb3aa8
support SR306 camera
nohayassin bf122de
support SR306 camera
nohayassin 5adce15
support SR306 camera
nohayassin bc82331
SR306 demos fix
nohayassin 30f1258
SR306 demos fix
nohayassin a1286f0
SR306 demos fix
nohayassin d792c9e
SR306 demos fix
nohayassin c86a790
SR306 demo examples fixes
nohayassin 41b9a86
SR306 demo examples fixes
nohayassin 15d0ada
python examples fix to work with T265
nohayassin da17b5b
Fixed C++ and python examples
nohayassin 8f20392
demo fixes
nohayassin 3b5c2ff
fixes
nohayassin 79d01ea
benchmark fixes
nohayassin 897c6e6
ubuntu fixes
nohayassin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2021 Intel Corporation. All Rights Reserved. | ||
|
||
#pragma once | ||
#include <iostream> | ||
#include <string> | ||
#include <map> | ||
#include <librealsense2/rs.hpp> | ||
#include <algorithm> | ||
|
||
////////////////////////////// | ||
// Demos Helpers // | ||
////////////////////////////// | ||
|
||
// Find devices with specified streams | ||
bool device_with_streams(std::vector <rs2_stream> stream_requests, std::string& out_serial) | ||
{ | ||
rs2::context ctx; | ||
auto devs = ctx.query_devices(); | ||
std::vector <rs2_stream> unavailable_streams = stream_requests; | ||
for (auto dev : devs) | ||
{ | ||
std::map<rs2_stream, bool> found_streams; | ||
for (auto& type : stream_requests) | ||
{ | ||
found_streams[type] = false; | ||
for (auto& sensor : dev.query_sensors()) | ||
{ | ||
for (auto& profile : sensor.get_stream_profiles()) | ||
{ | ||
if (profile.stream_type() == type) | ||
{ | ||
found_streams[type] = true; | ||
unavailable_streams.erase(std::remove(unavailable_streams.begin(), unavailable_streams.end(), type), unavailable_streams.end()); | ||
if (dev.supports(RS2_CAMERA_INFO_SERIAL_NUMBER)) | ||
out_serial = dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER); | ||
} | ||
} | ||
} | ||
} | ||
// Check if all streams are found in current device | ||
bool found_all_streams = true; | ||
for (auto& stream : found_streams) | ||
{ | ||
if (!stream.second) | ||
{ | ||
found_all_streams = false; | ||
break; | ||
} | ||
} | ||
if (found_all_streams) | ||
return true; | ||
} | ||
// After scanning all devices, not all requested streams were found | ||
for (auto& type : unavailable_streams) | ||
{ | ||
switch (type) | ||
{ | ||
case RS2_STREAM_POSE: | ||
case RS2_STREAM_FISHEYE: | ||
std::cerr << "Connect T26X and rerun the demo" << std::endl; | ||
break; | ||
case RS2_STREAM_DEPTH: | ||
std::cerr << "The demo requires Realsense camera with DEPTH sensor" << std::endl; | ||
break; | ||
case RS2_STREAM_COLOR: | ||
std::cerr << "The demo requires Realsense camera with RGB sensor" << std::endl; | ||
break; | ||
default: | ||
throw std::runtime_error("The requested stream: " + std::to_string(type) + ", for the demo is not supported by connected devices!"); // stream type | ||
} | ||
} | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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