Skip to content

Commit e46e09a

Browse files
authored
Merge pull request #2444 from dorodnic/development
Merge of 2.16.1 to master
2 parents eaa41c9 + 1a38ac8 commit e46e09a

File tree

118 files changed

+1723
-31585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1723
-31585
lines changed

Diff for: CMakeLists.txt

+83-44
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,19 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
5151
# View the makefile commands during build
5252
#set(CMAKE_VERBOSE_MAKEFILE on)
5353

54+
option(ENABLE_CCACHE "Build with ccache." ON)
55+
if(ENABLE_CCACHE)
56+
find_program(CCACHE_FOUND ccache)
57+
if(CCACHE_FOUND)
58+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
59+
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
60+
endif(CCACHE_FOUND)
61+
endif()
62+
5463
include(CheckCXXCompilerFlag)
5564
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
5665
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
57-
if(COMPILER_SUPPORTS_CXX11)
66+
if(COMPILER_SUPPORTS_CXX11)
5867
set(CMAKE_CXX_STANDARD 11)
5968
set(CMAKE_CUDA_STANDARD 11)
6069
elseif(COMPILER_SUPPORTS_CXX0X)
@@ -93,6 +102,10 @@ if(ANDROID_NDK_TOOLCHAIN_INCLUDED)
93102
message(STATUS "Prepare RealSense SDK for Android OS (${ANDROID_NDK_ABI_NAME})")
94103
endif()
95104

105+
if(USE_SYSTEM_LIBUSB)
106+
add_definitions(-DUSE_SYSTEM_LIBUSB)
107+
endif()
108+
96109
if(BUILD_WITH_OPENMP)
97110
find_package(OpenMP)
98111
if(NOT OPENMP_FOUND)
@@ -198,25 +211,20 @@ set(REALSENSE_CPP
198211
src/media/playback/playback_device.cpp
199212
src/media/playback/playback_sensor.cpp
200213
)
201-
214+
202215
## Check for Windows Version ##
203216
if( (${CMAKE_SYSTEM_VERSION} EQUAL 6.1) OR (FORCE_WINUSB_UVC) ) # Windows 7
204217
if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
205-
set(DRIVERS IntelD415_win7.inf
206-
WdfCoinstaller01011.dll
207-
winusbcoinstaller2.dll
208-
)
209-
218+
message("Preparing Windows 7 drivers" )
219+
make_directory(${CMAKE_CURRENT_BINARY_DIR}/drivers/)
220+
file(GLOB DRIVERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/" "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/*")
210221
foreach(item IN LISTS DRIVERS)
211-
add_custom_command(
212-
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${item}"
213-
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/d415_driver/${item}" "${CMAKE_CURRENT_BINARY_DIR}/${item}"
214-
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${item}"
215-
)
222+
message("Copying ${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/${item} to ${CMAKE_CURRENT_BINARY_DIR}/drivers/" )
223+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/${item}" "${CMAKE_CURRENT_BINARY_DIR}/drivers/${item}" COPYONLY)
216224
endforeach()
217225
endif()
218226
add_custom_target(realsense-driver ALL DEPENDS ${DRIVERS})
219-
227+
220228
list(APPEND REALSENSE_CPP
221229
src/win7/win7-helpers.cpp
222230
src/win7/win7-uvc.cpp
@@ -360,23 +368,25 @@ set(REALSENSE_HPP
360368
src/media/ros/ros_file_format.h
361369
)
362370

363-
## Check for Windows Version ##
364-
if( ${CMAKE_SYSTEM_VERSION} EQUAL 6.1 ) # Windows 7
365-
list(APPEND REALSENSE_HPP
366-
src/win7/win7-helpers.h
367-
src/win7/win7-uvc.h
368-
src/win7/win7-usb.h
369-
src/win7/win7-hid.h
370-
src/win7/win7-backend.h
371-
)
372-
else() # Some other windows version
373-
list(APPEND REALSENSE_HPP
374-
src/win/win-helpers.h
375-
src/win/win-uvc.h
376-
src/win/win-usb.h
377-
src/win/win-hid.h
378-
src/win/win-backend.h
379-
)
371+
if(WIN32)
372+
## Check for Windows Version ##
373+
if( ${CMAKE_SYSTEM_VERSION} EQUAL 6.1 ) # Windows 7
374+
list(APPEND REALSENSE_HPP
375+
src/win7/win7-helpers.h
376+
src/win7/win7-uvc.h
377+
src/win7/win7-usb.h
378+
src/win7/win7-hid.h
379+
src/win7/win7-backend.h
380+
)
381+
else() # Some other windows version
382+
list(APPEND REALSENSE_HPP
383+
src/win/win-helpers.h
384+
src/win/win-uvc.h
385+
src/win/win-usb.h
386+
src/win/win-hid.h
387+
src/win/win-backend.h
388+
)
389+
endif()
380390
endif()
381391

382392
if(BUILD_EASYLOGGINGPP)
@@ -776,10 +786,32 @@ if(HWM_OVER_XU)
776786
endif()
777787

778788
if (NOT USE_SYSTEM_LIBUSB)
779-
if(NOT WIN32)
780-
add_subdirectory(third-party/libusb/)
781-
elseif(FORCE_LIBUVC)
782-
add_subdirectory(third-party/libusb/)
789+
if(NOT WIN32 OR FORCE_LIBUVC)
790+
include(ExternalProject)
791+
792+
ExternalProject_Add(
793+
libusb
794+
795+
GIT_REPOSITORY "https://github.com/libusb/libusb.git"
796+
GIT_TAG "master"
797+
798+
UPDATE_COMMAND ${CMAKE_COMMAND} -E copy
799+
${CMAKE_CURRENT_SOURCE_DIR}/third-party/libusb/CMakeLists.txt
800+
${CMAKE_CURRENT_BINARY_DIR}/third-party/libusb/CMakeLists.txt
801+
PATCH_COMMAND ""
802+
803+
SOURCE_DIR "third-party/libusb/"
804+
CMAKE_ARGS -DCMAKE_CXX_STANDARD_LIBRARIES=${CMAKE_CXX_STANDARD_LIBRARIES} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/libusb_install
805+
806+
TEST_COMMAND ""
807+
)
808+
809+
set(LIBUSB_LOCAL_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR}/third-party/libusb)
810+
811+
set(LIBUSB1_LIBRARY_DIRS ${CMAKE_CURRENT_BINARY_DIR}/libusb_install/lib)
812+
link_directories(${LIBUSB1_LIBRARY_DIRS})
813+
814+
set(LIBUSB1_LIBRARIES usb log)
783815
endif()
784816
endif()
785817

@@ -855,7 +887,7 @@ if(BUILD_SHARED_LIBS)
855887
add_library(realsense2 SHARED
856888
${REALSENSE_CPP} ${REALSENSE_HPP} ${REALSENSE_DEF} ${REALSENSE_CU} ${REALSENSE_CUH}
857889
src/res/resource.h
858-
src/res/librealsense.rc)
890+
src/res/librealsense.rc)
859891
source_group("Resources" FILES
860892
src/res/resource.h
861893
src/res/librealsense.rc
@@ -873,15 +905,25 @@ if(BUILD_WITH_TM2)
873905
endif()
874906
set_target_properties(realsense2 PROPERTIES VERSION ${REALSENSE_VERSION_STRING}
875907
SOVERSION ${REALSENSE_VERSION_MAJOR})
876-
target_link_libraries(realsense2 PRIVATE realsense-file ${CMAKE_THREAD_LIBS_INIT} ${TRACKING_DEVICE_LIBS})
908+
909+
if(ANDROID_NDK_TOOLCHAIN_INCLUDED)
910+
if(BUILD_SHARED_LIBS)
911+
find_library(log-lib log)
912+
target_link_libraries(realsense2 PRIVATE realsense-file ${CMAKE_THREAD_LIBS_INIT} ${TRACKING_DEVICE_LIBS} log)
913+
else()
914+
target_link_libraries(realsense2 PRIVATE realsense-file ${CMAKE_THREAD_LIBS_INIT} ${TRACKING_DEVICE_LIBS})
915+
endif()
916+
else()
917+
target_link_libraries(realsense2 PRIVATE realsense-file ${CMAKE_THREAD_LIBS_INIT} ${TRACKING_DEVICE_LIBS})
918+
endif()
877919

878920
if (NOT USE_SYSTEM_LIBUSB)
879-
if(NOT WIN32)
880-
target_link_libraries(realsense2 PRIVATE usb)
881-
elseif(FORCE_LIBUVC)
882-
target_link_libraries(realsense2 PRIVATE usb)
921+
if (NOT WIN32)
922+
add_dependencies(realsense2 libusb)
923+
target_link_libraries(realsense2 PRIVATE ${LIBUSB1_LIBRARIES})
883924
endif()
884925
else()
926+
target_include_directories(realsense2 PRIVATE ${LIBUSB1_INCLUDE_DIRS})
885927
target_link_libraries(realsense2 PRIVATE ${LIBUSB1_LIBRARIES})
886928
endif()
887929

@@ -907,6 +949,7 @@ target_include_directories(realsense2 PRIVATE
907949
${ROSBAG_HEADER_DIRS}
908950
${BOOST_INCLUDE_PATH}
909951
${LZ4_INCLUDE_PATH}
952+
${LIBUSB_LOCAL_INCLUDE_PATH}
910953
)
911954
if( (${CMAKE_SYSTEM_VERSION} EQUAL 6.1) OR (FORCE_WINUSB_UVC) ) # Windows 7
912955
add_dependencies(realsense2 realsense-driver)
@@ -915,10 +958,6 @@ if( (${CMAKE_SYSTEM_VERSION} EQUAL 6.1) OR (FORCE_WINUSB_UVC) ) # Windows 7
915958
)
916959
endif()
917960

918-
if (USE_SYSTEM_LIBUSB)
919-
target_include_directories(realsense2 PRIVATE ${LIBUSB1_INCLUDE_DIRS})
920-
endif()
921-
922961
target_include_directories(realsense2 PUBLIC
923962
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
924963
$<INSTALL_INTERFACE:include>

Diff for: common/model-views.cpp

+33-10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <arcball_camera.h>
2828

2929
constexpr const char* recommended_fw_url = "https://downloadcenter.intel.com/download/27522/Latest-Firmware-for-Intel-RealSense-D400-Product-Family?v=t";
30+
constexpr const char* store_url = "https://click.intel.com/";
3031

3132
using namespace rs400;
3233
using namespace nlohmann;
@@ -799,7 +800,8 @@ namespace rs2
799800
{
800801
std::stringstream ss;
801802
ss << "##" << ((owner) ? owner->dev.get_info(RS2_CAMERA_INFO_NAME) : _name)
802-
<< "/" << ((owner) ? (*owner->s).get_info(RS2_CAMERA_INFO_NAME) : "_");
803+
<< "/" << ((owner) ? (*owner->s).get_info(RS2_CAMERA_INFO_NAME) : "_")
804+
<< "/" << (long long)this;
803805

804806
subdevice_model::populate_options(options_metadata,
805807
ss.str().c_str(),owner , block, owner ? &owner->options_invalidated : nullptr, error_message);
@@ -918,7 +920,8 @@ namespace rs2
918920

919921
std::stringstream ss;
920922
ss << "##" << dev.get_info(RS2_CAMERA_INFO_NAME)
921-
<< "/" << s->get_info(RS2_CAMERA_INFO_NAME);
923+
<< "/" << s->get_info(RS2_CAMERA_INFO_NAME)
924+
<< "/" << (long long)this;
922925
populate_options(options_metadata, ss.str().c_str(), this, s, &options_invalidated, error_message);
923926

924927
try
@@ -3233,19 +3236,35 @@ namespace rs2
32333236
ImGuiWindowFlags_NoCollapse |
32343237
ImGuiWindowFlags_NoTitleBar;
32353238

3236-
ImGui::PushFont(font_18);
32373239
ImGui::PushStyleColor(ImGuiCol_WindowBg, transparent);
32383240
ImGui::SetNextWindowPos({ float(x), float(y) });
3239-
ImGui::SetNextWindowSize({ 250.f, 50.f });
3241+
ImGui::SetNextWindowSize({ 250.f, 70.f });
32403242
ImGui::Begin("nostreaming_popup", nullptr, flags);
32413243

3244+
ImGui::PushFont(font_18);
32423245
ImGui::PushStyleColor(ImGuiCol_Text, from_rgba(0x70, 0x8f, 0xa8, 0xff));
32433246
ImGui::Text("Connect a RealSense Camera\nor Add Source");
32443247
ImGui::PopStyleColor();
3245-
3248+
ImGui::PopFont();
3249+
ImGui::SetCursorPos({ 0, 43 });
3250+
ImGui::PushStyleColor(ImGuiCol_Button, dark_window_background);
3251+
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, dark_window_background);
3252+
ImGui::PushStyleColor(ImGuiCol_ButtonActive, dark_window_background);
3253+
ImGui::PushStyleColor(ImGuiCol_Text, button_color + 0.25f);
3254+
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, button_color + 0.55f);
3255+
ImGui::Spacing();
3256+
std::string message = to_string() << textual_icons::shopping_cart << " Buy Now";
3257+
if (ImGui::Button(message.c_str(), { 75, 20 }))
3258+
{
3259+
open_url(store_url);
3260+
}
3261+
if (ImGui::IsItemHovered())
3262+
{
3263+
ImGui::SetTooltip("Go to click.intel.com");
3264+
}
3265+
ImGui::PopStyleColor(5);
32463266
ImGui::End();
32473267
ImGui::PopStyleColor();
3248-
ImGui::PopFont();
32493268
}
32503269

32513270
// Generate streams layout, creates a grid-like layout with factor amount of columns
@@ -5263,7 +5282,7 @@ namespace rs2
52635282
{
52645283
bool is_clicked = false;
52655284
assert(opt_model.opt == RS2_OPTION_VISUAL_PRESET);
5266-
ImGui::Text("Presets: ");
5285+
ImGui::Text("Preset: ");
52675286
if (ImGui::IsItemHovered())
52685287
{
52695288
ImGui::SetTooltip("Select a preset configuration (or use the load button)");
@@ -5322,12 +5341,16 @@ namespace rs2
53225341
if (selected < static_cast<int>(labels.size() - files_labels.size()))
53235342
{
53245343
//Known preset was chosen
5325-
opt_model.value = opt_model.range.min + opt_model.range.step * selected;
5344+
auto new_val = opt_model.range.min + opt_model.range.step * selected;
53265345
model.add_log(to_string() << "Setting " << opt_model.opt << " to "
53275346
<< opt_model.value << " (" << labels[selected] << ")");
5328-
opt_model.endpoint->set_option(opt_model.opt, opt_model.value);
5329-
is_clicked = true;
5347+
5348+
opt_model.endpoint->set_option(opt_model.opt, new_val);
5349+
5350+
// Only apply preset to GUI if set_option was succesful
53305351
selected_file_preset = "";
5352+
opt_model.value = new_val;
5353+
is_clicked = true;
53315354
}
53325355
else
53335356
{

Diff for: common/model-views.h

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ namespace rs2
114114
static const textual_icon fix_up { u8"\uf062" };
115115
static const textual_icon minus { u8"\uf068" };
116116
static const textual_icon exclamation_triangle { u8"\uf071" };
117+
static const textual_icon shopping_cart { u8"\uf07a" };
117118
static const textual_icon bar_chart { u8"\uf080" };
118119
static const textual_icon upload { u8"\uf093" };
119120
static const textual_icon square_o { u8"\uf096" };

Diff for: doc/android/native-lib.cpp_

+4-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Java_com_example_realsense_1app_MainActivity_startStreaming(JNIEnv *env, jobject
6464
streaming = true;
6565
while (streaming) {
6666
rs2::frameset data = pipe.wait_for_frames();
67-
auto rgb_vid_frame = colorizer.colorize(data);
67+
auto rgb_vid_frame = colorizer.colorize(data.get_depth_frame());
6868

6969
env->SetByteArrayRegion(arr, 0, rgb_frame_size,
7070
reinterpret_cast<const jbyte *>(rgb_vid_frame.get_data()));
@@ -75,7 +75,9 @@ Java_com_example_realsense_1app_MainActivity_startStreaming(JNIEnv *env, jobject
7575
pipe.stop();
7676
}
7777
catch (const std::exception& ex)
78-
{}
78+
{
79+
throw;
80+
}
7981

8082
env->DeleteLocalRef(arr);
8183
env->DeleteGlobalRef(handlerClass);

Diff for: doc/img/win7/device_manager.png

52.5 KB
Loading

Diff for: doc/img/win7/device_manager_after.png

47.6 KB
Loading

Diff for: doc/img/win7/driver_setup.png

35.2 KB
Loading

Diff for: doc/img/win7/installer.png

42 KB
Loading

Diff for: doc/installation_win7.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Windows 7 Installation
2+
3+
> **Note:** Intel RealSense products are being regularly validated and receive official support for Windows 10 and Linux eco-systems. Not all product features are enabled on Windows 7.
4+
5+
> We are constantly expanding the list of supported platforms, devices and features based on customer and community feedback. If your use case is not yet covered, please open [a new issue](https://github.com/IntelRealSense/librealsense/issues/new)
6+
7+
## Getting Started
8+
9+
1. Download [Intel RealSense SDK Installer for Windows 7](https://github.com/IntelRealSense/librealsense/releases/download/v2.16.1/Intel.RealSense.SDK.Win7.exe)
10+
2. Connect the camera (the device must be connected to install the driver)
11+
3. Check the device manager:<br />![dev_man](img/win7/device_manager.png)<br />
12+
> Out of the box Windows 7 will not recognize the D4xx cameras using the inbox driver.
13+
4. Run the installer and make sure to check **Win7 Drivers**:<br/>
14+
![install](img/win7/installer.png)
15+
5. The installer will prompt to install the driver. This is a one-time step:<br/>
16+
![after](img/win7/driver_setup.png)
17+
![after](img/win7/device_manager_after.png)
18+
19+
## Supported Devices:
20+
1. Intel(R) RealSense(TM) D410 Module
21+
2. Intel(R) RealSense(TM) D415 Camera
22+
3. Intel(R) RealSense(TM) D430 Module
23+
4. Intel(R) RealSense(TM) D435 Camera
24+
5. Intel(R) RealSense(TM) Camera DS5U
25+
26+
## Known Limitations:
27+
1. Multiple cameras are likely not to work at the moment (not validated)
28+
29+
## Building from Source
30+
The binaries supporting Win7 differ from ones supporting Win10. When building on Win7, CMake will automatically generate binaries for Win7.
31+
You can also build for Win7 from Win10 by adding `-DFORCE_WINUSB_UVC=true` to CMake flags.
32+
Signed drivers are still required when building from source (can be extracted from the Win7 installer and freely redistributed)

Diff for: examples/CMakeLists.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ if(BUILD_GRAPHICAL_EXAMPLES)
5858
include_directories(${GLFW_INCLUDE_DIR})
5959
endif()
6060
else()
61-
set(DEPENDENCIES realsense2)
61+
if(ANDROID_NDK_TOOLCHAIN_INCLUDED)
62+
find_library(log-lib log)
63+
set(DEPENDENCIES realsense2 log)
64+
else()
65+
set(DEPENDENCIES realsense2)
66+
endif()
6267
if(NOT WIN32)
6368
list(APPEND DEPENDENCIES m ${LIBUSB1_LIBRARIES})
6469
endif()

Diff for: examples/example.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ class texture
186186
h > w ? w++ : h++;
187187
auto new_w = round(window.x / w);
188188
auto new_h = round(window.y / h);
189-
return rect{ w, h, new_w, new_h}; //column count, line count, cell width cell height
189+
// column count, line count, cell width cell height
190+
return rect{ static_cast<float>(w), static_cast<float>(h), static_cast<float>(new_w), static_cast<float>(new_h) };
190191
}
191192

192193
std::vector<rect> calc_grid(float2 window, std::vector<rs2::video_frame>& frames)

Diff for: include/librealsense2/rs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern "C" {
2424

2525
#define RS2_API_MAJOR_VERSION 2
2626
#define RS2_API_MINOR_VERSION 16
27-
#define RS2_API_PATCH_VERSION 0
27+
#define RS2_API_PATCH_VERSION 1
2828
#define RS2_API_BUILD_VERSION 0
2929

3030
#define STRINGIFY(arg) #arg

0 commit comments

Comments
 (0)