From 62469703b7f2a84f11bedbc06fd3628c33d68891 Mon Sep 17 00:00:00 2001 From: aangerma Date: Sun, 1 Dec 2019 23:44:02 +0200 Subject: [PATCH] Added ds5-wide-fov class to create the profile tags related to fov devices. --- common/model-views.cpp | 2 +- include/librealsense2/h/rs_device.h | 2 +- include/librealsense2/hpp/rs_device.hpp | 4 +- src/ds5/CMakeLists.txt | 2 + src/ds5/ds5-auto-calibration.cpp | 2 +- src/ds5/ds5-auto-calibration.h | 20 +-- src/ds5/ds5-color.cpp | 15 ++ src/ds5/ds5-color.h | 1 + src/ds5/ds5-factory.cpp | 219 ++++++++---------------- src/ds5/ds5-motion.h | 10 ++ src/ds5/ds5-wide-fov.cpp | 21 +++ src/ds5/ds5-wide-fov.h | 19 ++ 12 files changed, 156 insertions(+), 161 deletions(-) create mode 100644 src/ds5/ds5-wide-fov.cpp create mode 100644 src/ds5/ds5-wide-fov.h diff --git a/common/model-views.cpp b/common/model-views.cpp index f7da3b58989..11d425babac 100644 --- a/common/model-views.cpp +++ b/common/model-views.cpp @@ -996,7 +996,7 @@ namespace rs2 auto sensor_profiles = s->get_stream_profiles(); reverse(begin(sensor_profiles), end(sensor_profiles)); rs2_format def_format{ RS2_FORMAT_ANY }; - std::pair default_resolution; + auto default_resolution = std::make_pair(1280, 720); for (auto&& profile : sensor_profiles) { std::stringstream res; diff --git a/include/librealsense2/h/rs_device.h b/include/librealsense2/h/rs_device.h index 6eb7c1ef7ef..8676b7461f5 100644 --- a/include/librealsense2/h/rs_device.h +++ b/include/librealsense2/h/rs_device.h @@ -255,7 +255,7 @@ void rs2_enter_update_state(const rs2_device* device, rs2_error** error); [0.15, 0.25) - Can be Improved [0.25, ) - Requires Calibration * \param[in] callback Callback to get progress notifications -* \return Nnew calibration table +* \return New calibration table */ const rs2_raw_data_buffer* rs2_run_on_chip_calibration_cpp(rs2_device* device, int timeout_ms, const void* json_content, int content_size, float* health, rs2_update_progress_callback* progress_callback, rs2_error** error); diff --git a/include/librealsense2/hpp/rs_device.hpp b/include/librealsense2/hpp/rs_device.hpp index c9c8d46b2e0..8eaf0c8ce06 100644 --- a/include/librealsense2/hpp/rs_device.hpp +++ b/include/librealsense2/hpp/rs_device.hpp @@ -310,7 +310,7 @@ return results; [0.15, 0.25) - Can be Improved [0.25, ) - Requires Calibration * \param[in] callback Callback to get progress notifications - * \return Nnew calibration table + * \return New calibration table */ template std::vector run_on_chip_calibration(int timeout_ms, std::string json_content, float* health, T callback) const @@ -346,7 +346,7 @@ return results; [0, 0.15) - Good [0.15, 0.25) - Can be Improved [0.25, ) - Requires Calibration - * \return Nnew calibration table + * \return New calibration table */ std::vector run_on_chip_calibration(int timeout_ms, std::string json_content, float* health) const { diff --git a/src/ds5/CMakeLists.txt b/src/ds5/CMakeLists.txt index 6ba41a1a82e..2aaaf723d7e 100644 --- a/src/ds5/CMakeLists.txt +++ b/src/ds5/CMakeLists.txt @@ -16,6 +16,7 @@ target_sources(${LRS_TARGET} "${CMAKE_CURRENT_LIST_DIR}/advanced_mode/presets.cpp" "${CMAKE_CURRENT_LIST_DIR}/advanced_mode/advanced_mode.cpp" "${CMAKE_CURRENT_LIST_DIR}/ds5-auto-calibration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/ds5-wide-fov.cpp" "${CMAKE_CURRENT_LIST_DIR}/ds5-factory.h" "${CMAKE_CURRENT_LIST_DIR}/ds5-device.h" "${CMAKE_CURRENT_LIST_DIR}/ds5-options.h" @@ -28,4 +29,5 @@ target_sources(${LRS_TARGET} "${CMAKE_CURRENT_LIST_DIR}/ds5-fw-update-device.h" "${CMAKE_CURRENT_LIST_DIR}/advanced_mode/json_loader.hpp" "${CMAKE_CURRENT_LIST_DIR}/ds5-auto-calibration.h" + "${CMAKE_CURRENT_LIST_DIR}/ds5-wide-fov.h" ) diff --git a/src/ds5/ds5-auto-calibration.cpp b/src/ds5/ds5-auto-calibration.cpp index 78403293f17..4a907edb79a 100644 --- a/src/ds5/ds5-auto-calibration.cpp +++ b/src/ds5/ds5-auto-calibration.cpp @@ -233,7 +233,7 @@ namespace librealsense return recover_preset; } - void auto_calibrated::check_params() + void auto_calibrated::check_params() const { if (_speed < speed_very_fast || _speed > speed_white_wall) throw invalid_value_exception(to_string() << "Auto calibration failed! Given value of 'speed' " << _speed << " is out of range (0 - 4)."); diff --git a/src/ds5/ds5-auto-calibration.h b/src/ds5/ds5-auto-calibration.h index cb17e1c5d9d..94a84afac50 100644 --- a/src/ds5/ds5-auto-calibration.h +++ b/src/ds5/ds5-auto-calibration.h @@ -6,10 +6,10 @@ #include "auto-calibrated-device.h" #include "../core/advanced_mode.h" -const int DEFUALT_AVERAGE_STEP_COUNT = 20; -const int DEFUALT_STEP_COUNT = 10; -const int DEFUALT_ACCURACY = 2; -const int DEFUALT_SPEED = 3; +const int DEFAULT_AVERAGE_STEP_COUNT = 20; +const int DEFAULT_STEP_COUNT = 10; +const int DEFAULT_ACCURACY = 2; +const int DEFAULT_SPEED = 3; namespace librealsense @@ -57,7 +57,7 @@ namespace librealsense RS2_DSC_STATUS_NO_DEPTH_AVERAGE = 7 }; - enum speed + enum auto_calib_speed { speed_very_fast = 0, speed_fast = 1, @@ -104,15 +104,15 @@ namespace librealsense void handle_calibration_error(rs2_dsc_status status) const; std::map parse_json(std::string json); std::shared_ptr< ds5_advanced_mode_base> change_preset(); - void check_params(); + void check_params() const; std::vector _curr_calibration; std::shared_ptr& _hw_monitor; - int _average_step_count = DEFUALT_AVERAGE_STEP_COUNT; - int _step_count = DEFUALT_STEP_COUNT; - int _accuracy = DEFUALT_ACCURACY; - int _speed = DEFUALT_SPEED; + int _average_step_count = DEFAULT_AVERAGE_STEP_COUNT; + int _step_count = DEFAULT_STEP_COUNT; + int _accuracy = DEFAULT_ACCURACY; + int _speed = DEFAULT_SPEED; }; } diff --git a/src/ds5/ds5-color.cpp b/src/ds5/ds5-color.cpp index 5f27c2a7c5b..860b777433c 100644 --- a/src/ds5/ds5-color.cpp +++ b/src/ds5/ds5-color.cpp @@ -59,6 +59,21 @@ namespace librealsense auto color_ep = create_color_device(ctx, color_devs_info); } + std::vector ds5_color::get_profiles_tags() const + { + std::vector tags; + auto usb_spec = get_usb_spec(); + if (usb_spec >= platform::usb3_type || usb_spec == platform::usb_undefined) + { + tags.push_back({ RS2_STREAM_COLOR, -1, 640, 480, RS2_FORMAT_RGB8, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + } + else + { + tags.push_back({ RS2_STREAM_COLOR, -1, 640, 480, RS2_FORMAT_RGB8, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + } + return tags; + } + std::shared_ptr ds5_color::create_color_device(std::shared_ptr ctx, const std::vector& color_devices_info) { diff --git a/src/ds5/ds5-color.h b/src/ds5/ds5-color.h index 991e2229aa9..f27f2695e8d 100644 --- a/src/ds5/ds5-color.h +++ b/src/ds5/ds5-color.h @@ -23,6 +23,7 @@ namespace librealsense protected: std::shared_ptr _color_stream; + std::vector get_profiles_tags() const override; private: friend class ds5_color_sensor; friend class rs435i_device; diff --git a/src/ds5/ds5-factory.cpp b/src/ds5/ds5-factory.cpp index 5038ff3aec4..5135ff1f211 100644 --- a/src/ds5/ds5-factory.cpp +++ b/src/ds5/ds5-factory.cpp @@ -19,6 +19,7 @@ #include "ds5-nonmonochrome.h" #include "ds5-active.h" #include "ds5-color.h" +#include "ds5-wide-fov.h" #include "ds5-motion.h" #include "sync.h" @@ -277,13 +278,14 @@ namespace librealsense }; // PWGT - class rs420_mm_device : public ds5_motion, public ds5_advanced_mode_base + class rs420_mm_device : public ds5_wide_fov, public ds5_motion, public ds5_advanced_mode_base { public: rs420_mm_device(std::shared_ptr ctx, const platform::backend_device_group group, bool register_device_notifications) : device(ctx, group, register_device_notifications), + ds5_wide_fov(ctx, group), ds5_device(ctx, group), ds5_motion(ctx, group), ds5_advanced_mode_base(ds5_device::_hw_monitor, get_depth_sensor()) {} @@ -292,20 +294,7 @@ namespace librealsense std::vector get_profiles_tags() const override { - std::vector tags; - auto usb_spec = get_usb_spec(); - if (usb_spec >= platform::usb3_type || usb_spec == platform::usb_undefined) - { - tags.push_back({ RS2_STREAM_DEPTH, -1, 1280, 720, RS2_FORMAT_Z16, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 1, 1280, 720, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 2, 1280, 720, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET }); - } - else - { - tags.push_back({ RS2_STREAM_DEPTH, -1, 640, 480, RS2_FORMAT_Z16, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 1, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 2, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET }); - } + auto tags = ds5_wide_fov::get_profiles_tags(); if (_fw_version >= firmware_version("5.10.4.0")) { @@ -319,111 +308,60 @@ namespace librealsense }; // PWG - class rs420_device : public ds5_device, public ds5_advanced_mode_base + class rs420_device : public ds5_wide_fov, public ds5_advanced_mode_base { public: rs420_device(std::shared_ptr ctx, const platform::backend_device_group& group, bool register_device_notifications) : device(ctx, group, register_device_notifications), + ds5_wide_fov(ctx, group), ds5_device(ctx, group), ds5_advanced_mode_base(ds5_device::_hw_monitor, get_depth_sensor()) {} std::shared_ptr create_matcher(const frame_holder& frame) const override; - std::vector get_profiles_tags() const override - { - std::vector tags; - auto usb_spec = get_usb_spec(); - if (usb_spec >= platform::usb3_type || usb_spec == platform::usb_undefined) - { - tags.push_back({ RS2_STREAM_DEPTH, -1, 1280, 720, RS2_FORMAT_Z16, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 1, 1280, 720, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 2, 1280, 720, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET }); - } - else - { - tags.push_back({ RS2_STREAM_DEPTH, -1, 640, 480, RS2_FORMAT_Z16, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 1, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 2, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET }); - } - return tags; - }; }; // AWG - class rs430_device : public ds5_active, public ds5_advanced_mode_base + class rs430_device : public ds5_wide_fov, public ds5_active, public ds5_advanced_mode_base { public: rs430_device(std::shared_ptr ctx, const platform::backend_device_group group, bool register_device_notifications) : device(ctx, group, register_device_notifications), + ds5_wide_fov(ctx, group), ds5_device(ctx, group), ds5_active(ctx, group), ds5_advanced_mode_base(ds5_device::_hw_monitor, get_depth_sensor()) {} std::shared_ptr create_matcher(const frame_holder& frame) const override; - std::vector get_profiles_tags() const override - { - std::vector tags; - auto usb_spec = get_usb_spec(); - if (usb_spec >= platform::usb3_type || usb_spec == platform::usb_undefined) - { - tags.push_back({ RS2_STREAM_DEPTH, -1, 1280, 720, RS2_FORMAT_Z16, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 1, 1280, 720, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 2, 1280, 720, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET }); - } - else - { - tags.push_back({ RS2_STREAM_DEPTH, -1, 640, 480, RS2_FORMAT_Z16, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 1, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 2, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET }); - } - return tags; - }; }; - class rs430i_device : public ds5_active, public ds5_advanced_mode_base, public ds5_motion + class rs430i_device : public ds5_wide_fov, public ds5_active, public ds5_advanced_mode_base, public ds5_motion { public: rs430i_device(std::shared_ptr ctx, const platform::backend_device_group group, bool register_device_notifications) : device(ctx, group, register_device_notifications), + ds5_wide_fov(ctx, group), ds5_device(ctx, group), ds5_active(ctx, group), ds5_advanced_mode_base(ds5_device::_hw_monitor, get_depth_sensor()), ds5_motion(ctx, group) {} - std::vector get_profiles_tags() const override - { - std::vector tags; - auto usb_spec = get_usb_spec(); - if (usb_spec >= platform::usb3_type || usb_spec == platform::usb_undefined) - { - tags.push_back({ RS2_STREAM_DEPTH, -1, 1280, 720, RS2_FORMAT_Z16, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 1, 1280, 720, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 2, 1280, 720, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET }); - } - else - { - tags.push_back({ RS2_STREAM_DEPTH, -1, 640, 480, RS2_FORMAT_Z16, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 1, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 2, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET }); - } - tags.push_back({ RS2_STREAM_GYRO, -1, 0, 0, RS2_FORMAT_MOTION_XYZ32F, (int)odr::IMU_FPS_200, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_ACCEL, -1, 0, 0, RS2_FORMAT_MOTION_XYZ32F, (int)odr::IMU_FPS_63, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + std::vector get_profiles_tags() const override; - return tags; - }; std::shared_ptr create_matcher(const frame_holder& frame) const override; }; // AWGT - class rs430_mm_device : public ds5_active, + class rs430_mm_device : public ds5_wide_fov, + public ds5_active, public ds5_motion, public ds5_advanced_mode_base { @@ -432,6 +370,7 @@ namespace librealsense const platform::backend_device_group group, bool register_device_notifications) : device(ctx, group, register_device_notifications), + ds5_wide_fov(ctx, group), ds5_device(ctx, group), ds5_active(ctx, group), ds5_motion(ctx, group), @@ -441,21 +380,7 @@ namespace librealsense std::vector get_profiles_tags() const override { - std::vector tags; - auto usb_spec = get_usb_spec(); - if (usb_spec >= platform::usb3_type || usb_spec == platform::usb_undefined) - { - tags.push_back({ RS2_STREAM_DEPTH, -1, 1280, 720, RS2_FORMAT_Z16, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 1, 1280, 720, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 2, 1280, 720, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET }); - - } - else - { - tags.push_back({ RS2_STREAM_DEPTH, -1, 640, 480, RS2_FORMAT_Z16, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 1, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, 2, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET }); - } + auto tags = ds5_wide_fov::get_profiles_tags(); tags.push_back({ RS2_STREAM_FISHEYE, -1, 640, 480, RS2_FORMAT_RAW8, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT}); if (_fw_version >= firmware_version("5.10.4.0")) // Back-compat with records is required @@ -469,7 +394,8 @@ namespace librealsense }; // AWGC - class rs435_device : public ds5_active, + class rs435_device : public ds5_wide_fov, + public ds5_active, public ds5_color, public ds5_advanced_mode_base { @@ -478,6 +404,7 @@ namespace librealsense const platform::backend_device_group group, bool register_device_notifications) : device(ctx, group, register_device_notifications), + ds5_wide_fov(ctx, group), ds5_device(ctx, group), ds5_active(ctx, group), ds5_color(ctx, group), @@ -485,28 +412,12 @@ namespace librealsense std::shared_ptr create_matcher(const frame_holder& frame) const override; - std::vector get_profiles_tags() const override - { - std::vector tags; - auto usb_spec = get_usb_spec(); - if (usb_spec >= platform::usb3_type || usb_spec == platform::usb_undefined) - { - tags.push_back({ RS2_STREAM_COLOR, -1, 640, 480, RS2_FORMAT_RGB8, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_DEPTH, -1, 848, 480, RS2_FORMAT_Z16, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, -1, 848, 480, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET }); - } - else - { - tags.push_back({ RS2_STREAM_COLOR, -1, 640, 480, RS2_FORMAT_RGB8, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_DEPTH, -1, 640, 480, RS2_FORMAT_Z16, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, -1, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET }); - } - return tags; - }; + std::vector get_profiles_tags() const override; }; // AWGCT - class rs430_rgb_mm_device : public ds5_active, + class rs430_rgb_mm_device : public ds5_wide_fov, + public ds5_active, public ds5_color, public ds5_motion, public ds5_advanced_mode_base @@ -516,6 +427,7 @@ namespace librealsense const platform::backend_device_group group, bool register_device_notifications) : device(ctx, group, register_device_notifications), + ds5_wide_fov(ctx, group), ds5_device(ctx, group), ds5_active(ctx, group), ds5_color(ctx, group), @@ -524,28 +436,12 @@ namespace librealsense std::shared_ptr create_matcher(const frame_holder& frame) const override; - std::vector get_profiles_tags() const override - { - std::vector tags; - auto usb_spec = get_usb_spec(); - if (usb_spec >= platform::usb3_type || usb_spec == platform::usb_undefined) - { - tags.push_back({ RS2_STREAM_COLOR, -1, 640, 480, RS2_FORMAT_RGB8, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_DEPTH, -1, 1280, 720, RS2_FORMAT_Z16, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, -1, 1280, 720, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET }); - } - else - { - tags.push_back({ RS2_STREAM_COLOR, -1, 640, 480, RS2_FORMAT_RGB8, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_DEPTH, -1, 640, 480, RS2_FORMAT_Z16, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, -1, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET }); - } - return tags; - }; + std::vector get_profiles_tags() const override; }; - class rs435i_device : public ds5_active, + class rs435i_device : public ds5_wide_fov, + public ds5_active, public ds5_color, public ds5_motion, public ds5_advanced_mode_base @@ -555,6 +451,7 @@ namespace librealsense const platform::backend_device_group group, bool register_device_notifications) : device(ctx, group, register_device_notifications), + ds5_wide_fov(ctx, group), ds5_device(ctx, group), ds5_active(ctx, group), ds5_color(ctx, group), @@ -566,24 +463,8 @@ namespace librealsense std::shared_ptr create_matcher(const frame_holder& frame) const override; - std::vector get_profiles_tags() const override - { - std::vector tags; - auto usb_spec = get_usb_spec(); - bool usb3mode = (usb_spec >= platform::usb3_type || usb_spec == platform::usb_undefined); - - uint32_t width = usb3mode ? 1280 : 640; - uint32_t height = usb3mode ? 720 : 480; - uint32_t fps = usb3mode ? 30 : 15; - - tags.push_back({ RS2_STREAM_COLOR, -1, width, height, RS2_FORMAT_RGB8, fps, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_DEPTH, -1, width, height, RS2_FORMAT_Z16, fps, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({ RS2_STREAM_INFRARED, -1, width, height, RS2_FORMAT_Y8, fps, profile_tag::PROFILE_TAG_SUPERSET }); - tags.push_back({RS2_STREAM_GYRO, -1, 0, 0, RS2_FORMAT_MOTION_XYZ32F, (int)odr::IMU_FPS_200, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); - tags.push_back({RS2_STREAM_ACCEL, -1, 0, 0, RS2_FORMAT_MOTION_XYZ32F, (int)odr::IMU_FPS_63, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + std::vector get_profiles_tags() const override; - return tags; - }; bool compress_while_record() const override { return false; } private: @@ -1099,6 +980,16 @@ namespace librealsense return matcher_factory::create(RS2_MATCHER_DEFAULT, streams); } + std::vector rs435_device::get_profiles_tags() const + { + auto tags = ds5_wide_fov::get_profiles_tags(); + + auto color_tags = ds5_color::get_profiles_tags(); + tags.insert(tags.end(), color_tags.begin(), color_tags.end()); + + return tags; + } + std::shared_ptr rs430_rgb_mm_device::create_matcher(const frame_holder& frame) const { //TODO: add matcher to mm @@ -1116,6 +1007,29 @@ namespace librealsense return matcher_factory::create(RS2_MATCHER_DEFAULT, streams); } + std::vector rs430_rgb_mm_device::get_profiles_tags() const + { + auto tags = ds5_wide_fov::get_profiles_tags(); + + auto color_tags = ds5_color::get_profiles_tags(); + tags.insert(tags.end(), color_tags.begin(), color_tags.end()); + + auto mm_tags = ds5_motion::get_profiles_tags(); + tags.insert(tags.end(), mm_tags.begin(), mm_tags.end()); + + return tags; + } + + std::vector rs430i_device::get_profiles_tags() const + { + auto tags = ds5_wide_fov::get_profiles_tags(); + + auto mm_tags = ds5_motion::get_profiles_tags(); + tags.insert(tags.end(), mm_tags.begin(), mm_tags.end()); + + return tags; + } + std::shared_ptr rs430i_device::create_matcher(const frame_holder& frame) const { std::vector streams = { _depth_stream.get() , _left_ir_stream.get() , _right_ir_stream.get() }; @@ -1146,6 +1060,19 @@ namespace librealsense return matcher_factory::create(RS2_MATCHER_DEFAULT, streams); } + std::vector rs435i_device::get_profiles_tags() const + { + auto tags = ds5_wide_fov::get_profiles_tags(); + + auto color_tags = ds5_color::get_profiles_tags(); + tags.insert(tags.end(), color_tags.begin(), color_tags.end()); + + auto mm_tags = ds5_motion::get_profiles_tags(); + tags.insert(tags.end(), mm_tags.begin(), mm_tags.end()); + + return tags; + } + std::shared_ptr rs400_imu_device::create_matcher(const frame_holder& frame) const { // TODO - A proper matcher for High-FPS sensor is required diff --git a/src/ds5/ds5-motion.h b/src/ds5/ds5-motion.h index 1c2854da83d..1a5f120fd83 100644 --- a/src/ds5/ds5-motion.h +++ b/src/ds5/ds5-motion.h @@ -259,5 +259,15 @@ namespace librealsense std::shared_ptr _fisheye_stream; std::shared_ptr _accel_stream; std::shared_ptr _gyro_stream; + + std::vector get_profiles_tags() const override + { + std::vector tags; + + tags.push_back({ RS2_STREAM_GYRO, -1, 0, 0, RS2_FORMAT_MOTION_XYZ32F, (int)odr::IMU_FPS_200, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + tags.push_back({ RS2_STREAM_ACCEL, -1, 0, 0, RS2_FORMAT_MOTION_XYZ32F, (int)odr::IMU_FPS_63, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + + return tags; + }; }; } diff --git a/src/ds5/ds5-wide-fov.cpp b/src/ds5/ds5-wide-fov.cpp new file mode 100644 index 00000000000..02ddbd3fc28 --- /dev/null +++ b/src/ds5/ds5-wide-fov.cpp @@ -0,0 +1,21 @@ +#include "ds5-wide-fov.h" + +namespace librealsense +{ + std::vector ds5_wide_fov::get_profiles_tags() const + { + std::vector tags; + auto usb_spec = get_usb_spec(); + if (usb_spec >= platform::usb3_type || usb_spec == platform::usb_undefined) + { + tags.push_back({ RS2_STREAM_DEPTH, -1, 848, 480, RS2_FORMAT_Z16, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + tags.push_back({ RS2_STREAM_INFRARED, -1, 848, 480, RS2_FORMAT_Y8, 30, profile_tag::PROFILE_TAG_SUPERSET }); + } + else + { + tags.push_back({ RS2_STREAM_DEPTH, -1, 640, 480, RS2_FORMAT_Z16, 15, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + tags.push_back({ RS2_STREAM_INFRARED, -1, 640, 480, RS2_FORMAT_Y8, 15, profile_tag::PROFILE_TAG_SUPERSET }); + } + return tags; + }; +} \ No newline at end of file diff --git a/src/ds5/ds5-wide-fov.h b/src/ds5/ds5-wide-fov.h new file mode 100644 index 00000000000..9803fa46f94 --- /dev/null +++ b/src/ds5/ds5-wide-fov.h @@ -0,0 +1,19 @@ +// License: Apache 2.0. See LICENSE file in root directory. +// Copyright(c) 2015 Intel Corporation. All Rights Reserved. + +#pragma once + +#include "ds5-device.h" + +namespace librealsense +{ + class ds5_wide_fov : public virtual ds5_device + { + public: + ds5_wide_fov(std::shared_ptr ctx, + const platform::backend_device_group& group) : + device(ctx, group), ds5_device(ctx, group) {} + + std::vector get_profiles_tags() const override; + }; +}