Skip to content

Commit

Permalink
Merge pull request #9011 from mengyui/python-software-device
Browse files Browse the repository at this point in the history
fix software device in Python wrapper
  • Loading branch information
ev-mp authored Aug 15, 2021
2 parents f08382f + 045beb7 commit b3b2ef0
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/librealsense2/h/rs_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/realsense.def
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/rs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down
2 changes: 2 additions & 0 deletions src/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions wrappers/csharp/Intel.RealSense/Types/Enums/Matchers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
2 changes: 1 addition & 1 deletion wrappers/python/c_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
1 change: 1 addition & 0 deletions wrappers/python/pyrs_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
10 changes: 5 additions & 5 deletions wrappers/python/pyrs_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void init_internal(py::module &m) {

/** rs_internal.hpp **/
// rs2::software_sensor
py::class_<rs2::software_sensor> software_sensor(m, "software_sensor");
py::class_<rs2::software_sensor, rs2::sensor> 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",
Expand All @@ -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_<rs2::software_device> software_device(m, "software_device");
py::class_<rs2::software_device, rs2::device> 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)
Expand All @@ -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_<rs2::firmware_log_message> firmware_log_message(m, "firmware_log_message");
Expand Down

0 comments on commit b3b2ef0

Please sign in to comment.