Skip to content

Commit

Permalink
Merge pull request #22 from abernste/development
Browse files Browse the repository at this point in the history
Merge Development to win7_support
  • Loading branch information
abernste authored Sep 2, 2018
2 parents 0656b95 + 406102e commit c5fcde8
Show file tree
Hide file tree
Showing 182 changed files with 8,200 additions and 1,842 deletions.
3 changes: 2 additions & 1 deletion CMake/realsense.def
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ EXPORTS
rs2_keep_frame
rs2_frame_add_ref
rs2_pose_frame_get_pose_data

rs2_get_option
rs2_set_option
rs2_supports_option
Expand Down Expand Up @@ -147,6 +147,7 @@ EXPORTS
rs2_clone_stream_profile

rs2_allocate_synthetic_video_frame
rs2_allocate_points
rs2_allocate_composite_frame
rs2_synthetic_frame_ready
rs2_create_processing_block
Expand Down
12 changes: 8 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ if(ANDROID_NDK_TOOLCHAIN_INCLUDED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -pedantic -g -D_BSD_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pedantic -g -Wno-missing-field-initializers")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-multichar")

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie")
message(STATUS "Prepare RealSense SDK for Android OS (${ANDROID_NDK_ABI_NAME})")
endif()

Expand Down Expand Up @@ -202,8 +202,7 @@ set(REALSENSE_CPP
## Check for Windows Version ##
if( (${CMAKE_SYSTEM_VERSION} EQUAL 6.1) OR (FORCE_WINUSB_UVC) ) # Windows 7
if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
set(DRIVERS inteld415_win7.cat
IntelD415_win7.inf
set(DRIVERS IntelD415_win7.inf
WdfCoinstaller01011.dll
winusbcoinstaller2.dll
)
Expand Down Expand Up @@ -965,6 +964,7 @@ 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_PYTHON_BINDINGS "Build Python bindings" OFF)
option(BUILD_CSHARP_BINDINGS "Build C# bindings" OFF)
#option(BUILD_MATLAB_BINDINGS "Build Matlab bindings" OFF)
option(BUILD_UNITY_BINDINGS "Copy the unity project to the build folder with the required dependencies" OFF)
option(BUILD_CV_EXAMPLES "Build OpenCV examples" OFF)
option(BUILD_PCL_EXAMPLES "Build PCL examples" OFF)
Expand Down Expand Up @@ -995,6 +995,10 @@ if (BUILD_WITH_CUDA)
add_definitions(-DRS2_USE_CUDA)
endif()

if (BUILD_MATLAB_BINDINGS)
add_subdirectory(wrappers/matlab)
endif()


# Check for unreferenced files
FILE(GLOB_RECURSE AllSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -1043,4 +1047,4 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config/realsense2.pc" DESTINATION
# Update system cache with newly installed binaries/libraries
if(UNIX)
install(CODE "execute_process(COMMAND ldconfig)")
endif()
endif()
8 changes: 4 additions & 4 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ namespace rs2
{
if (viewer.synchronization_enable && (!viewer.is_3d_view || viewer.is_3d_depth_source(f) || viewer.is_3d_texture_source(f)))
{
viewer.s(f);
viewer.s.invoke(f);
}
else
{
Expand Down Expand Up @@ -2580,7 +2580,7 @@ namespace rs2
float val{};
if (texture->try_pick(x, y, &val))
{
ss << ", *p: 0x" << std::hex << val;
ss << ", *p: 0x" << std::hex << static_cast<int>(round(val));
}

if (texture->get_last_frame().is<depth_frame>())
Expand Down Expand Up @@ -5657,7 +5657,7 @@ namespace rs2
ImGui::SetCursorPos({ rc.x, rc.y + line_h });
}

ImGui::SetCursorPos({ rc.x + 225, rc.y - 127 });
ImGui::SetCursorPos({ rc.x + 225, rc.y - 107 });

if (fw_version_less_than(fw_version, min_fw_version))
{
Expand Down Expand Up @@ -6111,7 +6111,7 @@ namespace rs2
}
}

void device_model::handle_harware_events(const std::string& serialized_data)
void device_model::handle_hardware_events(const std::string& serialized_data)
{
//TODO: Move under hour glass
std::string event_type = get_event_type(serialized_data);
Expand Down
2 changes: 1 addition & 1 deletion common/model-views.h
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ namespace rs2
bool load_json_if_streaming = false,
json_loading_func json_loading = [](std::function<void()> load) {load(); },
bool draw_device_outline = true);
void handle_harware_events(const std::string& serialized_data);
void handle_hardware_events(const std::string& serialized_data);

std::vector<std::shared_ptr<subdevice_model>> subdevices;
bool is_streaming() const;
Expand Down
1 change: 1 addition & 0 deletions doc/android/AndroidJavaApp.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Click on `Run` and choose `Run 'app'`. Choose your Android device and click on t
16. Open the Terminal Emulator application and type below lines in order to move to Super User mode and change the USB permissions.
```shell
su
setenforce 0
lsusb
chmod 0777 /dev/bus/usb/<Bus number>/<Dev Number>
```
Expand Down
3 changes: 1 addition & 2 deletions doc/android/AndroidNativeSamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This document describes how to build the Intel® RealSense™ SDK 2.0 including
7. Open Terminal on the host machine, navigate to *librealsense* root directory and type the following lines:
```shell
mkdir build && cd build
cmake .. -DANDROID_ABI=<Application Binary Interface> -DCMAKE_TOOLCHAIN_FILE=<Path to NDK folder>/build/cmake/android.toolchain.cmake -DFORCE_LIBUVC=TRUE
cmake .. -DANDROID_ABI=<Application Binary Interface> -DCMAKE_TOOLCHAIN_FILE=<Path to NDK folder>/build/cmake/android.toolchain.cmake -DFORCE_LIBUVC=TRUE -DBUILD_SHARED_LIBS=false
make
```

Expand All @@ -23,7 +23,6 @@ make
8. When compilation done type the following lines to store the binaries at the same location to easily copy them to your Android device.
```shell
mkdir lrs_binaries && cd lrs_binaries
cp ../librealsense2.so ./
cp ../examples/C/color/rs-color ./
cp ../examples/C/depth/rs-depth ./
cp ../examples/C/distance/rs-distance ./
Expand Down
19 changes: 11 additions & 8 deletions doc/android/native-lib.cpp_
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "librealsense/include/librealsense2/hpp/rs_pipeline.hpp"
#include "librealsense/include/librealsense2/hpp/rs_internal.hpp"


static rs2::context ctx;
static std::atomic<bool> streaming(false);
static std::thread frame_thread;
Expand All @@ -21,24 +20,27 @@ Java_com_example_realsense_1app_MainActivity_startStreaming(JNIEnv *env, jobject
return;

const char* nativeClassName = env->GetStringUTFChars(className, 0);
jclass handlerClass = env->FindClass(nativeClassName);
env->ReleaseStringUTFChars(className, nativeClassName);
if (handlerClass == NULL) {
jclass localClass = env->FindClass(nativeClassName);
if (localClass == NULL) {
throw std::runtime_error("FindClass(...) failed!");
}

jclass handlerClass = reinterpret_cast<jclass>(env->NewGlobalRef(localClass));
env->ReleaseStringUTFChars(className, nativeClassName);

jmethodID onFrame = env->GetStaticMethodID(handlerClass, "onFrame",
"(Ljava/lang/Object;II)V");
if (onFrame == NULL) {
env->DeleteGlobalRef(handlerClass);
throw std::runtime_error("GetStaticMethodID(...) failed!");
}

auto list = ctx.query_devices();
if (0 == list.size()) {
env->DeleteGlobalRef(handlerClass);
throw std::runtime_error("No RealSense devices where found!");
}


JavaVM* vm;
env->GetJavaVM(&vm);
frame_thread = std::thread([vm, handlerClass, onFrame](){
Expand Down Expand Up @@ -76,6 +78,7 @@ Java_com_example_realsense_1app_MainActivity_startStreaming(JNIEnv *env, jobject
{}

env->DeleteLocalRef(arr);
env->DeleteGlobalRef(handlerClass);
vm->DetachCurrentThread();
});
}
Expand All @@ -93,9 +96,9 @@ Java_com_example_realsense_1app_MainActivity_stopStreaming(JNIEnv *env, jobject
if (!streaming)
return;

streaming = false;
if (frame_thread.joinable())
frame_thread.join();
streaming = false;
if (frame_thread.joinable())
frame_thread.join();

}
catch (const std::exception& ex)
Expand Down
12 changes: 8 additions & 4 deletions doc/distribution_linux.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Linux Distribution

#### Using pre-build packages
**Intel® RealSense™ SDK 2.0** provides installation packages in [`dpkg`](https://en.wikipedia.org/wiki/Dpkg) format for Ubuntu 16/18 LTS.
\* The Realsense [DKMS](https://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support) kernel drivers package (`librealsense2-dkms`) supports Ubuntu LTS kernels 4.4, 4.10, 4.13 and 4.15\*.
The Realsense [DKMS](https://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support) kernel drivers package (`librealsense2-dkms`) supports Ubuntu LTS kernels 4.4, 4.10, 4.13 and 4.15.

**Note** Kernel 4.16 introduced a major change to uvcvideo and media subsystem. While we work to add support v4.16 in future releases, **librealsense** is verified to run correctly with kernels v4.4-v4.15; the affected users are requested to downgrade the kernel version.
#### Configuring and building from the source code
While we strongly recommend to use DKMS package whenever possible, there are certain cases where installing and patching the system manually is necessary:
- Using SDK with linux kernel **version 4.16+**
- Integration of user-specific patches/modules with `librealsense` SDK.
- Adjusting the patches for alternative kernels/distributions.


>To build the project from sources and prepare/patch the OS manually please follow steps described [here](./installation.md).
The steps are described in [Linux manual installation guide](./installation.md)


## Installing the packages:
Expand Down
Binary file added doc/img/matlab_select.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 16 additions & 8 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@ The scripts and commands below invoke `wget, git, add-apt-repository` which may
**Important:** Running RealSense Depth Cameras on Linux requires patching and inserting modified kernel drivers. Some OEM/Vendors choose to lock the kernel for modifications. Unlocking this capability may requires to modify BIOS settings

**Make Ubuntu Up-to-date:**
1. Update Ubuntu distribution, including getting the latest stable kernel
* Update Ubuntu distribution, including getting the latest stable kernel:
* `sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade` <br />
**Note:** On stock Ubuntu 14 LTS systems and Kernel prior to 4.4.0-04 the standard *apt-get upgrade* command is not sufficient to bring the distribution to the latest recommended baseline.
On those systems the following should be used:
`sudo apt-get install --install-recommends linux-generic-lts-xenial xserver-xorg-core-lts-xenial xserver-xorg-lts-xenial xserver-xorg-video-all-lts-xenial xserver-xorg-input-all-lts-xenial libwayland-egl1-mesa-lts-xenial `<br />

**Note:** On stock Ubuntu 14 LTS systems and Kernel prior to 4.4.0-04 the standard `apt-get upgrade` command is not sufficient to bring the distribution to the latest recommended baseline.
It is recommended to upgrade the distribution with:
* `sudo apt-get install --install-recommends linux-generic-lts-xenial xserver-xorg-core-lts-xenial xserver-xorg-lts-xenial xserver-xorg-video-all-lts-xenial xserver-xorg-input-all-lts-xenial libwayland-egl1-mesa-lts-xenial `<br />

* Update OS Boot and reboot to enforce the correct kernel selection with <br />`sudo update-grub && sudo reboot`<br />

* Interrupt the boot process at Grub2 Boot Menu -> "Advanced Options for Ubuntu" and select the kernel version installed in the previous step. Press and hold SHIFT if the Boot menu is not presented.
* Complete the boot, login and verify that a supported kernel version (4.4.0-.., 4.8.0-.., 4.10.0-.. , 4.13.0-..or 4.15.0-.. as of May 2018) is in place with `uname -r`
* Complete the boot, login and verify that a supported kernel version (4.**[4,8,10,13,15,16]**]) is in place with `uname -r`


**Download/Clone librealsense github repository:**
1. Navigate to *librealsense* root directory to run the following scripts.<br />
Unplug any connected Intel RealSense camera.<br />



**Prepare Linux Backend and the Dev. Environment:**
Expand All @@ -40,10 +46,9 @@ The scripts and commands below invoke `wget, git, add-apt-repository` which may
* Ubuntu 18:<br />
`sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev` <br /><br />

Cmake: *librealsense* requires version 3.8+ which is currently not made available via apt manager for Ubuntu LTS.
Cmake: certain *librealsense* CMAKE flags (e.g. CUDA) require version 3.8+ which is currently not made available via apt manager for Ubuntu LTS.
Go to the [official CMake site](https://cmake.org/download/) to download and install the application


**Note** on graphic sub-system utilization:<br />
*glfw3*, *mesa* and *gtk* packages are required if you plan to build the SDK's OpenGl-enabled examples. The *librealsense* core library and a range of demos/tools are designed for headless environment deployment.

Expand All @@ -53,12 +58,15 @@ The scripts and commands below invoke `wget, git, add-apt-repository` which may
<br />

4. Build and apply patched kernel modules for: <br />
* **Ubuntu 14/16/18 LTS**
* **Ubuntu 14/16/18 with LTS kernel**
script will download, patch and build realsense-affected kernel modules (drivers).<br />
Then it will attempt to insert the patched module instead of the active one. If failed
the original uvc modules will be restored.

`./scripts/patch-realsense-ubuntu-lts.sh`<br />
* **Ubuntu with Kernel 4.16**

`./scripts/patch-ubuntu-kernel-4.16.sh`<br />
* **Intel® Joule™ with Ubuntu**
Based on the custom kernel provided by Canonical Ltd.

Expand Down
2 changes: 1 addition & 1 deletion examples/align/rs-align.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ int main(int argc, char * argv[]) try
pip_stream.y = altered_other_frame_rect.y + altered_other_frame_rect.h - pip_stream.h - (std::max(w, h) / 25);

// Render depth (as picture in pipcture)
renderer.upload(c(aligned_depth_frame));
renderer.upload(c.process(aligned_depth_frame));
renderer.show(pip_stream);

// Using ImGui library to provide a slide controller to select the depth clipping distance
Expand Down
5 changes: 1 addition & 4 deletions examples/capture/rs-capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main(int argc, char * argv[]) try
{
rs2::frameset data = pipe.wait_for_frames(); // Wait for next set of frames from the camera

rs2::frame depth = color_map(data.get_depth_frame()); // Find and colorize the depth data
rs2::frame depth = color_map.process(data.get_depth_frame()); // Find and colorize the depth data
rs2::frame color = data.get_color_frame(); // Find the color data

// For cameras that don't have RGB sensor, we'll render infrared frames instead of color
Expand All @@ -50,6 +50,3 @@ catch (const std::exception& e)
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}



Loading

0 comments on commit c5fcde8

Please sign in to comment.