diff --git a/CMakeLists.txt b/CMakeLists.txt index 46a07da9fc..07eca0f7d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,9 +121,9 @@ set(REALSENSE_CPP src/win/win-hid.cpp src/win/win-backend.cpp - third_party/easyloggingpp/src/easylogging++.cc + third-party/easyloggingpp/src/easylogging++.cc - third_party/sqlite/sqlite3.c + third-party/sqlite/sqlite3.c src/mock/sql.cpp src/mock/recorder.cpp @@ -179,8 +179,8 @@ set(REALSENSE_HPP src/win/win-hid.h src/win/win-backend.h - third_party/easyloggingpp/src/easylogging++.h - third_party/sqlite/sqlite3.h + third-party/easyloggingpp/src/easylogging++.h + third-party/sqlite/sqlite3.h src/mock/sql.h src/mock/recorder.h ) @@ -223,7 +223,7 @@ if(WIN32) ) source_group("Header Files\\Recorder" FILES - third_party/sqlite/sqlite3.h + third-party/sqlite/sqlite3.h src/mock/sql.h src/mock/recorder.h ) @@ -233,7 +233,7 @@ if(WIN32) ) source_group("Source Files\\Recorder" FILES - third_party/sqlite/sqlite3.c + third-party/sqlite/sqlite3.c src/mock/sql.cpp src/mock/recorder.cpp ) @@ -277,7 +277,7 @@ if(WIN32) ) source_group("Header Files\\Logging" FILES - third_party/easyloggingpp/src/easylogging++.h + third-party/easyloggingpp/src/easylogging++.h ) foreach(flag_var @@ -363,7 +363,6 @@ if(HWM_OVER_XU) add_definitions(-DHWM_OVER_XU) endif() - option(BUILD_SHARED_LIBS "Build shared library" ON) if(BUILD_SHARED_LIBS) add_library(realsense2 SHARED ${REALSENSE_CPP} ${REALSENSE_HPP} ${REALSENSE_DEF}) @@ -425,16 +424,22 @@ else() endif() option(BUILD_UNIT_TESTS "Build realsense unit tests." ON) -option(BUILD_EXAMPLES "Build realsense examples." OFF) +option(BUILD_EXAMPLES "Build realsense examples and tools." ON) option(ENFORCE_METADATA "Require WinSDK with Metadata support during compilation. Windows OS Only" OFF) option(BUILD_RS400_EXTRAS "Build RS400 advanced APIs." ON) +option(BUILD_PYTHON_BINDINGS "Build Python bindings" OFF) + +# This parameter is meant for disabling graphical examples when building for +# headless targets. +option(BUILD_GRAPHICAL_EXAMPLES "Build graphical examples and tools." ON) if(((BUILD_EXAMPLES AND BUILD_GRAPHICAL_EXAMPLES) OR BUILD_RS400_EXTRAS) AND WIN32) - add_subdirectory(examples/third_party/glfw) + add_subdirectory(examples/third_party/glfw) endif() if(BUILD_EXAMPLES) add_subdirectory(examples) + add_subdirectory(tools) endif() if(BUILD_UNIT_TESTS) @@ -449,7 +454,9 @@ if (ENFORCE_METADATA) add_definitions(-DENFORCE_METADATA) endif() -add_subdirectory(bindings) +if (BUILD_PYTHON_BINDINGS) + add_subdirectory(bindings/python) +endif() # Check for unreferenced files FILE(GLOB_RECURSE AllSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt index 20730cee81..321fb0f66e 100644 --- a/bindings/CMakeLists.txt +++ b/bindings/CMakeLists.txt @@ -24,26 +24,6 @@ endif() set(DEPENDENCIES realsense2) -option(BUILD_PYTHON_BINDINGS "Build Python bindings" OFF) - -if(BUILD_PYTHON_BINDINGS) - add_subdirectory(third_party/pybind11) -endif() - -if(BUILD_PYTHON_BINDINGS) - pybind11_add_module(pyrealsense2 python.cpp) - target_link_libraries(pyrealsense2 ${DEPENDENCIES}) - set_target_properties(pyrealsense2 PROPERTIES FOLDER Bindings) -endif() - if(BUILD_PYTHON_BINDINGS) - set(RAW_RS_CPP ../src/backend.cpp ../src/win/win-helpers.cpp ../src/win/win-uvc.cpp pybackend_extras.cpp pybackend.cpp - ../src/win/win-usb.cpp ../src/win/win-backend.cpp ../src/linux/backend-v4l2.cpp ../src/linux/backend-hid.cpp ../src/types.cpp - ../src/win/win-hid.cpp ../src/archive.cpp ../src/log.cpp ../src/types.cpp ../third_party/easyloggingpp/src/easylogging++.cc) - set(RAW_RS_HPP ../src/backend.h ../src/win/win-helpers.h ../src/win/win-uvc.h ../src/linux/backend-v4l2.h ../src/linux/backend-hid.h - ../src/win/win-usb.h ../src/win/win-hid.h ../src/win/win-backend.h ../src/archive.h pybackend_extras.h - ../src/types.h ../third_party/easyloggingpp/src/easylogging++.h) - pybind11_add_module(pybackend2 ${RAW_RS_CPP} ${RAW_RS_HPP}) - target_link_libraries(pybackend2 ${LIBUSB1_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) - set_target_properties(pybackend2 PROPERTIES FOLDER Bindings) + add_subdirectory(python) endif() diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt new file mode 100644 index 0000000000..a10079d963 --- /dev/null +++ b/bindings/python/CMakeLists.txt @@ -0,0 +1,42 @@ +# ubuntu 12.04 LTS cmake version 2.8.7 +# ubuntu 14.04 LTS cmake version 2.8.12.2 +# ubuntu 16.04 LTS cmake version 3.5.1 +cmake_minimum_required(VERSION 2.8.3) + +project(RealsensePythonBindings) + +# Save the command line compile commands in the build output +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) +# View the makefile commands during build +#set(CMAKE_VERBOSE_MAKEFILE on) + +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) +if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -pthread") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +endif() + +set(DEPENDENCIES realsense2) + + +add_subdirectory(third_party/pybind11) + +pybind11_add_module(pyrealsense2 python.cpp) +target_link_libraries(pyrealsense2 ${DEPENDENCIES}) +set_target_properties(pyrealsense2 PROPERTIES FOLDER Bindings) + +set(RAW_RS_CPP ../../src/backend.cpp ../../src/win/win-helpers.cpp ../../src/win/win-uvc.cpp pybackend_extras.cpp pybackend.cpp + ../../src/win/win-usb.cpp ../../src/win/win-backend.cpp ../../src/linux/backend-v4l2.cpp ../../src/linux/backend-hid.cpp ../../src/types.cpp + ../../src/win/win-hid.cpp ../../src/archive.cpp ../../src/log.cpp ../../src/types.cpp ../../third-party/easyloggingpp/src/easylogging++.cc) +set(RAW_RS_HPP ../../src/backend.h ../../src/win/win-helpers.h ../../src/win/win-uvc.h ../../src/linux/backend-v4l2.h ../../src/linux/backend-hid.h + ../../src/win/win-usb.h ../../src/win/win-hid.h ../../src/win/win-backend.h ../../src/archive.h pybackend_extras.h + ../../src/types.h ../../third-party/easyloggingpp/src/easylogging++.h) +pybind11_add_module(pybackend2 ${RAW_RS_CPP} ${RAW_RS_HPP}) +target_link_libraries(pybackend2 ${LIBUSB1_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +set_target_properties(pybackend2 PROPERTIES FOLDER Bindings) diff --git a/bindings/pybackend.cpp b/bindings/python/pybackend.cpp similarity index 100% rename from bindings/pybackend.cpp rename to bindings/python/pybackend.cpp diff --git a/examples/pybackend_example_1_general.py b/bindings/python/pybackend_example_1_general.py similarity index 100% rename from examples/pybackend_example_1_general.py rename to bindings/python/pybackend_example_1_general.py diff --git a/bindings/pybackend_extras.cpp b/bindings/python/pybackend_extras.cpp similarity index 100% rename from bindings/pybackend_extras.cpp rename to bindings/python/pybackend_extras.cpp diff --git a/bindings/pybackend_extras.h b/bindings/python/pybackend_extras.h similarity index 100% rename from bindings/pybackend_extras.h rename to bindings/python/pybackend_extras.h diff --git a/examples/python-tutorial-1-depth.py b/bindings/python/python-tutorial-1-depth.py similarity index 100% rename from examples/python-tutorial-1-depth.py rename to bindings/python/python-tutorial-1-depth.py diff --git a/bindings/python.cpp b/bindings/python/python.cpp similarity index 100% rename from bindings/python.cpp rename to bindings/python/python.cpp diff --git a/bindings/python/readme.md b/bindings/python/readme.md new file mode 100644 index 0000000000..8f7e24fb1b --- /dev/null +++ b/bindings/python/readme.md @@ -0,0 +1 @@ +# Readme (TODO) diff --git a/bindings/third_party/pybind11/CMakeLists.txt b/bindings/python/third_party/pybind11/CMakeLists.txt similarity index 100% rename from bindings/third_party/pybind11/CMakeLists.txt rename to bindings/python/third_party/pybind11/CMakeLists.txt diff --git a/bindings/third_party/pybind11/LICENSE b/bindings/python/third_party/pybind11/LICENSE similarity index 100% rename from bindings/third_party/pybind11/LICENSE rename to bindings/python/third_party/pybind11/LICENSE diff --git a/bindings/third_party/pybind11/MANIFEST.in b/bindings/python/third_party/pybind11/MANIFEST.in similarity index 100% rename from bindings/third_party/pybind11/MANIFEST.in rename to bindings/python/third_party/pybind11/MANIFEST.in diff --git a/bindings/third_party/pybind11/include/pybind11/attr.h b/bindings/python/third_party/pybind11/include/pybind11/attr.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/attr.h rename to bindings/python/third_party/pybind11/include/pybind11/attr.h diff --git a/bindings/third_party/pybind11/include/pybind11/cast.h b/bindings/python/third_party/pybind11/include/pybind11/cast.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/cast.h rename to bindings/python/third_party/pybind11/include/pybind11/cast.h diff --git a/bindings/third_party/pybind11/include/pybind11/chrono.h b/bindings/python/third_party/pybind11/include/pybind11/chrono.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/chrono.h rename to bindings/python/third_party/pybind11/include/pybind11/chrono.h diff --git a/bindings/third_party/pybind11/include/pybind11/common.h b/bindings/python/third_party/pybind11/include/pybind11/common.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/common.h rename to bindings/python/third_party/pybind11/include/pybind11/common.h diff --git a/bindings/third_party/pybind11/include/pybind11/complex.h b/bindings/python/third_party/pybind11/include/pybind11/complex.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/complex.h rename to bindings/python/third_party/pybind11/include/pybind11/complex.h diff --git a/bindings/third_party/pybind11/include/pybind11/descr.h b/bindings/python/third_party/pybind11/include/pybind11/descr.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/descr.h rename to bindings/python/third_party/pybind11/include/pybind11/descr.h diff --git a/bindings/third_party/pybind11/include/pybind11/eigen.h b/bindings/python/third_party/pybind11/include/pybind11/eigen.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/eigen.h rename to bindings/python/third_party/pybind11/include/pybind11/eigen.h diff --git a/bindings/third_party/pybind11/include/pybind11/eval.h b/bindings/python/third_party/pybind11/include/pybind11/eval.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/eval.h rename to bindings/python/third_party/pybind11/include/pybind11/eval.h diff --git a/bindings/third_party/pybind11/include/pybind11/functional.h b/bindings/python/third_party/pybind11/include/pybind11/functional.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/functional.h rename to bindings/python/third_party/pybind11/include/pybind11/functional.h diff --git a/bindings/third_party/pybind11/include/pybind11/numpy.h b/bindings/python/third_party/pybind11/include/pybind11/numpy.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/numpy.h rename to bindings/python/third_party/pybind11/include/pybind11/numpy.h diff --git a/bindings/third_party/pybind11/include/pybind11/operators.h b/bindings/python/third_party/pybind11/include/pybind11/operators.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/operators.h rename to bindings/python/third_party/pybind11/include/pybind11/operators.h diff --git a/bindings/third_party/pybind11/include/pybind11/options.h b/bindings/python/third_party/pybind11/include/pybind11/options.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/options.h rename to bindings/python/third_party/pybind11/include/pybind11/options.h diff --git a/bindings/third_party/pybind11/include/pybind11/pybind11.h b/bindings/python/third_party/pybind11/include/pybind11/pybind11.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/pybind11.h rename to bindings/python/third_party/pybind11/include/pybind11/pybind11.h diff --git a/bindings/third_party/pybind11/include/pybind11/pytypes.h b/bindings/python/third_party/pybind11/include/pybind11/pytypes.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/pytypes.h rename to bindings/python/third_party/pybind11/include/pybind11/pytypes.h diff --git a/bindings/third_party/pybind11/include/pybind11/stl.h b/bindings/python/third_party/pybind11/include/pybind11/stl.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/stl.h rename to bindings/python/third_party/pybind11/include/pybind11/stl.h diff --git a/bindings/third_party/pybind11/include/pybind11/stl_bind.h b/bindings/python/third_party/pybind11/include/pybind11/stl_bind.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/stl_bind.h rename to bindings/python/third_party/pybind11/include/pybind11/stl_bind.h diff --git a/bindings/third_party/pybind11/include/pybind11/typeid.h b/bindings/python/third_party/pybind11/include/pybind11/typeid.h similarity index 100% rename from bindings/third_party/pybind11/include/pybind11/typeid.h rename to bindings/python/third_party/pybind11/include/pybind11/typeid.h diff --git a/bindings/third_party/pybind11/pybind11/__init__.py b/bindings/python/third_party/pybind11/pybind11/__init__.py similarity index 100% rename from bindings/third_party/pybind11/pybind11/__init__.py rename to bindings/python/third_party/pybind11/pybind11/__init__.py diff --git a/bindings/third_party/pybind11/pybind11/_version.py b/bindings/python/third_party/pybind11/pybind11/_version.py similarity index 100% rename from bindings/third_party/pybind11/pybind11/_version.py rename to bindings/python/third_party/pybind11/pybind11/_version.py diff --git a/bindings/third_party/pybind11/setup.cfg b/bindings/python/third_party/pybind11/setup.cfg similarity index 100% rename from bindings/third_party/pybind11/setup.cfg rename to bindings/python/third_party/pybind11/setup.cfg diff --git a/bindings/third_party/pybind11/setup.py b/bindings/python/third_party/pybind11/setup.py similarity index 100% rename from bindings/third_party/pybind11/setup.py rename to bindings/python/third_party/pybind11/setup.py diff --git a/bindings/third_party/pybind11/tools/FindEigen3.cmake b/bindings/python/third_party/pybind11/tools/FindEigen3.cmake similarity index 100% rename from bindings/third_party/pybind11/tools/FindEigen3.cmake rename to bindings/python/third_party/pybind11/tools/FindEigen3.cmake diff --git a/bindings/third_party/pybind11/tools/FindPythonLibsNew.cmake b/bindings/python/third_party/pybind11/tools/FindPythonLibsNew.cmake similarity index 100% rename from bindings/third_party/pybind11/tools/FindPythonLibsNew.cmake rename to bindings/python/third_party/pybind11/tools/FindPythonLibsNew.cmake diff --git a/bindings/third_party/pybind11/tools/check-style.sh b/bindings/python/third_party/pybind11/tools/check-style.sh similarity index 100% rename from bindings/third_party/pybind11/tools/check-style.sh rename to bindings/python/third_party/pybind11/tools/check-style.sh diff --git a/bindings/third_party/pybind11/tools/libsize.py b/bindings/python/third_party/pybind11/tools/libsize.py similarity index 100% rename from bindings/third_party/pybind11/tools/libsize.py rename to bindings/python/third_party/pybind11/tools/libsize.py diff --git a/bindings/third_party/pybind11/tools/mkdoc.py b/bindings/python/third_party/pybind11/tools/mkdoc.py similarity index 100% rename from bindings/third_party/pybind11/tools/mkdoc.py rename to bindings/python/third_party/pybind11/tools/mkdoc.py diff --git a/bindings/third_party/pybind11/tools/pybind11Config.cmake.in b/bindings/python/third_party/pybind11/tools/pybind11Config.cmake.in similarity index 100% rename from bindings/third_party/pybind11/tools/pybind11Config.cmake.in rename to bindings/python/third_party/pybind11/tools/pybind11Config.cmake.in diff --git a/bindings/third_party/pybind11/tools/pybind11Tools.cmake b/bindings/python/third_party/pybind11/tools/pybind11Tools.cmake similarity index 100% rename from bindings/third_party/pybind11/tools/pybind11Tools.cmake rename to bindings/python/third_party/pybind11/tools/pybind11Tools.cmake diff --git a/bindings/readme.md b/bindings/readme.md new file mode 100644 index 0000000000..8f7e24fb1b --- /dev/null +++ b/bindings/readme.md @@ -0,0 +1 @@ +# Readme (TODO) diff --git a/examples/example.hpp b/common/example.hpp similarity index 99% rename from examples/example.hpp rename to common/example.hpp index d651bffea8..ccc0235827 100644 --- a/examples/example.hpp +++ b/common/example.hpp @@ -319,7 +319,7 @@ namespace rs2 // Simple font loading code // ////////////////////////////// -#include "third_party/stb_easy_font.h" +#include "../third-party/stb_easy_font.h" inline void draw_text(int x, int y, const char * text) { diff --git a/examples/model-views.cpp b/common/model-views.cpp similarity index 100% rename from examples/model-views.cpp rename to common/model-views.cpp diff --git a/examples/model-views.h b/common/model-views.h similarity index 100% rename from examples/model-views.h rename to common/model-views.h diff --git a/examples/parser.hpp b/common/parser.hpp similarity index 99% rename from examples/parser.hpp rename to common/parser.hpp index 81ff1dadb0..3aa5140d94 100644 --- a/examples/parser.hpp +++ b/common/parser.hpp @@ -9,7 +9,7 @@ #include #include -#include "third_party/rapidxml/rapidxml.hpp" +#include "rapidxml/rapidxml.hpp" #include "../src/hw-monitor.h" #define MAX_PARAMS 4 diff --git a/doc/ds5-placeholder.png b/doc/ds5-placeholder.png deleted file mode 100644 index b937b3fd7b..0000000000 Binary files a/doc/ds5-placeholder.png and /dev/null differ diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index c17f88e5cc..56674e6df4 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -10,10 +10,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1) # View the makefile commands during build #set(CMAKE_VERBOSE_MAKEFILE on) -# This parameter is meant for disabling graphical examples when building for -# headless targets. -option(BUILD_GRAPHICAL_EXAMPLES "Build graphical examples." ON) - include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) @@ -26,200 +22,46 @@ else() message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() -if(ANDROID) - set(DEPENDENCIES realsense2) - - add_executable(rs-enumerate-devices cpp-enumerate-devices.cpp) - target_link_libraries(rs-enumerate-devices ${DEPENDENCIES}) - include_directories(rs-enumerate-devices third_party/tclap/include) - - set_target_properties (rs-enumerate-devices PROPERTIES - FOLDER Examples - ) -else() - if(BUILD_GRAPHICAL_EXAMPLES) - find_package(OpenGL REQUIRED) - set(DEPENDENCIES realsense2 ${OPENGL_LIBRARIES}) - - if(WIN32) - list(APPEND DEPENDENCIES glfw3) - else() - # Find glfw header - find_path(GLFW_INCLUDE_DIR NAMES GLFW/glfw3.h - PATHS /usr/X11R6/include - /usr/include/X11 - /opt/graphics/OpenGL/include - /opt/graphics/OpenGL/contrib/libglfw - /usr/local/include - /usr/include/GL - /usr/include - ) - # Find glfw library - find_library(GLFW_LIBRARIES NAMES glfw glfw3 - PATHS /usr/lib64 - /usr/lib - /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} - /usr/local/lib64 - /usr/local/lib - /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} - /usr/X11R6/lib - ) - list(APPEND DEPENDENCIES m ${GLFW_LIBRARIES} ${LIBUSB1_LIBRARIES}) - include_directories(${GLFW_INCLUDE_DIR}) - endif() - else() - set(DEPENDENCIES realsense2) - if(NOT WIN32) - list(APPEND DEPENDENCIES m ${LIBUSB1_LIBRARIES}) - endif() - endif() - - - # C/C++ Headless Tutorials - - # c-tutorial-1-depth - add_executable(c-tutorial-1-depth c-tutorial-1-depth.c) - target_link_libraries(c-tutorial-1-depth ${DEPENDENCIES}) - set_target_properties (c-tutorial-1-depth PROPERTIES - FOLDER "C Tutorials" - ) +if(BUILD_GRAPHICAL_EXAMPLES) + find_package(OpenGL REQUIRED) + set(DEPENDENCIES realsense2 ${OPENGL_LIBRARIES}) - # cpp-tutorial-1-depth - add_executable(cpp-tutorial-1-depth cpp-tutorial-1-depth.cpp) - target_link_libraries(cpp-tutorial-1-depth ${DEPENDENCIES}) - set_target_properties (cpp-tutorial-1-depth PROPERTIES - FOLDER "C++ Tutorials" - ) - - # data-collect - add_executable(rs-data-collect cpp-data-collect.cpp) - target_link_libraries(rs-data-collect ${DEPENDENCIES}) - include_directories(rs-data-collect third_party/tclap/include) - set_target_properties (rs-data-collect PROPERTIES - FOLDER "Examples" - ) - - # headless - add_executable(rs-headless cpp-headless.cpp) - target_link_libraries(rs-headless ${DEPENDENCIES}) - include_directories(rs-headless third_party/tclap/include) - set_target_properties (rs-headless PROPERTIES - FOLDER "Examples" - ) - - # enumerate-devices - add_executable(rs-enumerate-devices cpp-enumerate-devices.cpp) - target_link_libraries(rs-enumerate-devices ${DEPENDENCIES}) - include_directories(rs-enumerate-devices third_party/tclap/include) - set_target_properties (rs-enumerate-devices PROPERTIES - FOLDER Examples - ) - - # terminal - add_executable(rs-terminal cpp-terminal.cpp cpp-terminal-helpers/auto-complete/auto-complete.cpp cpp-terminal-helpers/auto-complete/auto-complete.h) - if(WIN32) - target_link_libraries(rs-terminal ${DEPENDENCIES}) - else() - target_link_libraries(rs-terminal -lpthread ${DEPENDENCIES}) - endif() - include_directories(rs-terminal third_party/tclap/include cpp-terminal-helpers/auto-complete) - set_target_properties (rs-terminal PROPERTIES - FOLDER Examples - ) - - # fw-logger - add_executable(rs-fw-logger cpp-fw-logger.cpp cpp-fw-logger-helpers/fw-log-data.cpp - cpp-fw-logger-helpers/fw-log-data.h - cpp-fw-logger-helpers/fw-logs-formating-options.cpp - cpp-fw-logger-helpers/fw-logs-formating-options.h - cpp-fw-logger-helpers/fw-logs-parser.cpp - cpp-fw-logger-helpers/fw-logs-parser.h - cpp-fw-logger-helpers/fw-logs-xml-helper.cpp - cpp-fw-logger-helpers/fw-logs-xml-helper.h - cpp-fw-logger-helpers/string-formatter.cpp - cpp-fw-logger-helpers/string-formatter.h) if(WIN32) - target_link_libraries(rs-fw-logger ${DEPENDENCIES}) + list(APPEND DEPENDENCIES glfw3) else() - target_link_libraries(rs-fw-logger -lpthread ${DEPENDENCIES}) - endif() - include_directories(rs-fw-logger third_party/tclap/include cpp-fw-logger-helpers) - set_target_properties (rs-fw-logger PROPERTIES - FOLDER Examples - ) - - install( - TARGETS - - rs-enumerate-devices - rs-terminal - rs-fw-logger - rs-data-collect - rs-headless - - RUNTIME DESTINATION - ${CMAKE_INSTALL_PREFIX}/bin - ) - - if(BUILD_GRAPHICAL_EXAMPLES) - # C/C++ Tutorials - - # c-tutorial-2-streams - add_executable(c-tutorial-2-streams c-tutorial-2-streams.c) - target_link_libraries(c-tutorial-2-streams ${DEPENDENCIES}) - set_target_properties (c-tutorial-2-streams PROPERTIES - FOLDER "C Tutorials" - ) - - # config-ui - add_executable(rs-config-ui cpp-config-ui.cpp third_party/imgui/imgui.cpp third_party/imgui/imgui_draw.cpp third_party/imgui/imgui_impl_glfw.cpp example.hpp model-views.h model-views.cpp) - target_link_libraries(rs-config-ui ${DEPENDENCIES}) - include_directories(rs-config-ui third_party/imgui) - set_target_properties (rs-config-ui PROPERTIES - FOLDER Examples + # Find glfw header + find_path(GLFW_INCLUDE_DIR NAMES GLFW/glfw3.h + PATHS /usr/X11R6/include + /usr/include/X11 + /opt/graphics/OpenGL/include + /opt/graphics/OpenGL/contrib/libglfw + /usr/local/include + /usr/include/GL + /usr/include ) - - # capture - add_executable(rs-capture cpp-capture.cpp) - target_link_libraries(rs-capture ${DEPENDENCIES}) - include_directories(rs-capture third_party/tclap/include) - set_target_properties (rs-capture PROPERTIES - FOLDER "Examples" - ) - - # tutorial-2-streams - add_executable(cpp-tutorial-2-streams cpp-tutorial-2-streams.cpp) - target_link_libraries(cpp-tutorial-2-streams ${DEPENDENCIES}) - set_target_properties (cpp-tutorial-2-streams PROPERTIES - FOLDER "C++ Tutorials" - ) - - # multicam - add_executable(rs-multicam cpp-multicam.cpp) - target_link_libraries(rs-multicam ${DEPENDENCIES}) - set_target_properties (rs-multicam PROPERTIES - FOLDER Examples - ) - - # pointcloud - add_executable(rs-pointcloud cpp-pointcloud.cpp third_party/imgui/imgui.cpp third_party/imgui/imgui_draw.cpp third_party/imgui/imgui_impl_glfw.cpp) - target_link_libraries(rs-pointcloud ${DEPENDENCIES}) - include_directories(rs-config-ui third_party/imgui) - set_target_properties (rs-pointcloud PROPERTIES - FOLDER Examples - ) - - install( - TARGETS - - rs-config-ui - rs-capture - rs-multicam - rs-pointcloud - - RUNTIME DESTINATION - ${CMAKE_INSTALL_PREFIX}/bin + # Find glfw library + find_library(GLFW_LIBRARIES NAMES glfw glfw3 + PATHS /usr/lib64 + /usr/lib + /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} + /usr/local/lib64 + /usr/local/lib + /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} + /usr/X11R6/lib ) + list(APPEND DEPENDENCIES m ${GLFW_LIBRARIES} ${LIBUSB1_LIBRARIES}) + include_directories(${GLFW_INCLUDE_DIR}) + endif() +else() + set(DEPENDENCIES realsense2) + if(NOT WIN32) + list(APPEND DEPENDENCIES m ${LIBUSB1_LIBRARIES}) endif() endif() + +add_subdirectory(capture) +add_subdirectory(enumerate-devices) +add_subdirectory(headless) +add_subdirectory(multicam) +add_subdirectory(pointcloud) diff --git a/examples/c-tutorial-1-depth.c b/examples/c-tutorial-1-depth.c deleted file mode 100644 index a2eff1d262..0000000000 --- a/examples/c-tutorial-1-depth.c +++ /dev/null @@ -1,135 +0,0 @@ -/* License: Apache 2.0. See LICENSE file in root directory. -Copyright(c) 2015 Intel Corporation. All Rights Reserved. */ - -/*************************************************\ -* librealsense tutorial #1 - Accessing depth data * -\*************************************************/ - -/* First include the librealsense C header file */ -#include -#include -#include -#include - -/* Function calls to librealsense may raise errors of type rs2_error */ -rs2_error * e = 0; -void check_error() -{ - if (e) - { - printf("rs2_error was raised when calling %s(%s):\n", rs2_get_failed_function(e), rs2_get_failed_args(e)); - printf(" %s\n", rs2_get_error_message(e)); - exit(EXIT_FAILURE); - } -} - -int main() -{ - /* Create a context object. This object owns the handles to all connected realsense devices. */ - rs2_context * ctx = rs2_create_context(RS2_API_VERSION, &e); - check_error(); - rs2_device_list * devices = rs2_query_devices(ctx, &e); - printf("There are %d connected RealSense devices.\n", rs2_get_device_count(devices, &e)); - check_error(); - if (rs2_get_device_count(devices, &e) == 0) - return EXIT_FAILURE; - - /* This tutorial will access only a single device, but it is trivial to extend to multiple devices */ - rs2_device * dev = rs2_create_device(devices, 0, &e); - check_error(); - printf("\nUsing device 0, an %s\n", rs2_get_camera_info(dev, RS2_CAMERA_INFO_DEVICE_NAME, &e)); - check_error(); - printf(" Serial number: %s\n", rs2_get_camera_info(dev, RS2_CAMERA_INFO_DEVICE_SERIAL_NUMBER, &e)); - check_error(); - printf(" Firmware version: %s\n", rs2_get_camera_info(dev, RS2_CAMERA_INFO_CAMERA_FIRMWARE_VERSION, &e)); - check_error(); - printf(" Device Location: %s\n", rs2_get_camera_info(dev, RS2_CAMERA_INFO_DEVICE_LOCATION, &e)); - check_error(); - - /* Configure depth to run at VGA resolution at 30 frames per second */ - int width = 640, height = 480; - rs2_open(dev, RS2_STREAM_DEPTH, width, height, 30, RS2_FORMAT_Z16, &e); - check_error(); - - rs2_frame_queue * queue = rs2_create_frame_queue(1, &e); - check_error(); - rs2_start(dev, rs2_enqueue_frame, queue, &e); - check_error(); - - /* Determine depth value corresponding to one meter */ - float depth_units = 1.f; - if (rs2_supports_option(dev, RS2_OPTION_DEPTH_UNITS, &e) && !e) - { - depth_units = rs2_get_option(dev, RS2_OPTION_DEPTH_UNITS, &e); - check_error(); - } - const uint16_t one_meter = (uint16_t)(1.0 / depth_units); - check_error(); - - int rows = (height / 20); - int row_lenght = (width / 10); - int display_size = (rows + 1) * (row_lenght + 1); - - char *buffer = (char*)malloc(display_size * sizeof(char)); - if (NULL == buffer) - { - printf("Failed to allocate application memory"); - exit(EXIT_FAILURE); - } - char * out; - - while (1) - { - /* This call waits until a new coherent set of frames is available on a device */ - rs2_frame * frame = rs2_wait_for_frame(queue, &e); - check_error(); - - /* Retrieve depth data, configured as 16-bit depth values */ - const uint16_t * depth_frame = (const uint16_t *)(rs2_get_frame_data(frame, &e)); - check_error(); - - /* Print a simple text-based representation of the image, by breaking it into 10x5 pixel regions and and approximating the coverage of pixels within one meter */ - out = buffer; - int coverage[255] = { 0 }, x, y, i; - for (y = 0; y < height; ++y) - { - for (x = 0; x < width; ++x) - { - int depth = *depth_frame++; - if (depth > 0 && depth < one_meter) - ++coverage[x / 10]; - } - - if (y % 20 == 19) - { - for (i = 0; i < (row_lenght); ++i) - { - *out++ = " .:nhBXWW"[coverage[i] / 25]; - coverage[i] = 0; - } - *out++ = '\n'; - } - } - *out++ = 0; - printf("\n%s", buffer); - - rs2_release_frame(frame); - } - - rs2_flush_queue(queue, &e); - check_error(); - - rs2_stop(dev, &e); - check_error(); - - rs2_close(dev, &e); - check_error(); - - rs2_delete_device(dev); - rs2_delete_frame_queue(queue); - rs2_delete_device_list(devices); - - free(buffer); - - return EXIT_SUCCESS; -} diff --git a/examples/c-tutorial-2-streams.c b/examples/c-tutorial-2-streams.c deleted file mode 100644 index 8f669c28c2..0000000000 --- a/examples/c-tutorial-2-streams.c +++ /dev/null @@ -1,145 +0,0 @@ -/* License: Apache 2.0. See LICENSE file in root directory. - Copyright(c) 2015 Intel Corporation. All Rights Reserved. */ - -/*******************************************************\ -* librealsense tutorial #2 - Accessing multiple streams * -\*******************************************************/ - -/* First include the librealsense C header file */ -#include -#include -#include -#include - -/* Also include GLFW to allow for graphical display */ -#include - -/* Function calls to librealsense may raise errors of type rs2_error */ -rs2_error * e = 0; -void check_error() -{ - if(e) - { - printf("rs2_error was raised when calling %s(%s):\n", rs2_get_failed_function(e), rs2_get_failed_args(e)); - printf(" %s\n", rs2_get_error_message(e)); - exit(EXIT_FAILURE); - } -} - -int main() -{ - /* Create a context object. This object owns the handles to all connected realsense devices. */ - rs2_context * ctx = rs2_create_context(RS2_API_VERSION, &e); - check_error(); - rs2_device_list * devices = rs2_query_devices(ctx, &e); - printf("There are %d connected RealSense devices.\n", rs2_get_device_count(devices, &e)); - check_error(); - if(rs2_get_device_count(devices, &e) == 0) - return EXIT_FAILURE; - - /* This tutorial will access only a single device, but it is trivial to extend to multiple devices */ - rs2_device * dev = rs2_create_device(devices, 0, &e); - check_error(); - printf("\nUsing device 0, an %s\n", rs2_get_camera_info(dev, RS2_CAMERA_INFO_DEVICE_NAME, &e)); - check_error(); - printf(" Serial number: %s\n", rs2_get_camera_info(dev, RS2_CAMERA_INFO_DEVICE_SERIAL_NUMBER, &e)); - check_error(); - printf(" Firmware version: %s\n", rs2_get_camera_info(dev, RS2_CAMERA_INFO_CAMERA_FIRMWARE_VERSION, &e)); - check_error(); - printf(" Device Location: %s\n", rs2_get_camera_info(dev, RS2_CAMERA_INFO_DEVICE_LOCATION, &e)); - check_error(); - - rs2_stream streams[] = { RS2_STREAM_DEPTH, RS2_STREAM_INFRARED }; - int widths[] = { 640, 640 }; - int heights[] = { 480, 480 }; - int fpss[] = { 30, 30 }; - rs2_format formats[] = { RS2_FORMAT_Z16, RS2_FORMAT_Y8 }; - - rs2_open_multiple(dev, streams, widths, heights, fpss, formats, 2, &e); - check_error(); - - rs2_frame_queue * queue = rs2_create_frame_queue(10, &e); - check_error(); - - rs2_start(dev, rs2_enqueue_frame, queue, &e); - check_error(); - - rs2_frame* frontbuffer[RS2_STREAM_COUNT]; - for (int i = 0; i < RS2_STREAM_COUNT; i++) - frontbuffer[i] = NULL; - - float depth_units = 1.f; - if (rs2_supports_option(dev, RS2_OPTION_DEPTH_UNITS, &e) && !e) - { - depth_units = rs2_get_option(dev, RS2_OPTION_DEPTH_UNITS, &e); - check_error(); - } - - /* Open a GLFW window to display our output */ - glfwInit(); - GLFWwindow * win = glfwCreateWindow(640, 480 * 2, "librealsense tutorial #2", NULL, NULL); - glfwMakeContextCurrent(win); - while(!glfwWindowShouldClose(win)) - { - /* Wait for new frame data */ - glfwPollEvents(); - rs2_frame* frame; - - while (rs2_poll_for_frame(queue, &frame, &e)) - { - check_error(); - - rs2_stream stream_type = rs2_get_frame_stream_type(frame, &e); - check_error(); - - if (frontbuffer[stream_type]) - { - rs2_release_frame(frontbuffer[stream_type]); - } - frontbuffer[stream_type] = frame; - } - - glClear(GL_COLOR_BUFFER_BIT); - glPixelZoom(1, -1); - - if (frontbuffer[RS2_STREAM_DEPTH]) - { - /* Display depth data by linearly mapping depth between 0 and 2 meters to the red channel */ - glRasterPos2f(-1, 1); - glPixelTransferf(GL_RED_SCALE, (0xFFFF * depth_units) / 2.0f); - check_error(); - glDrawPixels(640, 480, GL_RED, GL_UNSIGNED_SHORT, rs2_get_frame_data(frontbuffer[RS2_STREAM_DEPTH], &e)); - check_error(); - glPixelTransferf(GL_RED_SCALE, 1.0f); - } - - if (frontbuffer[RS2_STREAM_INFRARED]) - { - /* Display infrared image by mapping IR intensity to visible luminance */ - glRasterPos2f(-1, 0); - glDrawPixels(640, 480, GL_LUMINANCE, GL_UNSIGNED_BYTE, rs2_get_frame_data(frontbuffer[RS2_STREAM_INFRARED], &e)); - check_error(); - } - - glfwSwapBuffers(win); - } - - for (int i = 0; i < RS2_STREAM_COUNT; i++) - { - if (frontbuffer[i]) - { - rs2_release_frame(frontbuffer[i]); - } - } - - rs2_flush_queue(queue, &e); - check_error(); - rs2_close(dev, &e); - check_error(); - rs2_delete_device(dev); - rs2_delete_device_list(devices); - rs2_delete_frame_queue(queue); - rs2_delete_context(ctx); - - return EXIT_SUCCESS; -} diff --git a/examples/capture/CMakeLists.txt b/examples/capture/CMakeLists.txt new file mode 100644 index 0000000000..4d3bd0badd --- /dev/null +++ b/examples/capture/CMakeLists.txt @@ -0,0 +1,37 @@ +# ubuntu 16.04 LTS cmake version 3.5.1 +cmake_minimum_required(VERSION 2.8.3) + +project(RealsenseExamplesCapture) + +# Save the command line compile commands in the build output +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) +if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +endif() + +if(BUILD_GRAPHICAL_EXAMPLES) + add_executable(rs-capture rs-capture.cpp) + target_link_libraries(rs-capture ${DEPENDENCIES}) + include_directories(rs-capture ../../common ../../third-party/tclap/include) + set_target_properties (rs-capture PROPERTIES + FOLDER "Examples" + ) + + install( + TARGETS + + rs-capture + + RUNTIME DESTINATION + ${CMAKE_INSTALL_PREFIX}/bin + ) +endif() diff --git a/examples/capture/readme.md b/examples/capture/readme.md new file mode 100644 index 0000000000..8f7e24fb1b --- /dev/null +++ b/examples/capture/readme.md @@ -0,0 +1 @@ +# Readme (TODO) diff --git a/examples/cpp-capture.cpp b/examples/capture/rs-capture.cpp similarity index 100% rename from examples/cpp-capture.cpp rename to examples/capture/rs-capture.cpp diff --git a/examples/cpp-tutorial-1-depth.cpp b/examples/cpp-tutorial-1-depth.cpp deleted file mode 100644 index 431a207d43..0000000000 --- a/examples/cpp-tutorial-1-depth.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// License: Apache 2.0. See LICENSE file in root directory. -// Copyright(c) 2015 Intel Corporation. All Rights Reserved. - -///////////////////////////////////////////////////// -// librealsense tutorial #1 - Accessing depth data // -///////////////////////////////////////////////////// - -// First include the librealsense C++ header file -#include -#include - -using namespace rs2; - -int main() try -{ - // Create a context object. This object owns the handles to all connected realsense devices. - context ctx; - auto devices = ctx.query_devices(); - printf("There are %u connected RealSense devices.\n", devices.size()); - if (devices.size() == 0) return EXIT_FAILURE; - - // This tutorial will access only a single device, but it is trivial to extend to multiple devices - auto dev = devices[0]; - printf("\nUsing device 0, an %s\n", dev.get_info(RS2_CAMERA_INFO_DEVICE_NAME)); - printf(" Serial number: %s\n", dev.get_info(RS2_CAMERA_INFO_DEVICE_SERIAL_NUMBER)); - printf(" Firmware version: %s\n", dev.get_info(RS2_CAMERA_INFO_CAMERA_FIRMWARE_VERSION)); - - auto depth = dev.query_sensors().front(); - - // Configure depth to run at VGA resolution at 30 frames per second - depth.open({ RS2_STREAM_DEPTH, 640, 480, 30, RS2_FORMAT_Z16 }); - - // Configure frame queue of size one and start streaming into it - frame_queue queue(1); - depth.start(queue); - - // Determine depth value corresponding to one meter - auto depth_units = 1.f; - if (depth.supports(RS2_OPTION_DEPTH_UNITS)) - depth_units = depth.get_option(RS2_OPTION_DEPTH_UNITS); - const auto one_meter = static_cast(1.0 / depth_units); - - while (true) - { - // This call waits until a new coherent set of frames is available on a device - // Calls to get_frame_data(...) and get_frame_timestamp(...) on a device will return stable values until wait_for_frames(...) is called - auto frame = queue.wait_for_frame(); - - // Retrieve depth data, which was previously configured as a 640 x 480 image of 16-bit depth values - auto depth_frame = reinterpret_cast(frame.get_data()); - - // Print a simple text-based representation of the image, by breaking it into 10x20 pixel regions and and approximating the coverage of pixels within one meter - char buffer[(640 / 10 + 1)*(480 / 20) + 1]; - auto out = buffer; - int coverage[64] = {}; - for (auto y = 0; y<480; ++y) - { - for (auto x = 0; x<640; ++x) - { - int depth = *depth_frame++; - if (depth > 0 && depth < one_meter) - ++coverage[x / 10]; - } - - if (y % 20 == 19) - { - for (auto& c : coverage) - { - *out++ = " .:nhBXWW"[c / 25]; - c = 0; - } - *out++ = '\n'; - } - } - *out++ = 0; - printf("\n%s", buffer); - } - - return EXIT_SUCCESS; -} -catch (const error & e) -{ - // Method calls against librealsense objects may throw exceptions of type error - printf("error was thrown when calling %s(%s):\n", e.get_failed_function().c_str(), e.get_failed_args().c_str()); - printf(" %s\n", e.what()); - return EXIT_FAILURE; -} diff --git a/examples/cpp-tutorial-2-streams.cpp b/examples/cpp-tutorial-2-streams.cpp deleted file mode 100644 index b5f821b25c..0000000000 --- a/examples/cpp-tutorial-2-streams.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// License: Apache 2.0. See LICENSE file in root directory. -// Copyright(c) 2015 Intel Corporation. All Rights Reserved. - -/////////////////////////////////////////////////////////// -// librealsense tutorial #2 - Accessing multiple streams // -/////////////////////////////////////////////////////////// - -// First include the librealsense C++ header file -#include -#include - -// Also include GLFW to allow for graphical display -#include -#include - -using namespace rs2; -using namespace std; - -int main() -{ - // Create a context object. This object owns the handles to all connected realsense devices. - context ctx; - // Create device_hub to handle device disconnections - util::device_hub hub(ctx); - - auto finished = false; - GLFWwindow* win; - while(!finished) - { - try - { - // Wait for any device to connect and return it - auto dev = hub.wait_for_device(); - auto connected_devices = ctx.query_devices(); - printf("There are %u connected RealSense devices.\n", connected_devices.size()); - - - printf("\nUsing device 0, an %s\n", dev.get_info(RS2_CAMERA_INFO_DEVICE_NAME)); - printf(" Serial number: %s\n", dev.get_info(RS2_CAMERA_INFO_DEVICE_SERIAL_NUMBER)); - printf(" Firmware version: %s\n", dev.get_info(RS2_CAMERA_INFO_CAMERA_FIRMWARE_VERSION)); - - vector supported_streams = { RS2_STREAM_DEPTH, RS2_STREAM_INFRARED, RS2_STREAM_COLOR }; - - auto sensors = dev.query_sensors(); - auto depth = sensors[0]; - - // Configure the relevant subdevices of the RealSense camera - depth.open({ { RS2_STREAM_DEPTH, 640, 480, 30, RS2_FORMAT_Z16 }, - { RS2_STREAM_INFRARED, 640, 480, 30, RS2_FORMAT_Y8 } }); - - // Create frame queue to pass new frames from the device to our application - frame_queue queue(RS2_STREAM_COUNT); - // Create a frame buffer to hold on to most up to date frame until a newer frame is available - frame frontbuffer[RS2_STREAM_COUNT]; - - // Start the physical devices and specify our frame queue as the target - depth.start(queue); - - // Open a GLFW window to display our output - glfwInit(); - - win = glfwCreateWindow(640, 480 * 2, "librealsense tutorial #2", nullptr, nullptr); - glfwMakeContextCurrent(win); - - // Determine depth value corresponding to one meter - auto depth_units = 1.f; - if (depth.supports(RS2_OPTION_DEPTH_UNITS)) - depth_units = depth.get_option(RS2_OPTION_DEPTH_UNITS); - - // Loop until window closed or device disconnects - while(!glfwWindowShouldClose(win) && hub.is_connected(dev)) - { - glfwPollEvents(); - - // Move new frames into the frame buffer - frame frame; - while (queue.poll_for_frame(&frame)) - { - auto stream_type = frame.get_stream_type(); - // Override the last frame with the new one - frontbuffer[stream_type] = move(frame); - } - - glClear(GL_COLOR_BUFFER_BIT); - glPixelZoom(1, -1); - - for (auto & stream : supported_streams) - { - if (frontbuffer[stream]) - switch (stream) - { - case RS2_STREAM_DEPTH: // Display depth data by linearly mapping depth between 0 and 2 meters to the red channel - glRasterPos2f(-1, 1); - glPixelTransferf(GL_RED_SCALE, (0xFFFF * depth_units) / 2.0f); - glDrawPixels(640, 480, GL_RED, GL_UNSIGNED_SHORT, frontbuffer[stream].get_data()); - glPixelTransferf(GL_RED_SCALE, 1.0f); - break; - case RS2_STREAM_INFRARED: // Display infrared image by mapping IR intensity to visible luminance - glRasterPos2f(-1, 0); - glDrawPixels(640, 480, GL_LUMINANCE, GL_UNSIGNED_BYTE, frontbuffer[stream].get_data()); - break; - default: break; // This demo will display native streams only - } - } - - glfwSwapBuffers(win); - } - - // If the window was closed then we are finished, - // otherwise the cammera probably got disconnected and we will wait until it connects again - if (glfwWindowShouldClose(win)) - finished = true; - } - catch(const error & e) - { - // Method calls against librealsense objects may throw exceptions of type error - printf("error was thrown when calling %s(%s):\n", e.get_failed_function().c_str(), e.get_failed_args().c_str()); - printf(" %s\n", e.what()); - } - glfwDestroyWindow(win); - glfwTerminate(); - } - printf("Finishing up"); - - return EXIT_SUCCESS; -} - diff --git a/examples/enumerate-devices/CMakeLists.txt b/examples/enumerate-devices/CMakeLists.txt new file mode 100644 index 0000000000..a60ee56bea --- /dev/null +++ b/examples/enumerate-devices/CMakeLists.txt @@ -0,0 +1,36 @@ +# ubuntu 16.04 LTS cmake version 3.5.1 +cmake_minimum_required(VERSION 2.8.3) + +project(RealsenseExamplesEnumerateDevices) + +# Save the command line compile commands in the build output +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) +if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +endif() + +# enumerate-devices +add_executable(rs-enumerate-devices rs-enumerate-devices.cpp) +target_link_libraries(rs-enumerate-devices ${DEPENDENCIES}) +include_directories(rs-enumerate-devices ../../third-party/tclap/include) +set_target_properties (rs-enumerate-devices PROPERTIES + FOLDER Examples +) + +install( + TARGETS + + rs-enumerate-devices + + RUNTIME DESTINATION + ${CMAKE_INSTALL_PREFIX}/bin +) diff --git a/examples/enumerate-devices/readme.md b/examples/enumerate-devices/readme.md new file mode 100644 index 0000000000..8f7e24fb1b --- /dev/null +++ b/examples/enumerate-devices/readme.md @@ -0,0 +1 @@ +# Readme (TODO) diff --git a/examples/cpp-enumerate-devices.cpp b/examples/enumerate-devices/rs-enumerate-devices.cpp similarity index 63% rename from examples/cpp-enumerate-devices.cpp rename to examples/enumerate-devices/rs-enumerate-devices.cpp index 6aa3a6dd12..6251621b9a 100644 --- a/examples/cpp-enumerate-devices.cpp +++ b/examples/enumerate-devices/rs-enumerate-devices.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "tclap/CmdLine.h" @@ -103,7 +104,6 @@ int main(int argc, char** argv) try auto dev = devices[i]; cout << left << setw(30) << dev.get_info(RS2_CAMERA_INFO_DEVICE_NAME) - << setw(20) << dev.get_info(RS2_CAMERA_INFO_DEVICE_SERIAL_NUMBER) << setw(20) << dev.get_info(RS2_CAMERA_INFO_CAMERA_FIRMWARE_VERSION) << endl; } @@ -115,7 +115,6 @@ int main(int argc, char** argv) try return EXIT_SUCCESS; } - map device_index_per_stream; for (auto i = 0; i < device_count; ++i) { auto dev = devices[i]; @@ -134,67 +133,77 @@ int main(int argc, char** argv) try if (show_options.getValue()) { - cout << setw(55) << " Supported options:" << setw(10) << "min" << setw(10) - << " max" << setw(6) << " step" << setw(10) << " default" << endl; - for (auto j = 0; j < RS2_OPTION_COUNT; ++j) + for (auto&& sensor : dev.query_sensors()) { - auto opt = static_cast(j); - if (dev.supports(opt)) + cout << "Options for " << sensor.get_info(RS2_CAMERA_INFO_SENSOR_NAME) << endl; + + cout << setw(55) << " Supported options:" << setw(10) << "min" << setw(10) + << " max" << setw(6) << " step" << setw(10) << " default" << endl; + for (auto j = 0; j < RS2_OPTION_COUNT; ++j) { - auto range = dev.get_option_range(opt); - cout << " " << left << setw(50) << opt << " : " - << setw(5) << range.min << "... " << setw(12) << range.max - << setw(6) << range.step << setw(10) << range.def << "\n"; + auto opt = static_cast(j); + if (sensor.supports(opt)) + { + auto range = sensor.get_option_range(opt); + cout << " " << left << setw(50) << opt << " : " + << setw(5) << range.min << "... " << setw(12) << range.max + << setw(6) << range.step << setw(10) << range.def << "\n"; + } } - } - cout << endl; + cout << endl; + } } if (show_modes.getValue()) { - cout << setw(55) << " Supported modes:" << setw(10) << "stream" << setw(10) - << " resolution" << setw(6) << " fps" << setw(10) << " format" << endl; - // Show which streams are supported by this device - for (auto&& profile : dev.get_stream_modes()) + for (auto&& sensor : dev.query_sensors()) { - cout << " " << profile.stream << "\t " << profile.width << "x" - << profile.height << "\t@ " << profile.fps << "Hz\t" << profile.format << endl; + cout << "Stream Profiles supported by " << sensor.get_info(RS2_CAMERA_INFO_SENSOR_NAME) << endl; - // Show horizontal and vertical field of view, in degrees - //cout << "\t" << setprecision(3) << intrin.hfov() << " x " << intrin.vfov() << " degrees\n"; - } + cout << setw(55) << " Supported modes:" << setw(10) << "stream" << setw(10) + << " resolution" << setw(6) << " fps" << setw(10) << " format" << endl; + // Show which streams are supported by this device + for (auto&& profile : sensor.get_stream_modes()) { + cout << " " << profile.stream << "\t " << profile.width << "x" + << profile.height << "\t@ " << profile.fps << "Hz\t" << profile.format << endl; - cout << endl; + // Show horizontal and vertical field of view, in degrees + //cout << "\t" << setprecision(3) << intrin.hfov() << " x " << intrin.vfov() << " degrees\n"; + } + + cout << endl; + } } // Print Intrinsics if (show_calibration_data.getValue()) { - // Intrinsics - for (auto&& profile : dev.get_stream_modes()) + for (auto&& sensor : dev.query_sensors()) { - device_index_per_stream[profile.stream] = i; - if (profile.stream == RS2_STREAM_GPIO1 || - profile.stream == RS2_STREAM_GPIO2 || - profile.stream == RS2_STREAM_GPIO3 || - profile.stream == RS2_STREAM_GPIO4) - continue; - - cout << "Intrinsics of " << profile.stream << "\t " << profile.width << "\tx " - << profile.height << "\t@ " << profile.fps << "Hz\t" << profile.format << endl; - if (profile.stream == RS2_STREAM_GYRO || - profile.stream == RS2_STREAM_ACCEL) - { - auto intrinsics = dev.get_motion_intrinsics(profile.stream); - print(intrinsics); - } - else + cout << "Intrinsics provided by " << sensor.get_info(RS2_CAMERA_INFO_SENSOR_NAME) << endl; + + // Intrinsics + for (auto&& profile : sensor.get_stream_modes()) { - auto intrinsics = dev.get_intrinsics(profile); - print(intrinsics); + if (profile.stream == RS2_STREAM_GPIO1 || + profile.stream == RS2_STREAM_GPIO2 || + profile.stream == RS2_STREAM_GPIO3 || + profile.stream == RS2_STREAM_GPIO4) + continue; + + cout << "Intrinsics of " << profile.stream << "\t " << profile.width << "\tx " + << profile.height << "\t@ " << profile.fps << "Hz\t" << profile.format << endl; + + if (profile.stream == RS2_STREAM_GYRO || + profile.stream == RS2_STREAM_ACCEL) { + auto intrinsics = sensor.get_motion_intrinsics(profile.stream); + print(intrinsics); + } else { + auto intrinsics = sensor.get_intrinsics(profile); + print(intrinsics); + } } - } } } @@ -202,19 +211,7 @@ int main(int argc, char** argv) try // Print Extrinsics if (show_calibration_data.getValue()) { - for (auto& elemA : device_index_per_stream) - { - auto deviceA = devices[elemA.second]; - for (auto& elemB : device_index_per_stream) - { - auto deviceB = devices[elemB.second]; - cout << "Extrinsics from " << rs2_stream_to_string(elemA.first) << - " to " << rs2_stream_to_string(elemB.first) << endl; - - auto extrinsics_A_to_B = deviceA.get_extrinsics_to(elemA.first, deviceB, elemB.first); - print(extrinsics_A_to_B); - } - } + throw std::runtime_error("TODO: Rewrite Extrinsics info!"); } cout << endl; diff --git a/examples/headless/CMakeLists.txt b/examples/headless/CMakeLists.txt new file mode 100644 index 0000000000..74ce52600f --- /dev/null +++ b/examples/headless/CMakeLists.txt @@ -0,0 +1,36 @@ +# ubuntu 16.04 LTS cmake version 3.5.1 +cmake_minimum_required(VERSION 2.8.3) + +project(RealsenseExamplesHeadless) + +# Save the command line compile commands in the build output +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) +if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +endif() + +# headless +add_executable(rs-headless rs-headless.cpp) +target_link_libraries(rs-headless ${DEPENDENCIES}) +include_directories(rs-headless ../../common ../../third-party ../../third-party/tclap/include) +set_target_properties (rs-headless PROPERTIES + FOLDER "Examples" +) + +install( + TARGETS + + rs-headless + + RUNTIME DESTINATION + ${CMAKE_INSTALL_PREFIX}/bin +) diff --git a/examples/headless/readme.md b/examples/headless/readme.md new file mode 100644 index 0000000000..8f7e24fb1b --- /dev/null +++ b/examples/headless/readme.md @@ -0,0 +1 @@ +# Readme (TODO) diff --git a/examples/cpp-headless.cpp b/examples/headless/rs-headless.cpp similarity index 95% rename from examples/cpp-headless.cpp rename to examples/headless/rs-headless.cpp index 83f0b2391c..7f37b52c13 100644 --- a/examples/cpp-headless.cpp +++ b/examples/headless/rs-headless.cpp @@ -20,7 +20,7 @@ #include #define STB_IMAGE_WRITE_IMPLEMENTATION -#include "third_party/stb_image_write.h" +#include "stb_image_write.h" #include using namespace rs2; @@ -72,7 +72,7 @@ int main() config.enable_all(preset::best_quality); auto stream = config.open(dev); - auto sync = dev.create_syncer(); + syncer sync; /* activate video streaming */ stream.start(sync); @@ -109,7 +109,7 @@ int main() auto& frame = kvp.second; stringstream ss; - ss << "cpp-headless-output-" << stream_type << ".png"; + ss << "rs-headless-output-" << stream_type << ".png"; cout << "Writing " << ss.str().data() << ", " << frame.get_width() << " x " << frame.get_height() << " pixels" << endl; @@ -126,9 +126,9 @@ int main() coloredDepth.resize(depth_size); /* Encode depth data into color image */ - make_depth_histogram(coloredDepth.data(), + make_depth_histogram(classic, coloredDepth.data(), static_cast(depth.get_data()), - depth.get_width(), depth.get_height()); + depth.get_width(), depth.get_height(), true, 0, 0); pixels = coloredDepth.data(); bpp = 3; diff --git a/examples/multicam/CMakeLists.txt b/examples/multicam/CMakeLists.txt new file mode 100644 index 0000000000..bfb13d14ad --- /dev/null +++ b/examples/multicam/CMakeLists.txt @@ -0,0 +1,38 @@ +# ubuntu 16.04 LTS cmake version 3.5.1 +cmake_minimum_required(VERSION 2.8.3) + +project(RealsenseExamplesMulticam) + +# Save the command line compile commands in the build output +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) +if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +endif() + +if(BUILD_GRAPHICAL_EXAMPLES) + # multicam + add_executable(rs-multicam rs-multicam.cpp) + include_directories(rs-multicam ../../common) + target_link_libraries(rs-multicam ${DEPENDENCIES}) + set_target_properties (rs-multicam PROPERTIES + FOLDER Examples + ) + + install( + TARGETS + + rs-multicam + + RUNTIME DESTINATION + ${CMAKE_INSTALL_PREFIX}/bin + ) +endif() diff --git a/examples/multicam/readme.md b/examples/multicam/readme.md new file mode 100644 index 0000000000..8f7e24fb1b --- /dev/null +++ b/examples/multicam/readme.md @@ -0,0 +1 @@ +# Readme (TODO) diff --git a/examples/cpp-multicam.cpp b/examples/multicam/rs-multicam.cpp similarity index 94% rename from examples/cpp-multicam.cpp rename to examples/multicam/rs-multicam.cpp index 4567a6b133..5b8b4f07d4 100644 --- a/examples/cpp-multicam.cpp +++ b/examples/multicam/rs-multicam.cpp @@ -36,10 +36,11 @@ int main(int argc, char * argv[]) try for(auto&& dev : devices) { cout << "Starting " << dev.get_info(RS2_CAMERA_INFO_DEVICE_NAME) << "... "; - auto modes = dev.get_stream_modes(); - dev.open(modes.back()); + auto sensor = dev.query_sensors().front(); + auto modes = sensor.get_stream_modes(); + sensor.open(modes.back()); syncers.emplace_back(); - dev.start(syncers.back()); + sensor.start(syncers.back()); cout << "done." << endl; } diff --git a/examples/pointcloud/CMakeLists.txt b/examples/pointcloud/CMakeLists.txt new file mode 100644 index 0000000000..1fa7fea1e0 --- /dev/null +++ b/examples/pointcloud/CMakeLists.txt @@ -0,0 +1,38 @@ +# ubuntu 16.04 LTS cmake version 3.5.1 +cmake_minimum_required(VERSION 2.8.3) + +project(RealsenseExamplesPointcloud) + +# Save the command line compile commands in the build output +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) +if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +endif() + +if(BUILD_GRAPHICAL_EXAMPLES) + # pointcloud + add_executable(rs-pointcloud rs-pointcloud.cpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp) + target_link_libraries(rs-pointcloud ${DEPENDENCIES}) + include_directories(rs-pointcloud ../../common ../../third-party/imgui) + set_target_properties (rs-pointcloud PROPERTIES + FOLDER Examples + ) + + install( + TARGETS + + rs-pointcloud + + RUNTIME DESTINATION + ${CMAKE_INSTALL_PREFIX}/bin + ) +endif() diff --git a/examples/pointcloud/readme.md b/examples/pointcloud/readme.md new file mode 100644 index 0000000000..8f7e24fb1b --- /dev/null +++ b/examples/pointcloud/readme.md @@ -0,0 +1 @@ +# Readme (TODO) diff --git a/examples/cpp-pointcloud.cpp b/examples/pointcloud/rs-pointcloud.cpp similarity index 99% rename from examples/cpp-pointcloud.cpp rename to examples/pointcloud/rs-pointcloud.cpp index 96ac08b8e4..1642ddd76f 100644 --- a/examples/cpp-pointcloud.cpp +++ b/examples/pointcloud/rs-pointcloud.cpp @@ -148,7 +148,7 @@ int main(int argc, char * argv[]) s->lastY = y; }); - auto syncer = dev.create_syncer(); + syncer syncer; stream.start(syncer); texture_buffer mapped_tex; @@ -161,8 +161,6 @@ int main(int argc, char * argv[]) while (devs.is_connected(dev) && !glfwWindowShouldClose(win)) { - - glfwPollEvents(); ImGui_ImplGlfw_NewFrame(); diff --git a/examples/pybackend2.pyd b/examples/pybackend2.pyd deleted file mode 100644 index 41348114ee..0000000000 Binary files a/examples/pybackend2.pyd and /dev/null differ diff --git a/examples/readme.md b/examples/readme.md new file mode 100644 index 0000000000..8f7e24fb1b --- /dev/null +++ b/examples/readme.md @@ -0,0 +1 @@ +# Readme (TODO) diff --git a/examples/third_party/glfw/msvc120/glfw3.sln b/examples/third_party/glfw/msvc120/glfw3.sln deleted file mode 100644 index 31c4c4825c..0000000000 --- a/examples/third_party/glfw/msvc120/glfw3.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glfw3", "glfw3.vcxproj", "{979D0ADD-6AB7-403A-BB17-5434615E4446}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Debug|Win32.ActiveCfg = Debug|Win32 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Debug|Win32.Build.0 = Debug|Win32 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Debug|x64.ActiveCfg = Debug|x64 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Debug|x64.Build.0 = Debug|x64 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Release|Win32.ActiveCfg = Release|Win32 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Release|Win32.Build.0 = Release|Win32 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Release|x64.ActiveCfg = Release|x64 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/examples/third_party/glfw/msvc120/glfw3.vcxproj b/examples/third_party/glfw/msvc120/glfw3.vcxproj deleted file mode 100644 index f8945aab15..0000000000 --- a/examples/third_party/glfw/msvc120/glfw3.vcxproj +++ /dev/null @@ -1,176 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - {979D0ADD-6AB7-403A-BB17-5434615E4446} - Win32Proj - glfw3 - - - - StaticLibrary - true - v120 - Unicode - - - StaticLibrary - true - v120 - Unicode - - - StaticLibrary - false - v120 - true - Unicode - - - StaticLibrary - false - v120 - true - Unicode - - - - - - - - - - - - - - - - - - - obj/$(Configuration)-$(Platform)/ - obj/$(Configuration)-$(Platform)/ - - - obj/$(Configuration)-$(Platform)/ - obj/$(Configuration)-$(Platform)/ - - - obj/$(Configuration)-$(Platform)/ - obj/$(Configuration)-$(Platform)/ - - - obj/$(Configuration)-$(Platform)/ - obj/$(Configuration)-$(Platform)/ - - - - - - Level3 - Disabled - _WINDOWS;_CRT_SECURE_NO_WARNINGS;_GLFW_USE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - CompileAsC - - - Windows - true - - - - - - - Level3 - Disabled - _WINDOWS;_CRT_SECURE_NO_WARNINGS;_GLFW_USE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - CompileAsC - - - Windows - true - - - - - Level3 - - - MaxSpeed - true - true - _WINDOWS;_CRT_SECURE_NO_WARNINGS;_GLFW_USE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - CompileAsC - - - Windows - true - true - true - - - - - Level3 - - - MaxSpeed - true - true - _WINDOWS;_CRT_SECURE_NO_WARNINGS;_GLFW_USE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - CompileAsC - - - Windows - true - true - true - - - - - - \ No newline at end of file diff --git a/examples/third_party/glfw/msvc120/glfw3.vcxproj.filters b/examples/third_party/glfw/msvc120/glfw3.vcxproj.filters deleted file mode 100644 index 8e49aeda39..0000000000 --- a/examples/third_party/glfw/msvc120/glfw3.vcxproj.filters +++ /dev/null @@ -1,77 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - src - - - src - - - src - - - src - - - src - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/examples/third_party/glfw/msvc140/glfw3.sln b/examples/third_party/glfw/msvc140/glfw3.sln deleted file mode 100644 index 31c4c4825c..0000000000 --- a/examples/third_party/glfw/msvc140/glfw3.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glfw3", "glfw3.vcxproj", "{979D0ADD-6AB7-403A-BB17-5434615E4446}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Debug|Win32.ActiveCfg = Debug|Win32 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Debug|Win32.Build.0 = Debug|Win32 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Debug|x64.ActiveCfg = Debug|x64 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Debug|x64.Build.0 = Debug|x64 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Release|Win32.ActiveCfg = Release|Win32 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Release|Win32.Build.0 = Release|Win32 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Release|x64.ActiveCfg = Release|x64 - {979D0ADD-6AB7-403A-BB17-5434615E4446}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/examples/third_party/glfw/msvc140/glfw3.vcxproj b/examples/third_party/glfw/msvc140/glfw3.vcxproj deleted file mode 100644 index 4202ea00f6..0000000000 --- a/examples/third_party/glfw/msvc140/glfw3.vcxproj +++ /dev/null @@ -1,176 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - {979D0ADD-6AB7-403A-BB17-5434615E4446} - Win32Proj - glfw3 - - - - StaticLibrary - true - v140 - Unicode - - - StaticLibrary - true - v140 - Unicode - - - StaticLibrary - false - v140 - true - Unicode - - - StaticLibrary - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - obj/$(Configuration)-$(Platform)/ - obj/$(Configuration)-$(Platform)/ - - - obj/$(Configuration)-$(Platform)/ - obj/$(Configuration)-$(Platform)/ - - - obj/$(Configuration)-$(Platform)/ - obj/$(Configuration)-$(Platform)/ - - - obj/$(Configuration)-$(Platform)/ - obj/$(Configuration)-$(Platform)/ - - - - - - Level3 - Disabled - _WINDOWS;_CRT_SECURE_NO_WARNINGS;_GLFW_USE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - CompileAsC - - - Windows - true - - - - - - - Level3 - Disabled - _WINDOWS;_CRT_SECURE_NO_WARNINGS;_GLFW_USE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - CompileAsC - - - Windows - true - - - - - Level3 - - - MaxSpeed - true - true - _WINDOWS;_CRT_SECURE_NO_WARNINGS;_GLFW_USE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - CompileAsC - - - Windows - true - true - true - - - - - Level3 - - - MaxSpeed - true - true - _WINDOWS;_CRT_SECURE_NO_WARNINGS;_GLFW_USE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - CompileAsC - - - Windows - true - true - true - - - - - - \ No newline at end of file diff --git a/examples/third_party/glfw/msvc140/glfw3.vcxproj.filters b/examples/third_party/glfw/msvc140/glfw3.vcxproj.filters deleted file mode 100644 index 8e49aeda39..0000000000 --- a/examples/third_party/glfw/msvc140/glfw3.vcxproj.filters +++ /dev/null @@ -1,77 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - src - - - src - - - src - - - src - - - src - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/include/librealsense/rs2.h b/include/librealsense/rs2.h index 79d6bf901e..8a9fdf2743 100644 --- a/include/librealsense/rs2.h +++ b/include/librealsense/rs2.h @@ -203,16 +203,14 @@ typedef enum rs2_option Not all information attributes are available on all camera types. This information is mainly available for camera debug and troubleshooting and should not be used in applications. */ typedef enum rs2_camera_info { - RS2_CAMERA_INFO_DEVICE_NAME , /**< Device friendly name */ - RS2_CAMERA_INFO_SENSOR_NAME , /**< Sensor friendly name */ - RS2_CAMERA_INFO_DEVICE_SERIAL_NUMBER , /**< Device serial number */ - RS2_CAMERA_INFO_CAMERA_FIRMWARE_VERSION , /**< Primary firmware version */ - RS2_CAMERA_INFO_DEVICE_LOCATION , /**< Unique identifier of the port the device is connected to (platform specific) */ - RS2_CAMERA_INFO_DEVICE_DEBUG_OP_CODE , /**< If device supports firmware logging, this is the command to send to get logs from firmware */ + RS2_CAMERA_INFO_NAME , /**< Friendly name */ + RS2_CAMERA_INFO_SERIAL_NUMBER , /**< Device serial number */ + RS2_CAMERA_INFO_FIRMWARE_VERSION , /**< Primary firmware version */ + RS2_CAMERA_INFO_LOCATION , /**< Unique identifier of the port the device is connected to (platform specific) */ + RS2_CAMERA_INFO_DEBUG_OP_CODE , /**< If device supports firmware logging, this is the command to send to get logs from firmware */ RS2_CAMERA_INFO_ADVANCED_MODE , /**< True iff the device is in advanced mode */ RS2_CAMERA_INFO_PRODUCT_ID , /**< Product ID as reported in the USB descriptor */ - RS2_CAMERA_INFO_MOTION_MODULE_FIRMWARE_VERSION , /**< Motion Module firmware version */ - RS2_CAMERA_INFO_IS_CAMERA_LOCKED , /**< True iff EEPROM is locked */ + RS2_CAMERA_INFO_CAMERA_LOCKED , /**< True iff EEPROM is locked */ RS2_CAMERA_INFO_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */ } rs2_camera_info; diff --git a/include/librealsense/rs2.hpp b/include/librealsense/rs2.hpp index e69a734455..2ec5175ee9 100644 --- a/include/librealsense/rs2.hpp +++ b/include/librealsense/rs2.hpp @@ -927,6 +927,7 @@ namespace rs2 class device { public: + using SensorType = sensor; /** * returns the list of adjacent devices, sharing the same physical parent composite device diff --git a/include/librealsense/rsutil2.hpp b/include/librealsense/rsutil2.hpp index f7672b1a85..89f06f0d5b 100644 --- a/include/librealsense/rsutil2.hpp +++ b/include/librealsense/rsutil2.hpp @@ -35,9 +35,9 @@ namespace rs2 public: multistream() {} - explicit multistream(std::vector results, + explicit multistream(std::vector results, std::map profiles, - std::map devices) + std::map devices) : profiles(std::move(profiles)), devices(std::move(devices)), results(std::move(results)) @@ -85,9 +85,11 @@ namespace rs2 return profiles; } private: + friend class Config; + std::map profiles; - std::map devices; - std::vector results; + std::map devices; + std::vector results; }; Config() : require_all(true) {} @@ -129,9 +131,10 @@ namespace rs2 _requests.clear(); } - void close(Dev dev) + void close(multistream stream) { - dev.close(); + for (auto&& dev : stream.results) + dev.close(); } template @@ -165,8 +168,8 @@ namespace rs2 // Unpack the data returned by assign std::map > dev_to_profiles; - std::vector devices; - std::map stream_to_dev; + std::vector devices; + std::map stream_to_dev; std::map stream_to_profile; auto sensors = dev.query_sensors(); @@ -203,7 +206,7 @@ namespace rs2 } - static void auto_complete(std::vector &requests, Dev &target) + static void auto_complete(std::vector &requests, typename Dev::SensorType &target) { auto candidates = target.get_stream_modes(); for (auto & request : requests) @@ -218,7 +221,7 @@ namespace rs2 } } if (request.has_wildcards()) - throw std::runtime_error(std::string("Couldn't autocomplete request for subdevice ") + target.get_camera_info(RS2_CAMERA_INFO_DEVICE_NAME)); + throw std::runtime_error(std::string("Couldn't autocomplete request for subdevice ") + target.get_info(RS2_CAMERA_INFO_NAME)); } } @@ -228,7 +231,7 @@ namespace rs2 // Algorithm assumes get_adjacent_devices always // returns the devices in the same order - auto devs = dev.get_adjacent_devices(); + auto devs = dev.query_sensors(); for (auto i = 0; i < devs.size(); ++i) { auto sub = devs[i]; diff --git a/include/readme.md b/include/readme.md new file mode 100644 index 0000000000..8f7e24fb1b --- /dev/null +++ b/include/readme.md @@ -0,0 +1 @@ +# Readme (TODO) diff --git a/rs400/examples/CMakeLists.txt b/rs400/examples/CMakeLists.txt index 7a6bd1ec13..96d7c699d0 100644 --- a/rs400/examples/CMakeLists.txt +++ b/rs400/examples/CMakeLists.txt @@ -49,10 +49,10 @@ else() include_directories(${GLFW_INCLUDE_DIR}) endif() -add_executable(rs400-advanced-mode-sample sample.cpp ../include/rs400_advanced_mode/rs400_advanced_mode.hpp third_party/json.hpp json_loader.hpp - ../../examples/third_party/imgui/imgui.cpp ../../examples/third_party/imgui/imgui_draw.cpp ../../examples/third_party/imgui/imgui_impl_glfw.cpp sample.hpp ../include/rs400_advanced_mode/AdvancedModeCommand.h) +add_executable(rs400-advanced-mode-sample sample.cpp ../include/rs400_advanced_mode/rs400_advanced_mode.hpp ../../third-party/json.hpp json_loader.hpp + ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp sample.hpp ../include/rs400_advanced_mode/AdvancedModeCommand.h) target_link_libraries(rs400-advanced-mode-sample ${DEPENDENCIES}) -include_directories(rs400-advanced-mode-sample ../../examples/third_party/imgui third_party ../../examples/third_party/tclap/include) +include_directories(rs400-advanced-mode-sample ../../third-party/imgui ../../third-party ../../third-party/tclap/include) file(GLOB JSONS "presets/*.json" @@ -65,11 +65,11 @@ set_target_properties (rs400-advanced-mode-sample PROPERTIES if(WIN32) source_group("Header Files\\3rd Party" FILES - third_party/json.hpp) + ../../third-party/json.hpp) source_group("Source Files\\3rd Party" FILES - ../../examples/third_party/imgui/imgui.cpp - ../../examples/third_party/imgui/imgui_impl_glfw.cpp) + ../../third-party/imgui/imgui.cpp + ../../third-party/imgui/imgui_impl_glfw.cpp) source_group("Header Files\\Reference" FILES ../include/rs400_advanced_mode/AdvancedModeCommand.h) diff --git a/src/algo.cpp b/src/algo.cpp index 32e9f578ae..5a99e5124f 100644 --- a/src/algo.cpp +++ b/src/algo.cpp @@ -4,7 +4,7 @@ #include "algo.h" #include "option.h" -using namespace rsimpl2; +using namespace librealsense; bool auto_exposure_state::get_enable_auto_exposure() const { diff --git a/src/algo.h b/src/algo.h index 7b8b2ebd37..a16686dc85 100644 --- a/src/algo.h +++ b/src/algo.h @@ -13,7 +13,7 @@ #include #include -namespace rsimpl2 +namespace librealsense { enum class auto_exposure_modes { static_auto_exposure = 0, diff --git a/src/archive.cpp b/src/archive.cpp index 9a973f2840..622f20efe5 100644 --- a/src/archive.cpp +++ b/src/archive.cpp @@ -1,7 +1,7 @@ #include "metadata-parser.h" #include "archive.h" -using namespace rsimpl2; +using namespace librealsense; frame_archive::frame_archive(std::atomic* in_max_frame_queue_size, std::shared_ptr ts, @@ -295,12 +295,12 @@ void frame_archive::log_frame_callback_end(frame* frame) const auto callback_warning_duration = 1000 / (frame->additional_data.fps + 1); auto callback_duration = callback_ended - frame->get_frame_callback_start_time_point(); - LOG_DEBUG("CallbackFinished," << rsimpl2::get_string(frame->get_stream_type()) << "," << frame->get_frame_number() + LOG_DEBUG("CallbackFinished," << librealsense::get_string(frame->get_stream_type()) << "," << frame->get_frame_number() << ",DispatchedAt," << callback_ended); if (callback_duration > callback_warning_duration) { - LOG_DEBUG("Frame Callback [" << rsimpl2::get_string(frame->get_stream_type()) + LOG_DEBUG("Frame Callback [" << librealsense::get_string(frame->get_stream_type()) << "#" << std::dec << frame->additional_data.frame_number << "] overdue. (Duration: " << callback_duration << "ms, FPS: " << frame->additional_data.fps << ", Max Duration: " << callback_warning_duration << "ms)"); @@ -313,7 +313,7 @@ void rs2_frame::log_callback_start(rs2_time_t timestamp) const if (get()) { get()->update_frame_callback_start_ts(timestamp); - LOG_DEBUG("CallbackStarted," << rsimpl2::get_string(get()->get_stream_type()) << "," << get()->get_frame_number() << ",DispatchedAt," << timestamp); + LOG_DEBUG("CallbackStarted," << librealsense::get_string(get()->get_stream_type()) << "," << get()->get_frame_number() << ",DispatchedAt," << timestamp); } } @@ -324,11 +324,11 @@ void rs2_frame::log_callback_end(rs2_time_t timestamp) const auto callback_warning_duration = 1000.f / (get()->additional_data.fps + 1); auto callback_duration = timestamp - get()->get_frame_callback_start_time_point(); - LOG_DEBUG("CallbackFinished," << rsimpl2::get_string(get()->get_stream_type()) << "," << get()->get_frame_number() << ",DispatchedAt," << timestamp); + LOG_DEBUG("CallbackFinished," << librealsense::get_string(get()->get_stream_type()) << "," << get()->get_frame_number() << ",DispatchedAt," << timestamp); if (callback_duration > callback_warning_duration) { - LOG_INFO("Frame Callback " << rsimpl2::get_string(get()->get_stream_type()) + LOG_INFO("Frame Callback " << librealsense::get_string(get()->get_stream_type()) << "#" << std::dec << get()->additional_data.frame_number << "overdue. (Duration: " << callback_duration << "ms, FPS: " << get()->additional_data.fps << ", Max Duration: " << callback_warning_duration << "ms)"); diff --git a/src/archive.h b/src/archive.h index e12809eb17..46157b2a30 100644 --- a/src/archive.h +++ b/src/archive.h @@ -8,7 +8,7 @@ #include #include -namespace rsimpl2 +namespace librealsense { class frame_archive; class md_attribute_parser_base; @@ -63,8 +63,8 @@ struct frame private: // TODO: check boost::intrusive_ptr or an alternative std::atomic ref_count; // the reference count is on how many times this placeholder has been observed (not lifetime, not content) - std::shared_ptr owner; // pointer to the owner to be returned to by last observe - rsimpl2::frame_continuation on_release; + std::shared_ptr owner; // pointer to the owner to be returned to by last observe + librealsense::frame_continuation on_release; public: std::vector data; @@ -120,11 +120,11 @@ struct frame void acquire() { ref_count.fetch_add(1); } void release(); - frame* publish(std::shared_ptr new_owner); - void attach_continuation(rsimpl2::frame_continuation&& continuation) { on_release = std::move(continuation); } + frame* publish(std::shared_ptr new_owner); + void attach_continuation(librealsense::frame_continuation&& continuation) { on_release = std::move(continuation); } void disable_continuation() { on_release.reset(); } - rsimpl2::frame_archive* get_owner() const { return owner.get(); } + librealsense::frame_archive* get_owner() const { return owner.get(); } }; struct rs2_frame // esentially an intrusive shared_ptr @@ -165,7 +165,7 @@ struct rs2_frame // esentially an intrusive shared_ptr std::swap(frame_ptr, other.frame_ptr); } - void attach_continuation(rsimpl2::frame_continuation&& continuation) const + void attach_continuation(librealsense::frame_continuation&& continuation) const { if (frame_ptr) frame_ptr->attach_continuation(std::move(continuation)); } @@ -186,7 +186,7 @@ struct rs2_frame // esentially an intrusive shared_ptr -namespace rsimpl2 +namespace librealsense { typedef std::map> metadata_parser_map; diff --git a/src/backend.h b/src/backend.h index 7cf81de7b5..da938de17f 100644 --- a/src/backend.h +++ b/src/backend.h @@ -29,7 +29,7 @@ const uint16_t DELAY_FOR_RETRIES = 50; const uint8_t MAX_META_DATA_SIZE = 0xff; // UVC Metadata total length // is limited by design to 255 bytes -namespace rsimpl2 +namespace librealsense { struct notification; diff --git a/src/context.cpp b/src/context.cpp index d303c8bd8d..98a59363be 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -36,7 +36,7 @@ constexpr std::array concat(char const (&a1)[N1], char cons // The string is used to retrieve the version embedded into .so file on Linux constexpr auto rs2_api_version = concat("VERSION: ",RS2_API_VERSION_STR); -namespace rsimpl2 +namespace librealsense { context::context(backend_type type, const char* filename, @@ -75,7 +75,7 @@ namespace rsimpl2 auto color_ep = std::make_shared("RGB Camera", uvc, std::unique_ptr(new ds5_timestamp_reader(ts)), ts); add_sensor(color_ep); - register_info(RS2_CAMERA_INFO_DEVICE_NAME, "Platform Camera"); + register_info(RS2_CAMERA_INFO_NAME, "Platform Camera"); color_ep->register_pixel_format(pf_yuy2); color_ep->register_pixel_format(pf_yuyv); @@ -144,7 +144,7 @@ namespace rsimpl2 auto old_list = create_devices(old); auto new_list = create_devices(curr); - if (rsimpl2::list_changed>(old_list, new_list, [](std::shared_ptr first, std::shared_ptr second) {return *first == *second; })) + if (librealsense::list_changed>(old_list, new_list, [](std::shared_ptr first, std::shared_ptr second) {return *first == *second; })) { std::vector rs2_devices_info_added; diff --git a/src/context.h b/src/context.h index 2fc2c9f20f..9491268cad 100644 --- a/src/context.h +++ b/src/context.h @@ -10,7 +10,7 @@ #include -namespace rsimpl2 +namespace librealsense { class context; class device_info; @@ -18,23 +18,23 @@ namespace rsimpl2 struct rs2_device_info { - std::shared_ptr ctx; - std::shared_ptr info; + std::shared_ptr ctx; + std::shared_ptr info; }; struct rs2_device_list { - std::shared_ptr ctx; + std::shared_ptr ctx; std::vector list; }; struct rs2_sensor_list { - std::shared_ptr dev; + std::shared_ptr dev; }; -namespace rsimpl2 +namespace librealsense { class device; class context; diff --git a/src/core/debug.h b/src/core/debug.h index b0ab1be2a0..c474bb0b32 100644 --- a/src/core/debug.h +++ b/src/core/debug.h @@ -6,7 +6,7 @@ #include -namespace rsimpl2 +namespace librealsense { class debug_interface : public virtual device_interface { diff --git a/src/core/info.h b/src/core/info.h index f72696e15f..2c24851ace 100644 --- a/src/core/info.h +++ b/src/core/info.h @@ -4,7 +4,7 @@ #include -namespace rsimpl2 +namespace librealsense { class debug_interface : public device_interface { diff --git a/src/core/motion.h b/src/core/motion.h index 8a9195993c..0f388f6e49 100644 --- a/src/core/motion.h +++ b/src/core/motion.h @@ -6,7 +6,7 @@ #include "streaming.h" -namespace rsimpl2 +namespace librealsense { class motion_sensor_interface : public virtual sensor_interface { diff --git a/src/core/options.h b/src/core/options.h index 5f302651c9..1bad36d5bb 100644 --- a/src/core/options.h +++ b/src/core/options.h @@ -4,7 +4,7 @@ #include "../include/librealsense/rs2.h" -namespace rsimpl2 +namespace librealsense { struct option_range { diff --git a/src/core/roi.h b/src/core/roi.h index d72d247e87..dcc138df36 100644 --- a/src/core/roi.h +++ b/src/core/roi.h @@ -6,7 +6,7 @@ #include -namespace rsimpl2 +namespace librealsense { struct region_of_interest { diff --git a/src/core/streaming.h b/src/core/streaming.h index 411a22e306..2d202e4643 100644 --- a/src/core/streaming.h +++ b/src/core/streaming.h @@ -6,7 +6,7 @@ #include -namespace rsimpl2 +namespace librealsense { class stream_profile_interface { diff --git a/src/core/video.h b/src/core/video.h index f62482abc2..1561c87782 100644 --- a/src/core/video.h +++ b/src/core/video.h @@ -4,7 +4,7 @@ #include "streaming.h" -namespace rsimpl2 +namespace librealsense { struct stream_profile; diff --git a/src/device.cpp b/src/device.cpp index ba46811910..95066d97cd 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -4,7 +4,7 @@ #include "device.h" #include "image.h" -using namespace rsimpl2; +using namespace librealsense; #include diff --git a/src/device.h b/src/device.h index 48842863c1..34c9cc8460 100644 --- a/src/device.h +++ b/src/device.h @@ -15,7 +15,7 @@ #include "sync.h" #include "core/streaming.h" -namespace rsimpl2 +namespace librealsense { class device : public virtual device_interface, public info_container { diff --git a/src/ds5.cpp b/src/ds5.cpp deleted file mode 100644 index 5118bc0f39..0000000000 --- a/src/ds5.cpp +++ /dev/null @@ -1,811 +0,0 @@ -// License: Apache 2.0. See LICENSE file in root directory. -// Copyright(c) 2016 Intel Corporation. All Rights Reserved. - -#include -#include -#include -#include -#include - -#include "device.h" -#include "context.h" -#include "image.h" - -#include "metadata-parser.h" -#include "ds5.h" -#include "ds5-private.h" -#include "ds5-options.h" -#include "ds5-timestamp.h" - -namespace rsimpl2 -{ - class ds5_auto_exposure_roi_method : public region_of_interest_method - { - public: - ds5_auto_exposure_roi_method(const hw_monitor& hwm) : _hw_monitor(hwm) {} - - void set(const region_of_interest& roi) override - { - command cmd(ds::SETAEROI); - cmd.param1 = roi.min_y; - cmd.param2 = roi.max_y; - cmd.param3 = roi.min_x; - cmd.param4 = roi.max_x; - _hw_monitor.send(cmd); - } - - region_of_interest get() const override - { - region_of_interest roi; - command cmd(ds::GETAEROI); - auto res = _hw_monitor.send(cmd); - - if (res.size() < 4 * sizeof(uint16_t)) - { - throw std::runtime_error("Invalid result size!"); - } - - auto words = reinterpret_cast(res.data()); - - roi.min_y = words[0]; - roi.max_y = words[1]; - roi.min_x = words[2]; - roi.max_x = words[3]; - - return roi; - } - - private: - const hw_monitor& _hw_monitor; - }; - - class fisheye_auto_exposure_roi_method : public region_of_interest_method - { - public: - fisheye_auto_exposure_roi_method(std::shared_ptr auto_exposure) - : _auto_exposure(auto_exposure) - {} - - void set(const region_of_interest& roi) override - { - _auto_exposure->update_auto_exposure_roi(roi); - _roi = roi; - } - - region_of_interest get() const override - { - return _roi; - } - - private: - std::shared_ptr _auto_exposure; - region_of_interest _roi{}; - }; - - std::shared_ptr ds5_info::create(const uvc::backend& backend) const - { - return std::make_shared(backend, _depth, _hwm, _hid); - } - - std::vector> ds5_info::pick_ds5_devices( - std::shared_ptr backend, - std::vector& uvc, - std::vector& usb, - std::vector& hid) - { - std::vector chosen; - std::vector> results; - - auto valid_pid = filter_by_product(uvc, ds::rs4xx_sku_pid); - auto group_devices = group_devices_and_hids_by_unique_id(group_devices_by_unique_id(valid_pid), hid); - for (auto& group : group_devices) - { - auto& devices = group.first; - auto& hids = group.second; - - if((group.first[0].pid == ds::RS430_MM_PID || group.first[0].pid == ds::RS420_MM_PID) && hids.size()==0) - continue; - - if (!devices.empty() && - mi_present(devices, 0)) - { - uvc::usb_device_info hwm; - - std::vector hwm_devices; - if (ds::try_fetch_usb_device(usb, devices.front(), hwm)) - { - hwm_devices.push_back(hwm); - } - else - { - LOG_DEBUG("try_fetch_usb_device(...) failed."); - } - - auto info = std::make_shared(backend, devices, hwm_devices, hids); - chosen.insert(chosen.end(), devices.begin(), devices.end()); - results.push_back(info); - - } - else - { - LOG_WARNING("DS5 group_devices is empty."); - } - } - - trim_device_list(uvc, chosen); - - return results; - } - - rs2_motion_device_intrinsic ds5_camera::get_motion_intrinsics(rs2_stream stream) const - { - if (stream == RS2_STREAM_ACCEL) - return create_motion_intrinsics(*_accel_intrinsics); - - if (stream == RS2_STREAM_GYRO) - return create_motion_intrinsics(*_gyro_intrinsics); - - return device::get_motion_intrinsics(stream); - } - - std::vector ds5_camera::send_receive_raw_data(const std::vector& input) - { - return _hw_monitor->send(input); - } - - void ds5_camera::hardware_reset() - { - command cmd(ds::HWRST); - _hw_monitor->send(cmd); - } - - rs2_intrinsics ds5_camera::get_intrinsics(unsigned int subdevice, const stream_profile& profile) const - { - if (subdevice >= get_endpoints_count()) - throw invalid_value_exception(to_string() << "Requested subdevice " << - subdevice << " is unsupported."); - - if (subdevice == _depth_device_idx) - { - return get_intrinsic_by_resolution( - *_coefficients_table_raw, - ds::calibration_table_id::coefficients_table_id, - profile.width, profile.height); - } - - if (subdevice == _fisheye_device_idx) - { - return get_intrinsic_by_resolution( - *_fisheye_intrinsics_raw, - ds::calibration_table_id::fisheye_calibration_id, - profile.width, profile.height); - } - throw not_implemented_exception("Not Implemented"); - } - - pose ds5_camera::get_device_position(unsigned int subdevice) const - { - if (subdevice >= get_endpoints_count()) - throw invalid_value_exception(to_string() << "Requested subdevice " << - subdevice << " is unsupported."); - - if (subdevice == _fisheye_device_idx) - { - auto extr = rsimpl2::ds::get_fisheye_extrinsics_data(*_fisheye_extrinsics_raw); - return inverse(extr); - } - - if (subdevice == _motion_module_device_idx) - { - // Fist, get Fish-eye pose - auto fe_pose = get_device_position(_fisheye_device_idx); - - auto motion_extr = *_motion_module_extrinsics_raw; - - auto rot = motion_extr.rotation; - auto trans = motion_extr.translation; - - pose ex = {{rot(0,0), rot(1,0),rot(2,0),rot(1,0), rot(1,1),rot(2,1),rot(0,2), rot(1,2),rot(2,2)}, - {trans[0], trans[1], trans[2]}}; - - return fe_pose * ex; - } - - throw not_implemented_exception("Not Implemented"); - } - - bool ds5_camera::is_camera_in_advanced_mode() const - { - command cmd(ds::UAMG); - assert(_hw_monitor); - auto ret = _hw_monitor->send(cmd); - if (ret.empty()) - throw invalid_value_exception("command result is empty!"); - - return (0 != ret.front()); - } - - std::vector ds5_camera::get_raw_calibration_table(ds::calibration_table_id table_id) const - { - command cmd(ds::GETINTCAL, table_id); - return _hw_monitor->send(cmd); - } - - std::vector ds5_camera::get_raw_fisheye_intrinsics_table() const - { - const int offset = 0x84; - const int size = 0x98; - command cmd(ds::MMER, offset, size); - return _hw_monitor->send(cmd); - } - - ds::imu_calibration_table ds5_camera::get_motion_module_calibration_table() const - { - const int offset = 0x134; - const int size = sizeof(ds::imu_calibration_table); - command cmd(ds::MMER, offset, size); - auto result = _hw_monitor->send(cmd); - if (result.size() < sizeof(ds::imu_calibration_table)) - throw std::runtime_error("Not enough data returned from the device!"); - - auto table = ds::check_calib(result); - - return *table; - } - - std::vector ds5_camera::get_raw_fisheye_extrinsics_table() const - { - command cmd(ds::GET_EXTRINSICS); - return _hw_monitor->send(cmd); - } - - std::shared_ptr ds5_camera::create_hid_device(const uvc::backend& backend, - const std::vector& all_hid_infos, - const firmware_version& camera_fw_version) - { - if (all_hid_infos.empty()) - { - throw std::runtime_error("HID device is missing!"); - } - - static const char* custom_sensor_fw_ver = "5.6.0.0"; - if (camera_fw_version >= firmware_version(custom_sensor_fw_ver)) - { - static const std::vector> custom_sensor_profiles = - {{std::string("custom"), {RS2_STREAM_GPIO1, 1, 1, 1, RS2_FORMAT_GPIO_RAW}}, - {std::string("custom"), {RS2_STREAM_GPIO2, 1, 1, 1, RS2_FORMAT_GPIO_RAW}}, - {std::string("custom"), {RS2_STREAM_GPIO3, 1, 1, 1, RS2_FORMAT_GPIO_RAW}}, - {std::string("custom"), {RS2_STREAM_GPIO4, 1, 1, 1, RS2_FORMAT_GPIO_RAW}}}; - std::copy(custom_sensor_profiles.begin(), custom_sensor_profiles.end(), std::back_inserter(sensor_name_and_hid_profiles)); - } - - auto hid_ep = std::make_shared(backend.create_hid_device(all_hid_infos.front()), - std::unique_ptr(new ds5_iio_hid_timestamp_reader()), - std::unique_ptr(new ds5_custom_hid_timestamp_reader()), - fps_and_sampling_frequency_per_rs2_stream, - sensor_name_and_hid_profiles, - backend.create_time_service()); - hid_ep->register_pixel_format(pf_accel_axes); - hid_ep->register_pixel_format(pf_gyro_axes); - - - hid_ep->set_pose(lazy([](){pose p = {{ { 1,0,0 },{ 0,1,0 },{ 0,0,1 } },{ 0,0,0 }}; return p; })); - - if (camera_fw_version >= firmware_version(custom_sensor_fw_ver)) - { - hid_ep->register_option(RS2_OPTION_MOTION_MODULE_TEMPERATURE, - std::make_shared(*hid_ep)); - hid_ep->register_pixel_format(pf_gpio_timestamp); - } - - return hid_ep; - } - - std::shared_ptr ds5_camera::create_depth_device(const uvc::backend& backend, - const std::vector& all_device_infos) - { - using namespace ds; - - std::vector> depth_devices; - for (auto&& info : filter_by_mi(all_device_infos, 0)) // Filter just mi=0, DEPTH - depth_devices.push_back(backend.create_uvc_device(info)); - - - std::unique_ptr ds5_timestamp_reader_backup(new ds5_timestamp_reader(backend.create_time_service())); - auto depth_ep = std::make_shared(std::make_shared(depth_devices), - std::unique_ptr(new ds5_timestamp_reader_from_metadata(std::move(ds5_timestamp_reader_backup))), - backend.create_time_service()); - depth_ep->register_xu(depth_xu); // make sure the XU is initialized everytime we power the camera - - - depth_ep->register_pixel_format(pf_z16); // Depth - depth_ep->register_pixel_format(pf_y8); // Left Only - Luminance - depth_ep->register_pixel_format(pf_yuyv); // Left Only - depth_ep->register_pixel_format(pf_uyvyl); // Color from Depth - depth_ep->register_pixel_format(pf_rgb888); - - - // TODO: These if conditions will be implemented as inheritance classes - auto pid = all_device_infos.front().pid; - if ((pid == RS410_PID) || (pid == RS430_MM_PID) || (pid == RS430_PID) || (pid == RS430_MM_RGB_PID) || (pid == RS435_RGB_PID)) - { - depth_ep->register_option(RS2_OPTION_EMITTER_ENABLED, std::make_shared(*depth_ep)); - - depth_ep->register_option(RS2_OPTION_LASER_POWER, - std::make_shared>(*depth_ep, - depth_xu, - DS5_LASER_POWER, "Manual laser power in mw. applicable only when laser power mode is set to Manual")); - } - - depth_ep->set_pose(lazy([](){pose p = {{ { 1,0,0 },{ 0,1,0 },{ 0,0,1 } },{ 0,0,0 }}; return p; })); - - return depth_ep; - } - - std::shared_ptr ds5_camera::create_color_device(const uvc::backend& backend, - const std::vector& color_devices_info) - { - - std::unique_ptr ds5_timestamp_reader_backup(new ds5_timestamp_reader(backend.create_time_service())); - - auto color_ep = std::make_shared(backend.create_uvc_device(color_devices_info.front()), - std::unique_ptr(new ds5_timestamp_reader_from_metadata(std::move(ds5_timestamp_reader_backup))), - backend.create_time_service()); - - _color_device_idx = add_endpoint(color_ep); - - color_ep->register_pixel_format(pf_yuyv); - color_ep->register_pixel_format(pf_yuy2); - color_ep->register_pixel_format(pf_bayer16); - - color_ep->register_pu(RS2_OPTION_BACKLIGHT_COMPENSATION); - color_ep->register_pu(RS2_OPTION_BRIGHTNESS); - color_ep->register_pu(RS2_OPTION_CONTRAST); - color_ep->register_pu(RS2_OPTION_EXPOSURE); - color_ep->register_pu(RS2_OPTION_GAIN); - color_ep->register_pu(RS2_OPTION_GAMMA); - color_ep->register_pu(RS2_OPTION_HUE); - color_ep->register_pu(RS2_OPTION_SATURATION); - color_ep->register_pu(RS2_OPTION_SHARPNESS); - color_ep->register_pu(RS2_OPTION_WHITE_BALANCE); - color_ep->register_pu(RS2_OPTION_ENABLE_AUTO_EXPOSURE); - color_ep->register_pu(RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE); - - return color_ep; - } - - std::shared_ptr ds5_camera::register_auto_exposure_options(uvc_endpoint* uvc_ep, const uvc::extension_unit* fisheye_xu) - { - auto gain_option = std::make_shared(*uvc_ep, RS2_OPTION_GAIN); - - auto exposure_option = std::make_shared>(*uvc_ep, - *fisheye_xu, - rsimpl2::ds::FISHEYE_EXPOSURE, "Exposure time of Fisheye camera"); - - auto ae_state = std::make_shared(); - auto auto_exposure = std::make_shared(*gain_option, *exposure_option, *ae_state); - - auto auto_exposure_option = std::make_shared(uvc_ep, - auto_exposure, - ae_state, - option_range{0, 1, 1, 1}); - - uvc_ep->register_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE,auto_exposure_option); - - uvc_ep->register_option(RS2_OPTION_AUTO_EXPOSURE_MODE, - std::make_shared(auto_exposure, - ae_state, - option_range{0, 2, 1, 0}, - std::map{{0.f, "Static"}, - {1.f, "Anti-Flicker"}, - {2.f, "Hybrid"}})); - uvc_ep->register_option(RS2_OPTION_AUTO_EXPOSURE_ANTIFLICKER_RATE, - std::make_shared(auto_exposure, - ae_state, - option_range{50, 60, 10, 60}, - std::map{{50.f, "50Hz"}, - {60.f, "60Hz"}})); - - - uvc_ep->register_option(RS2_OPTION_GAIN, - std::make_shared( - gain_option, - auto_exposure_option)); - - uvc_ep->register_option(RS2_OPTION_EXPOSURE, - std::make_shared( - exposure_option, - auto_exposure_option)); - - return auto_exposure; - } - - ds5_camera::ds5_camera(const uvc::backend& backend, - const std::vector& dev_info, - const std::vector& hwm_device, - const std::vector& hid_info) - : _depth_device_idx(add_endpoint(create_depth_device(backend, dev_info))) - { - using namespace ds; - - if(hwm_device.size()>0) - { - _hw_monitor = std::make_shared( - std::make_shared( - backend.create_usb_device(hwm_device.front()), get_depth_endpoint())); - } - else - { - _hw_monitor = std::make_shared( - std::make_shared( - std::make_shared( - get_depth_endpoint(), rsimpl2::ds::depth_xu, rsimpl2::ds::DS5_HWMONITOR), - get_depth_endpoint())); - } - - _coefficients_table_raw = [this]() { return get_raw_calibration_table(coefficients_table_id); }; - _fisheye_intrinsics_raw = [this]() { return get_raw_fisheye_intrinsics_table(); }; - _fisheye_extrinsics_raw = [this]() { return get_raw_fisheye_extrinsics_table(); }; - _motion_module_extrinsics_raw = [this]() { return get_motion_module_calibration_table().imu_to_fisheye; }; - _accel_intrinsics = [this](){ return get_motion_module_calibration_table().accel_intrinsics; }; - _gyro_intrinsics = [this](){ return get_motion_module_calibration_table().gyro_intrinsics; }; - - std::string device_name = (rs4xx_sku_names.end() != rs4xx_sku_names.find(dev_info.front().pid)) ? rs4xx_sku_names.at(dev_info.front().pid) : "RS4xx"; - auto camera_fw_version = firmware_version(_hw_monitor->get_firmware_version_string(GVD, camera_fw_version_offset)); - auto serial = _hw_monitor->get_module_serial_string(GVD, module_serial_offset); - - - auto& depth_ep = get_depth_endpoint(); - auto advanced_mode = is_camera_in_advanced_mode(); - if (advanced_mode) - { - depth_ep.register_pixel_format(pf_y8i); // L+R - depth_ep.register_pixel_format(pf_y12i); // L+R - Calibration not rectified - } - - std::string motion_module_fw_version{""}; - auto pid = dev_info.front().pid; - auto pid_hex_str = hexify(pid>>8) + hexify(static_cast(pid)); - - std::string is_camera_locked{""}; - if (camera_fw_version >= firmware_version("5.6.3.0")) - { - auto is_locked = _hw_monitor->is_camera_locked(GVD, is_camera_locked_offset); - is_camera_locked = (is_locked)?"YES":"NO"; - -#ifdef HWM_OVER_XU - //if hw_monitor was created by usb replace it xu - if(hwm_device.size() > 0) - { - _hw_monitor = std::make_shared( - std::make_shared( - std::make_shared( - get_depth_endpoint(), rsimpl2::ds::depth_xu, rsimpl2::ds::DS5_HWMONITOR), - get_depth_endpoint())); - } -#endif - - depth_ep.register_pu(RS2_OPTION_GAIN); - auto exposure_option = std::make_shared>(depth_ep, - depth_xu, - DS5_EXPOSURE, - "Depth Exposure"); - depth_ep.register_option(RS2_OPTION_EXPOSURE, exposure_option); - - auto enable_auto_exposure = std::make_shared>(depth_ep, - depth_xu, - DS5_ENABLE_AUTO_EXPOSURE, - "Enable Auto Exposure"); - depth_ep.register_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, enable_auto_exposure); - - depth_ep.register_option(RS2_OPTION_GAIN, - std::make_shared( - std::make_shared(depth_ep, RS2_OPTION_GAIN), - enable_auto_exposure)); - depth_ep.register_option(RS2_OPTION_EXPOSURE, - std::make_shared( - exposure_option, - enable_auto_exposure)); - - // ASR/PRS SKUs support Auto-WB - if (pid == RS400_PID || pid == RS400_MM_PID || pid == RS410_PID || pid == RS410_MM_PID || pid == RS415_PID) - { - depth_ep.register_option(RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE, - std::make_shared>(depth_ep, - depth_xu, - DS5_ENABLE_AUTO_WHITE_BALANCE, - "Enable Auto White Balance")); - } - } - - if (camera_fw_version >= firmware_version("5.5.8.0")) - { - depth_ep.register_option(RS2_OPTION_OUTPUT_TRIGGER_ENABLED, - std::make_shared>(depth_ep, depth_xu, DS5_EXT_TRIGGER, - "Generate trigger from the camera to external device once per frame")); - - auto error_control = std::unique_ptr>(new uvc_xu_option(depth_ep, depth_xu, DS5_ERROR_REPORTING, "Error reporting")); - - _polling_error_handler = std::unique_ptr( - new polling_error_handler(1000, - std::move(error_control), - depth_ep.get_notifications_proccessor(), - - std::unique_ptr(new ds5_notification_decoder()))); - - _polling_error_handler->start(); - - depth_ep.register_option(RS2_OPTION_ERROR_POLLING_ENABLED, std::make_shared(_polling_error_handler.get())); - - if (pid == RS410_PID || pid == RS430_MM_PID || pid == RS430_PID) - { - depth_ep.register_option(RS2_OPTION_PROJECTOR_TEMPERATURE, - std::make_shared(depth_ep, - RS2_OPTION_PROJECTOR_TEMPERATURE)); - } - depth_ep.register_option(RS2_OPTION_ASIC_TEMPERATURE, - std::make_shared(depth_ep, - RS2_OPTION_ASIC_TEMPERATURE)); - if (pid == RS430_MM_PID || pid == RS420_MM_PID) - motion_module_fw_version = _hw_monitor->get_firmware_version_string(GVD, motion_module_fw_version_offset); - } - - depth_ep.set_roi_method(std::make_shared(*_hw_monitor)); - - if (advanced_mode) - depth_ep.register_option(RS2_OPTION_DEPTH_UNITS, std::make_shared(*_hw_monitor)); - else - depth_ep.register_option(RS2_OPTION_DEPTH_UNITS, std::make_shared("Number of meters represented by a single depth unit", - 0.001f)); - // Metadata registration - depth_ep.register_metadata(RS2_FRAME_METADATA_FRAME_TIMESTAMP, make_uvc_header_parser(&uvc::uvc_header::timestamp)); - - // attributes of md_capture_timing - auto md_prop_offset = offsetof(metadata_raw, mode) + - offsetof(md_depth_mode, depth_y_mode) + - offsetof(md_depth_y_normal_mode, intel_capture_timing); - - depth_ep.register_metadata(RS2_FRAME_METADATA_FRAME_COUNTER, make_attribute_parser(&md_capture_timing::frame_counter, md_capture_timing_attributes::frame_counter_attribute,md_prop_offset)); - depth_ep.register_metadata(RS2_FRAME_METADATA_SENSOR_TIMESTAMP, make_rs4xx_sensor_ts_parser(make_uvc_header_parser(&uvc::uvc_header::timestamp), - make_attribute_parser(&md_capture_timing::sensor_timestamp, md_capture_timing_attributes::sensor_timestamp_attribute, md_prop_offset))); - - // attributes of md_capture_stats - md_prop_offset = offsetof(metadata_raw, mode) + - offsetof(md_depth_mode, depth_y_mode) + - offsetof(md_depth_y_normal_mode, intel_capture_stats); - - depth_ep.register_metadata(RS2_FRAME_METADATA_WHITE_BALANCE, make_attribute_parser(&md_capture_stats::white_balance, md_capture_stat_attributes::white_balance_attribute, md_prop_offset)); - - // attributes of md_depth_control - md_prop_offset = offsetof(metadata_raw, mode) + - offsetof(md_depth_mode, depth_y_mode) + - offsetof(md_depth_y_normal_mode, intel_depth_control); - - depth_ep.register_metadata(RS2_FRAME_METADATA_GAIN_LEVEL, make_attribute_parser(&md_depth_control::manual_gain, md_depth_control_attributes::gain_attribute, md_prop_offset)); - depth_ep.register_metadata(RS2_FRAME_METADATA_ACTUAL_EXPOSURE, make_attribute_parser(&md_depth_control::manual_exposure, md_depth_control_attributes::exposure_attribute, md_prop_offset)); - depth_ep.register_metadata(RS2_FRAME_METADATA_AUTO_EXPOSURE, make_attribute_parser(&md_depth_control::auto_exposure_mode, md_depth_control_attributes::ae_mode_attribute, md_prop_offset)); - - // md_configuration - will be used for internal validation only - md_prop_offset = offsetof(metadata_raw, mode) + offsetof(md_depth_mode, depth_y_mode) + offsetof(md_depth_y_normal_mode, intel_configuration); - - depth_ep.register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_HW_TYPE, make_attribute_parser(&md_configuration::hw_type, md_configuration_attributes::hw_type_attribute, md_prop_offset)); - depth_ep.register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_SKU_ID, make_attribute_parser(&md_configuration::sku_id, md_configuration_attributes::sku_id_attribute, md_prop_offset)); - depth_ep.register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_FORMAT, make_attribute_parser(&md_configuration::format, md_configuration_attributes::format_attribute, md_prop_offset)); - depth_ep.register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_WIDTH, make_attribute_parser(&md_configuration::width, md_configuration_attributes::width_attribute, md_prop_offset)); - depth_ep.register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_HEIGHT, make_attribute_parser(&md_configuration::height, md_configuration_attributes::height_attribute, md_prop_offset)); - - std::shared_ptr fisheye_ep; - - if (pid == RS430_MM_PID || pid == RS420_MM_PID) - { - auto fisheye_infos = filter_by_mi(dev_info, 3); - if (fisheye_infos.size() != 1) - throw invalid_value_exception("RS450 model is expected to include a single fish-eye device!"); - - std::unique_ptr ds5_timestamp_reader_backup(new ds5_timestamp_reader(backend.create_time_service())); - - fisheye_ep = std::make_shared(backend.create_uvc_device(fisheye_infos.front()), - std::unique_ptr(new ds5_timestamp_reader_from_metadata(std::move(ds5_timestamp_reader_backup))), - backend.create_time_service()); - - fisheye_ep->register_xu(fisheye_xu); // make sure the XU is initialized everytime we power the camera - fisheye_ep->register_pixel_format(pf_raw8); - fisheye_ep->register_pixel_format(pf_fe_raw8_unpatched_kernel); // W/O for unpatched kernel - - if (camera_fw_version >= firmware_version("5.6.3.0")) // Create Auto Exposure controls from FW version 5.6.3.0 - { - auto fisheye_auto_exposure = register_auto_exposure_options(fisheye_ep.get(), &fisheye_xu); - fisheye_ep->set_roi_method(std::make_shared(fisheye_auto_exposure)); - } - else - { - fisheye_ep->register_option(RS2_OPTION_GAIN, - std::make_shared(*fisheye_ep.get(), - RS2_OPTION_GAIN)); - fisheye_ep->register_option(RS2_OPTION_EXPOSURE, - std::make_shared>(*fisheye_ep.get(), - fisheye_xu, - rsimpl2::ds::FISHEYE_EXPOSURE, - "Exposure time of Fisheye camera")); - } - - // Metadata registration - fisheye_ep->register_metadata(RS2_FRAME_METADATA_FRAME_TIMESTAMP, make_uvc_header_parser(&uvc::uvc_header::timestamp)); - fisheye_ep->register_metadata(RS2_FRAME_METADATA_AUTO_EXPOSURE, make_additional_data_parser(&frame_additional_data::fisheye_ae_mode)); - - // attributes of md_capture_timing - md_prop_offset = offsetof(metadata_raw, mode) + - offsetof(md_fisheye_mode, fisheye_mode) + - offsetof(md_fisheye_normal_mode, intel_capture_timing); - - fisheye_ep->register_metadata(RS2_FRAME_METADATA_FRAME_COUNTER, make_attribute_parser(&md_capture_timing::frame_counter, md_capture_timing_attributes::frame_counter_attribute,md_prop_offset)); - fisheye_ep->register_metadata(RS2_FRAME_METADATA_SENSOR_TIMESTAMP, make_rs4xx_sensor_ts_parser(make_uvc_header_parser(&uvc::uvc_header::timestamp), - make_attribute_parser(&md_capture_timing::sensor_timestamp, md_capture_timing_attributes::sensor_timestamp_attribute, md_prop_offset))); - - // attributes of md_capture_stats - md_prop_offset = offsetof(metadata_raw, mode) + - offsetof(md_fisheye_mode, fisheye_mode) + - offsetof(md_fisheye_normal_mode, intel_capture_stats); - - // attributes of md_capture_stats - md_prop_offset = offsetof(metadata_raw, mode) + - offsetof(md_fisheye_mode, fisheye_mode) + - offsetof(md_fisheye_normal_mode, intel_configuration); - - fisheye_ep->register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_HW_TYPE, make_attribute_parser(&md_configuration::hw_type, md_configuration_attributes::hw_type_attribute, md_prop_offset)); - fisheye_ep->register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_SKU_ID, make_attribute_parser(&md_configuration::sku_id, md_configuration_attributes::sku_id_attribute, md_prop_offset)); - fisheye_ep->register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_FORMAT, make_attribute_parser(&md_configuration::format, md_configuration_attributes::format_attribute, md_prop_offset)); - fisheye_ep->register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_WIDTH, make_attribute_parser(&md_configuration::width, md_configuration_attributes::width_attribute, md_prop_offset)); - fisheye_ep->register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_HEIGHT, make_attribute_parser(&md_configuration::height, md_configuration_attributes::height_attribute, md_prop_offset)); - - // attributes of md_fisheye_control - md_prop_offset = offsetof(metadata_raw, mode) + - offsetof(md_fisheye_mode, fisheye_mode) + - offsetof(md_fisheye_normal_mode, intel_fisheye_control); - - fisheye_ep->register_metadata(RS2_FRAME_METADATA_GAIN_LEVEL, make_attribute_parser(&md_fisheye_control::manual_gain, md_depth_control_attributes::gain_attribute, md_prop_offset)); - fisheye_ep->register_metadata(RS2_FRAME_METADATA_ACTUAL_EXPOSURE, make_attribute_parser(&md_fisheye_control::manual_exposure, md_depth_control_attributes::exposure_attribute, md_prop_offset)); - - // Add fisheye endpoint - _fisheye_device_idx = add_endpoint(fisheye_ep); - - fisheye_ep->set_pose(lazy([this](){return get_device_position(_fisheye_device_idx);})); - - // Add hid endpoint - auto hid_ep = create_hid_device(backend, hid_info, camera_fw_version); - _motion_module_device_idx = add_endpoint(hid_ep); - - try - { - hid_ep->register_option(RS2_OPTION_ENABLE_MOTION_CORRECTION, - std::make_shared(hid_ep.get(), - *_accel_intrinsics, - *_gyro_intrinsics, - option_range{0, 1, 1, 1})); - } - catch (const std::exception& ex) - { - LOG_ERROR("Motion Device is not calibrated! Motion Data Correction will not be available! Error: " << ex.what()); - } - - for (auto& elem : hid_info) - { - std::map camera_info = {{RS2_CAMERA_INFO_DEVICE_NAME, device_name}, - {RS2_CAMERA_INFO_MODULE_NAME, "Motion Module"}, - {RS2_CAMERA_INFO_DEVICE_SERIAL_NUMBER, serial}, - {RS2_CAMERA_INFO_CAMERA_FIRMWARE_VERSION, static_cast(camera_fw_version)}, - {RS2_CAMERA_INFO_DEVICE_LOCATION, elem.device_path}, - {RS2_CAMERA_INFO_DEVICE_DEBUG_OP_CODE, std::to_string(static_cast(fw_cmd::GLD))}, - {RS2_CAMERA_INFO_PRODUCT_ID, pid_hex_str}}; - if (!motion_module_fw_version.empty()) - camera_info[RS2_CAMERA_INFO_MOTION_MODULE_FIRMWARE_VERSION] = motion_module_fw_version; - - if (!is_camera_locked.empty()) - camera_info[RS2_CAMERA_INFO_IS_CAMERA_LOCKED] = is_camera_locked; - - register_endpoint_info(_motion_module_device_idx, camera_info); - hid_ep->set_pose(lazy([this](){return get_device_position(_motion_module_device_idx); })); - } - } - - std::shared_ptr color_ep; - // Add RGB Sensor - if ((pid == RS415_PID) || (pid == RS430_MM_RGB_PID) || (pid == RS435_RGB_PID)) - { - auto color_devs_info = filter_by_mi(dev_info, 3); // TODO check - if (color_devs_info.size() != 1) - throw invalid_value_exception(to_string() << "RS4XX with RGB models are expected to include a single color device! - " - << color_devs_info.size() << " found"); - - color_ep = create_color_device(backend, color_devs_info); - color_ep->set_pose(lazy([]() {return pose{ { { 1,0,0 },{ 0,1,0 },{ 0,0,1 } },{ 0,0,0 } }; })); // TODO: Fetch calibration extrinsic - } - - // Register endpoint info - for(auto& element : dev_info) - { - if (element.mi == 0) // mi 0 is defines RS4xx Stereo (Depth) interface - { - std::map camera_info = {{RS2_CAMERA_INFO_DEVICE_NAME, device_name}, - {RS2_CAMERA_INFO_MODULE_NAME, "Stereo Module"}, - {RS2_CAMERA_INFO_DEVICE_SERIAL_NUMBER, serial}, - {RS2_CAMERA_INFO_CAMERA_FIRMWARE_VERSION, static_cast(camera_fw_version)}, - {RS2_CAMERA_INFO_DEVICE_LOCATION, element.device_path}, - {RS2_CAMERA_INFO_DEVICE_DEBUG_OP_CODE, std::to_string(static_cast(fw_cmd::GLD))}, - {RS2_CAMERA_INFO_ADVANCED_MODE, ((advanced_mode)?"YES":"NO")}, - {RS2_CAMERA_INFO_PRODUCT_ID, pid_hex_str}}; - if (!motion_module_fw_version.empty()) - camera_info[RS2_CAMERA_INFO_MOTION_MODULE_FIRMWARE_VERSION] = motion_module_fw_version; - - if (!is_camera_locked.empty()) - camera_info[RS2_CAMERA_INFO_IS_CAMERA_LOCKED] = is_camera_locked; - - register_endpoint_info(_depth_device_idx, camera_info); - } - else if (fisheye_ep && (element.pid == RS430_MM_PID || element.pid == RS420_MM_PID) && element.mi == 3) // mi 3 is related to Fisheye device - { - std::map camera_info = {{RS2_CAMERA_INFO_DEVICE_NAME, device_name}, - {RS2_CAMERA_INFO_MODULE_NAME, "Fisheye Camera"}, - {RS2_CAMERA_INFO_DEVICE_SERIAL_NUMBER, serial}, - {RS2_CAMERA_INFO_CAMERA_FIRMWARE_VERSION, static_cast(camera_fw_version)}, - {RS2_CAMERA_INFO_DEVICE_LOCATION, element.device_path}, - {RS2_CAMERA_INFO_PRODUCT_ID, pid_hex_str}}; - if (!motion_module_fw_version.empty()) - camera_info[RS2_CAMERA_INFO_MOTION_MODULE_FIRMWARE_VERSION] = motion_module_fw_version; - - if (!is_camera_locked.empty()) - camera_info[RS2_CAMERA_INFO_IS_CAMERA_LOCKED] = is_camera_locked; - - register_endpoint_info(_fisheye_device_idx, camera_info); - } - else if (color_ep && ((element.pid == RS415_PID) || (element.pid == RS435_RGB_PID)) && element.mi == 3) // mi 3 is related to Color device - { - std::map camera_info = { { RS2_CAMERA_INFO_DEVICE_NAME, device_name }, - { RS2_CAMERA_INFO_MODULE_NAME, "RGB Camera" }, - { RS2_CAMERA_INFO_DEVICE_SERIAL_NUMBER, serial }, - { RS2_CAMERA_INFO_CAMERA_FIRMWARE_VERSION, static_cast(camera_fw_version) }, - { RS2_CAMERA_INFO_DEVICE_LOCATION, element.device_path }, - { RS2_CAMERA_INFO_PRODUCT_ID, pid_hex_str } }; - register_endpoint_info(_color_device_idx, camera_info); - } - } - } - - notification ds5_notification_decoder::decode(int value) - { - if (value == 0) - return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_ERROR, "Success" }; - if (value == ds::ds5_notifications_types::hot_laser_power_reduce) - return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_ERROR, "Hot laser power reduce" }; - if (value == ds::ds5_notifications_types::hot_laser_disable) - return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_ERROR, "Hot laser disable" }; - if (value == ds::ds5_notifications_types::flag_B_laser_disable) - return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_ERROR, "Flag B laser disable" }; - - return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_NONE, "Unknown error!" }; - } - - rs2_extrinsics ds5_camera::get_extrinsics(int from_subdevice, rs2_stream from_stream, int to_subdevice, rs2_stream to_stream) - { - auto is_left = [](rs2_stream s) { return s == RS2_STREAM_INFRARED || s == RS2_STREAM_DEPTH; }; - - if (from_subdevice == to_subdevice && from_subdevice == 0) - { - rs2_extrinsics ext { {1,0,0,0,1,0,0,0,1}, {0,0,0} }; - - if (is_left(to_stream) && from_stream == RS2_STREAM_INFRARED2) - { - auto table = ds::check_calib(*_coefficients_table_raw); - ext.translation[0] = -0.001f * table->baseline; - return ext; - } - else if (to_stream == RS2_STREAM_INFRARED2 && is_left(from_stream)) - { - auto table = ds::check_calib(*_coefficients_table_raw); - ext.translation[0] = 0.001f * table->baseline; - return ext; - } - } - return device::get_extrinsics(from_subdevice, from_stream, to_subdevice, to_stream); - } -} diff --git a/src/ds5/ds5-active.cpp b/src/ds5/ds5-active.cpp index 8ef240e2d5..f4dd4798ff 100644 --- a/src/ds5/ds5-active.cpp +++ b/src/ds5/ds5-active.cpp @@ -17,7 +17,7 @@ #include "ds5-options.h" #include "ds5-timestamp.h" -namespace rsimpl2 +namespace librealsense { ds5_active::ds5_active(const uvc::backend& backend, const std::vector& dev_info, diff --git a/src/ds5/ds5-active.h b/src/ds5/ds5-active.h index 71f1b6c662..02199415bb 100644 --- a/src/ds5/ds5-active.h +++ b/src/ds5/ds5-active.h @@ -5,7 +5,7 @@ #include "ds5-device.h" -namespace rsimpl2 +namespace librealsense { class ds5_active : public virtual ds5_device { diff --git a/src/ds5/ds5-color.cpp b/src/ds5/ds5-color.cpp index b9a681f1a4..fc75aa7e8c 100644 --- a/src/ds5/ds5-color.cpp +++ b/src/ds5/ds5-color.cpp @@ -17,7 +17,7 @@ #include "ds5-options.h" #include "ds5-timestamp.h" -namespace rsimpl2 +namespace librealsense { std::shared_ptr ds5_color::create_color_device(const uvc::backend& backend, const std::vector& color_devices_info) diff --git a/src/ds5/ds5-color.h b/src/ds5/ds5-color.h index a4bb847a97..94bd21dc9b 100644 --- a/src/ds5/ds5-color.h +++ b/src/ds5/ds5-color.h @@ -5,7 +5,7 @@ #include "ds5-device.h" -namespace rsimpl2 +namespace librealsense { class ds5_color : public virtual ds5_device { diff --git a/src/ds5/ds5-device.cpp b/src/ds5/ds5-device.cpp index 580c52b470..4ab33ce0eb 100644 --- a/src/ds5/ds5-device.cpp +++ b/src/ds5/ds5-device.cpp @@ -17,7 +17,7 @@ #include "ds5-options.h" #include "ds5-timestamp.h" -namespace rsimpl2 +namespace librealsense { class ds5_auto_exposure_roi_method : public region_of_interest_method { @@ -163,7 +163,7 @@ namespace rsimpl2 _hw_monitor = std::make_shared( std::make_shared( std::make_shared( - get_depth_sensor(), rsimpl2::ds::depth_xu, rsimpl2::ds::DS5_HWMONITOR), + get_depth_sensor(), librealsense::ds::depth_xu, librealsense::ds::DS5_HWMONITOR), get_depth_sensor())); } @@ -197,7 +197,7 @@ namespace rsimpl2 _hw_monitor = std::make_shared( std::make_shared( std::make_shared( - get_depth_sensor(), rsimpl2::ds::depth_xu, rsimpl2::ds::DS5_HWMONITOR), + get_depth_sensor(), librealsense::ds::depth_xu, librealsense::ds::DS5_HWMONITOR), get_depth_sensor())); } #endif @@ -293,11 +293,11 @@ namespace rsimpl2 depth_ep.register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_WIDTH, make_attribute_parser(&md_configuration::width, md_configuration_attributes::width_attribute, md_prop_offset)); depth_ep.register_metadata((rs2_frame_metadata)RS2_FRAME_METADATA_HEIGHT, make_attribute_parser(&md_configuration::height, md_configuration_attributes::height_attribute, md_prop_offset)); - register_info(RS2_CAMERA_INFO_DEVICE_NAME, device_name); - register_info(RS2_CAMERA_INFO_DEVICE_SERIAL_NUMBER, serial); - register_info(RS2_CAMERA_INFO_CAMERA_FIRMWARE_VERSION, _fw_version); - register_info(RS2_CAMERA_INFO_DEVICE_LOCATION, dev_info.front().device_path); - register_info(RS2_CAMERA_INFO_DEVICE_DEBUG_OP_CODE, std::to_string(static_cast(fw_cmd::GLD))); + register_info(RS2_CAMERA_INFO_NAME, device_name); + register_info(RS2_CAMERA_INFO_SERIAL_NUMBER, serial); + register_info(RS2_CAMERA_INFO_FIRMWARE_VERSION, _fw_version); + register_info(RS2_CAMERA_INFO_LOCATION, dev_info.front().device_path); + register_info(RS2_CAMERA_INFO_DEBUG_OP_CODE, std::to_string(static_cast(fw_cmd::GLD))); register_info(RS2_CAMERA_INFO_ADVANCED_MODE, ((advanced_mode)?"YES":"NO")); register_info(RS2_CAMERA_INFO_PRODUCT_ID, pid_hex_str); } diff --git a/src/ds5/ds5-device.h b/src/ds5/ds5-device.h index 84375c2d21..ba19e79c0d 100644 --- a/src/ds5/ds5-device.h +++ b/src/ds5/ds5-device.h @@ -9,7 +9,7 @@ #include "error-handling.h" #include "core/debug.h" -namespace rsimpl2 +namespace librealsense { class ds5_device : public virtual device, public debug_interface { diff --git a/src/ds5/ds5-factory.cpp b/src/ds5/ds5-factory.cpp index d06c505c09..55d92b2a47 100644 --- a/src/ds5/ds5-factory.cpp +++ b/src/ds5/ds5-factory.cpp @@ -21,7 +21,7 @@ #include "ds5-color.h" #include "ds5-motion.h" -namespace rsimpl2 +namespace librealsense { // PSR class rs400_device : public ds5_rolling_shutter diff --git a/src/ds5/ds5-factory.h b/src/ds5/ds5-factory.h index 270247b656..9b082d077c 100644 --- a/src/ds5/ds5-factory.h +++ b/src/ds5/ds5-factory.h @@ -4,7 +4,7 @@ #include "ds5-private.h" -namespace rsimpl2 +namespace librealsense { class ds5_info : public device_info { diff --git a/src/ds5/ds5-motion.cpp b/src/ds5/ds5-motion.cpp index eeb4a6aad4..831ca8d0fd 100644 --- a/src/ds5/ds5-motion.cpp +++ b/src/ds5/ds5-motion.cpp @@ -17,7 +17,7 @@ #include "ds5-motion.h" #include "core/motion.h" -namespace rsimpl2 +namespace librealsense { class fisheye_auto_exposure_roi_method : public region_of_interest_method { @@ -100,7 +100,7 @@ namespace rsimpl2 { if (subdevice == _fisheye_device_idx) { - auto extr = rsimpl2::ds::get_fisheye_extrinsics_data(*_fisheye_extrinsics_raw); + auto extr = librealsense::ds::get_fisheye_extrinsics_data(*_fisheye_extrinsics_raw); return inverse(extr); } @@ -199,7 +199,7 @@ namespace rsimpl2 auto exposure_option = std::make_shared>(*uvc_ep, *fisheye_xu, - rsimpl2::ds::FISHEYE_EXPOSURE, "Exposure time of Fisheye camera"); + librealsense::ds::FISHEYE_EXPOSURE, "Exposure time of Fisheye camera"); auto ae_state = std::make_shared(); auto auto_exposure = std::make_shared(*gain_option, *exposure_option, *ae_state); @@ -286,7 +286,7 @@ namespace rsimpl2 fisheye_ep->register_option(RS2_OPTION_EXPOSURE, std::make_shared>(*fisheye_ep.get(), fisheye_xu, - rsimpl2::ds::FISHEYE_EXPOSURE, + librealsense::ds::FISHEYE_EXPOSURE, "Exposure time of Fisheye camera")); } @@ -352,7 +352,7 @@ namespace rsimpl2 hid_ep->set_pose(lazy([this](){return get_device_position(_motion_module_device_idx); })); if (!motion_module_fw_version.empty()) - register_info(RS2_CAMERA_INFO_MOTION_MODULE_FIRMWARE_VERSION, motion_module_fw_version); + register_info(RS2_CAMERA_INFO_FIRMWARE_VERSION, motion_module_fw_version); } } diff --git a/src/ds5/ds5-motion.h b/src/ds5/ds5-motion.h index 6858cc41e5..683d4bb0d3 100644 --- a/src/ds5/ds5-motion.h +++ b/src/ds5/ds5-motion.h @@ -5,7 +5,7 @@ #include "ds5-device.h" -namespace rsimpl2 +namespace librealsense { class ds5_motion : public virtual ds5_device { diff --git a/src/ds5/ds5-options.cpp b/src/ds5/ds5-options.cpp index c32b29786f..caaa29729c 100644 --- a/src/ds5/ds5-options.cpp +++ b/src/ds5/ds5-options.cpp @@ -3,7 +3,7 @@ #include "ds5-options.h" -namespace rsimpl2 +namespace librealsense { const char* emitter_option::get_value_description(float val) const { diff --git a/src/ds5/ds5-options.h b/src/ds5/ds5-options.h index 9038d5f388..b6823223c8 100644 --- a/src/ds5/ds5-options.h +++ b/src/ds5/ds5-options.h @@ -8,7 +8,7 @@ #include "algo.h" #include "error-handling.h" -namespace rsimpl2 +namespace librealsense { class emitter_option : public uvc_xu_option { diff --git a/src/ds5/ds5-private.cpp b/src/ds5/ds5-private.cpp index 38d79ac923..89e2068aa3 100644 --- a/src/ds5/ds5-private.cpp +++ b/src/ds5/ds5-private.cpp @@ -7,7 +7,7 @@ using namespace std; #define intrinsics_string(res) #res << "\t" << array2str((float_4&)table->rect_params[res]) << endl -namespace rsimpl2 +namespace librealsense { namespace ds { @@ -67,7 +67,7 @@ namespace rsimpl2 intrinsics.height = height; intrinsics.width = width; - rsimpl2::copy(intrinsics.coeffs, table->distortion, sizeof(table->distortion)); + librealsense::copy(intrinsics.coeffs, table->distortion, sizeof(table->distortion)); LOG_DEBUG(endl<< diff --git a/src/ds5/ds5-private.h b/src/ds5/ds5-private.h index 0fdc5e8f76..302307f679 100644 --- a/src/ds5/ds5-private.h +++ b/src/ds5/ds5-private.h @@ -11,7 +11,7 @@ const double TIMESTAMP_TO_MILLISECONS = 0.001; -namespace rsimpl2 +namespace librealsense { namespace ds { diff --git a/src/ds5/ds5-rolling-shutter.cpp b/src/ds5/ds5-rolling-shutter.cpp index 013167f31e..9a812d401a 100644 --- a/src/ds5/ds5-rolling-shutter.cpp +++ b/src/ds5/ds5-rolling-shutter.cpp @@ -17,7 +17,7 @@ #include "ds5-options.h" #include "ds5-timestamp.h" -namespace rsimpl2 +namespace librealsense { ds5_rolling_shutter::ds5_rolling_shutter(const uvc::backend& backend, const std::vector& dev_info, diff --git a/src/ds5/ds5-rolling-shutter.h b/src/ds5/ds5-rolling-shutter.h index 6c9cb36b90..3f13024968 100644 --- a/src/ds5/ds5-rolling-shutter.h +++ b/src/ds5/ds5-rolling-shutter.h @@ -5,7 +5,7 @@ #include "ds5-device.h" -namespace rsimpl2 +namespace librealsense { class ds5_rolling_shutter : public virtual ds5_device { diff --git a/src/ds5/ds5-timestamp.cpp b/src/ds5/ds5-timestamp.cpp index 61266ef8b0..de6b8369ad 100644 --- a/src/ds5/ds5-timestamp.cpp +++ b/src/ds5/ds5-timestamp.cpp @@ -13,7 +13,7 @@ #include "context.h" #include "image.h" -namespace rsimpl2 +namespace librealsense { ds5_timestamp_reader_from_metadata::ds5_timestamp_reader_from_metadata(std::unique_ptr backup_timestamp_reader) :_backup_timestamp_reader(std::move(backup_timestamp_reader)), _has_metadata(pins) @@ -54,7 +54,7 @@ namespace rsimpl2 if(_has_metadata[pin_index]) { - auto md = (rsimpl2::ds::metadata*)(fo.metadata); + auto md = (librealsense::ds::metadata*)(fo.metadata); return (double)(md->header.timestamp)*TIMESTAMP_TO_MILLISECONS; } else @@ -77,7 +77,7 @@ namespace rsimpl2 if(_has_metadata[pin_index] && fo.metadata_size > uvc::uvc_header_size) { - auto md = (rsimpl2::ds::metadata*)(fo.metadata); + auto md = (librealsense::ds::metadata*)(fo.metadata); return md->md_capture_timing.frameCounter; } else diff --git a/src/ds5/ds5-timestamp.h b/src/ds5/ds5-timestamp.h index c66d2f07b7..0a5888e8c7 100644 --- a/src/ds5/ds5-timestamp.h +++ b/src/ds5/ds5-timestamp.h @@ -8,7 +8,7 @@ #include "algo.h" #include "error-handling.h" -namespace rsimpl2 +namespace librealsense { class ds5_timestamp_reader_from_metadata : public frame_timestamp_reader { diff --git a/src/error-handling.cpp b/src/error-handling.cpp index 658510c097..9b46f045df 100644 --- a/src/error-handling.cpp +++ b/src/error-handling.cpp @@ -3,7 +3,7 @@ #include -namespace rsimpl2 +namespace librealsense { polling_error_handler::polling_error_handler(unsigned int poll_intervals_ms, std::unique_ptr