From 045beb7215d9212806056a072bb04b60f189e413 Mon Sep 17 00:00:00 2001 From: Yu Meng Date: Wed, 12 May 2021 10:39:06 +0800 Subject: [PATCH] fix software device in python --- include/librealsense2/h/rs_types.h | 3 ++- src/realsense.def | 1 + src/rs.cpp | 1 + src/types.cpp | 2 ++ .../csharp/Intel.RealSense/Types/Enums/Matchers.cs | 4 ++++ wrappers/python/c_files.cpp | 2 +- wrappers/python/pyrs_frame.cpp | 1 + wrappers/python/pyrs_internal.cpp | 10 +++++----- 8 files changed, 17 insertions(+), 7 deletions(-) diff --git a/include/librealsense2/h/rs_types.h b/include/librealsense2/h/rs_types.h index b1a30de54e..242cbd9077 100644 --- a/include/librealsense2/h/rs_types.h +++ b/include/librealsense2/h/rs_types.h @@ -251,7 +251,8 @@ typedef enum rs2_matchers RS2_MATCHER_DEFAULT, //the default matcher compare all the streams based on closest timestamp RS2_MATCHER_COUNT -}rs2_matchers; +} rs2_matchers; +const char* rs2_matchers_to_string(rs2_matchers stream); typedef struct rs2_device_info rs2_device_info; typedef struct rs2_device rs2_device; diff --git a/src/realsense.def b/src/realsense.def index 8def807800..c08637dfc3 100644 --- a/src/realsense.def +++ b/src/realsense.def @@ -128,6 +128,7 @@ EXPORTS rs2_exception_type_to_string rs2_extension_type_to_string rs2_extension_to_string + rs2_matchers_to_string rs2_playback_status_to_string rs2_log_severity_to_string rs2_log diff --git a/src/rs.cpp b/src/rs.cpp index 545de53773..f4d95f1630 100644 --- a/src/rs.cpp +++ b/src/rs.cpp @@ -1274,6 +1274,7 @@ const char* rs2_log_severity_to_string(rs2_log_severity severity) const char* rs2_exception_type_to_string(rs2_exception_type type) { return librealsense::get_string(type); } const char* rs2_playback_status_to_string(rs2_playback_status status) { return librealsense::get_string(status); } const char* rs2_extension_type_to_string(rs2_extension type) { return librealsense::get_string(type); } +const char* rs2_matchers_to_string(rs2_matchers matcher) { return librealsense::get_string(matcher); } const char* rs2_frame_metadata_to_string(rs2_frame_metadata_value metadata) { return librealsense::get_string(metadata); } const char* rs2_extension_to_string(rs2_extension type) { return rs2_extension_type_to_string(type); } const char* rs2_frame_metadata_value_to_string(rs2_frame_metadata_value metadata) { return rs2_frame_metadata_to_string(metadata); } diff --git a/src/types.cpp b/src/types.cpp index cab987c561..4b55bc31d3 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -627,6 +627,8 @@ namespace librealsense CASE(DI_C) CASE(DLR_C) CASE(DLR) + CASE(DIC) + CASE(DIC_C) CASE(DEFAULT) default: assert(!is_valid(value)); return UNKNOWN_VALUE; } diff --git a/wrappers/csharp/Intel.RealSense/Types/Enums/Matchers.cs b/wrappers/csharp/Intel.RealSense/Types/Enums/Matchers.cs index 6e3772f880..5a99e4ed90 100644 --- a/wrappers/csharp/Intel.RealSense/Types/Enums/Matchers.cs +++ b/wrappers/csharp/Intel.RealSense/Types/Enums/Matchers.cs @@ -14,6 +14,10 @@ public enum Matchers // commonlly used by RS415, RS435 DLR, // compare depth, left and right ir based on frame number, // commonlly used by RS400, RS405, RS410, RS420, RS430 + DIC, //compare depth, ir and confidence based on frame number used by RS500 + DIC_C, //compare depth, ir and confidence based on frame number, + //compare the set of corresponding depth, ir and confidence with color based on closest timestamp, + //commonly used by RS515 Default, // the default matcher compare all the streams based on closest timestamp } } diff --git a/wrappers/python/c_files.cpp b/wrappers/python/c_files.cpp index f210f56245..6dd08b9b02 100644 --- a/wrappers/python/c_files.cpp +++ b/wrappers/python/c_files.cpp @@ -25,7 +25,7 @@ void init_c_files(py::module &m) { BIND_ENUM(m, rs2_distortion, RS2_DISTORTION_COUNT, "Distortion model: defines how pixel coordinates should be mapped to sensor coordinates.") BIND_ENUM(m, rs2_log_severity, RS2_LOG_SEVERITY_COUNT, "Severity of the librealsense logger.") BIND_ENUM(m, rs2_extension, RS2_EXTENSION_COUNT, "Specifies advanced interfaces (capabilities) objects may implement.") -// BIND_ENUM(m, rs2_matchers, RS2_MATCHER_COUNT, "Specifies types of different matchers.") // TODO: implement rs2_matchers_to_string() + BIND_ENUM(m, rs2_matchers, RS2_MATCHER_COUNT, "Specifies types of different matchers.") BIND_ENUM(m, rs2_camera_info, RS2_CAMERA_INFO_COUNT, "This information is mainly available for camera debug and troubleshooting and should not be used in applications.") BIND_ENUM(m, rs2_stream, RS2_STREAM_COUNT, "Streams are different types of data provided by RealSense devices.") BIND_ENUM(m, rs2_format, RS2_FORMAT_COUNT, "A stream's format identifies how binary data is encoded within a frame.") diff --git a/wrappers/python/pyrs_frame.cpp b/wrappers/python/pyrs_frame.cpp index 2fb8c3d376..c4f3b8e540 100644 --- a/wrappers/python/pyrs_frame.cpp +++ b/wrappers/python/pyrs_frame.cpp @@ -53,6 +53,7 @@ void init_frame(py::module &m) { .def(BIND_DOWNCAST(stream_profile, stream_profile)) .def(BIND_DOWNCAST(stream_profile, video_stream_profile)) .def(BIND_DOWNCAST(stream_profile, motion_stream_profile)) + .def(BIND_DOWNCAST(stream_profile, pose_stream_profile)) .def("stream_name", &rs2::stream_profile::stream_name, "The stream's human-readable name.") .def("is_default", &rs2::stream_profile::is_default, "Checks if the stream profile is marked/assigned as default, " "meaning that the profile will be selected when the user requests stream configuration using wildcards.") diff --git a/wrappers/python/pyrs_internal.cpp b/wrappers/python/pyrs_internal.cpp index 7b584e2095..e6a441c50e 100644 --- a/wrappers/python/pyrs_internal.cpp +++ b/wrappers/python/pyrs_internal.cpp @@ -117,7 +117,7 @@ void init_internal(py::module &m) { /** rs_internal.hpp **/ // rs2::software_sensor - py::class_ software_sensor(m, "software_sensor"); + py::class_ software_sensor(m, "software_sensor"); software_sensor.def("add_video_stream", &rs2::software_sensor::add_video_stream, "Add video stream to software sensor", "video_stream"_a, "is_default"_a=false) .def("add_motion_stream", &rs2::software_sensor::add_motion_stream, "Add motion stream to software sensor", @@ -137,7 +137,7 @@ void init_internal(py::module &m) { .def("on_notification", &rs2::software_sensor::on_notification, "notif"_a); // rs2::software_device - py::class_ software_device(m, "software_device"); + py::class_ software_device(m, "software_device"); software_device.def(py::init<>()) .def("add_sensor", &rs2::software_device::add_sensor, "Add software sensor with given name " "to the software device.", "name"_a) @@ -149,9 +149,9 @@ void init_internal(py::module &m) { .def("register_info", &rs2::software_device::register_info, "Add a new camera info value, like serial number", "info"_a, "val"_a) .def("update_info", &rs2::software_device::update_info, "Update an existing camera info value, like serial number", - "info"_a, "val"_a); - //.def("create_matcher", &rs2::software_device::create_matcher, "Set the wanted matcher type that will " - // "be used by the syncer", "matcher"_a) // TODO: bind rs2_matchers enum. + "info"_a, "val"_a) + .def("create_matcher", &rs2::software_device::create_matcher, "Set the wanted matcher type that will " + "be used by the syncer", "matcher"_a); // rs2::firmware_log_message py::class_ firmware_log_message(m, "firmware_log_message");