-
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
Get Sensor from frame #3933
Get Sensor from frame #3933
Conversation
…, frame::get_sensor(), sensor_from_frame() for C++ interface and Frame::Sensor for C# interface. Add demo usage in rs-data-collect and cs-tutorial-2-capture.
@doronhi - I think you either forgot to |
@@ -124,7 +124,7 @@ void data_collector::save_data_to_file(const string& out_filename) | |||
|
|||
for (const auto& elem : data_collection) | |||
{ | |||
csv << "\n\nStream Type,Index,F#,HW Timestamp (ms),Host Timestamp(ms)" | |||
csv << "\n\nStream Type,Index,F#,HW Timestamp (ms),Host Timestamp(ms), SerialNumber" |
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 SerialNumber
attribute to be moved into the header (Lines 121-123 : csv << get_profile_description(elem);)
add unit-test "get_sensor_from_frame"
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 asked for some changes to cover certain corner cases.
Also - pls check with SR300 and T265 live
unit-tests/unit-tests-live.cpp
Outdated
{ | ||
// Require at least one device to be plugged in | ||
rs2::context ctx; | ||
if (make_context(SECTION_FROM_TEST_NAME, &ctx, "2.13.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.
Fix the minimal required version to be 2.22.0
unit-tests/unit-tests-live.cpp
Outdated
for (auto i = 0; i < 5; i++) | ||
{ | ||
rs2::frameset data = pipe.wait_for_frames(); // Wait for next set of frames from the camera | ||
auto frame = data.get_color_frame(); |
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.
This will fail for sensors w/o color stream. Replace by iterating over all the received frames and making sure all refer to the same S.N
auto frame = data.get_color_frame(); | ||
std::string frame_serail_no = sensor_from_frame(frame)->get_info(RS2_CAMERA_INFO_SERIAL_NUMBER); | ||
REQUIRE(dev_serial_no == frame_serail_no); | ||
} |
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.
Put a TODO placeholder to check some actual sensor's attributes - > e.g comparing the profile
unit-tests/unit-tests-live.cpp
Outdated
{ | ||
rs2::frameset data = pipe.wait_for_frames(); // Wait for next set of frames from the camera | ||
auto frame = data.get_color_frame(); | ||
std::string frame_serail_no = sensor_from_frame(frame)->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.
typo - dev_serial_no
Change-Id: Id44b561a8b519dfa207c21824de97eb713bad3af
Change interface: add function rs2_get_frame_sensor() for C interface, frame::get_sensor(), sensor_from_frame() for C++ interface and Frame::Sensor for C# interface.
This is used for obtaining the handle of the frame's sensor.
Add demo usage in rs-data-collect and cs-tutorial-2-capture.
Tracked on: DSO-12656