Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into D4XX_MIPI
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Sep 28, 2022
2 parents 4302ef6 + 7abfbd7 commit 64e66a5
Show file tree
Hide file tree
Showing 62 changed files with 3,092 additions and 607 deletions.
47 changes: 31 additions & 16 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2014,24 +2014,28 @@ namespace rs2
{
// checking format
bool is_cal_format = false;
for (auto it = stream_enabled.begin(); it != stream_enabled.end(); ++it)
// checking that the SKU is D405 - otherwise, this method should return false
if (dev.supports(RS2_CAMERA_INFO_PRODUCT_ID) && !strcmp(dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID), "0B5B"))
{
if (it->second)
for (auto it = stream_enabled.begin(); it != stream_enabled.end(); ++it)
{
int selected_format_index = -1;
if (ui.selected_format_id.count(it->first) > 0)
selected_format_index = ui.selected_format_id.at(it->first);

if (format_values.count(it->first) > 0 && selected_format_index > -1)
if (it->second)
{
auto formats = format_values.at(it->first);
if (formats.size() > selected_format_index)
int selected_format_index = -1;
if (ui.selected_format_id.count(it->first) > 0)
selected_format_index = ui.selected_format_id.at(it->first);

if (format_values.count(it->first) > 0 && selected_format_index > -1)
{
auto format = formats[selected_format_index];
if (format == RS2_FORMAT_Y16)
auto formats = format_values.at(it->first);
if (formats.size() > selected_format_index)
{
is_cal_format = true;
break;
auto format = formats[selected_format_index];
if (format == RS2_FORMAT_Y16)
{
is_cal_format = true;
break;
}
}
}
}
Expand Down Expand Up @@ -2489,7 +2493,7 @@ namespace rs2
glPopAttrib();
}

bool stream_model::is_stream_visible()
bool stream_model::is_stream_visible() const
{
if (dev &&
(dev->is_paused() ||
Expand Down Expand Up @@ -3200,7 +3204,8 @@ namespace rs2
if (profile.as<rs2::video_stream_profile>())
{
stream_details.push_back({ "Hardware Size",
to_string() << original_size.x << " x " << original_size.y, "" });
to_string() << original_size.x << " x " << original_size.y,
"Hardware size is the original frame resolution we got from the sensor, before applying post processing filters." });

stream_details.push_back({ "Display Size",
to_string() << size.x << " x " << size.y,
Expand Down Expand Up @@ -4379,7 +4384,17 @@ namespace rs2
for (auto&& f : first)
{
auto first_uid = f.get_profile().unique_id();
if (auto second_f = second.first_or_default(f.get_profile().stream_type()))

frame second_f;
if (f.get_profile().stream_type() == RS2_STREAM_INFRARED)
{
second_f = second.get_infrared_frame( f.get_profile().stream_index() );
}
else
{
second_f = second.first_or_default( f.get_profile().stream_type() );
}
if ( second_f )
{
auto second_uid = second_f.get_profile().unique_id();

Expand Down
2 changes: 1 addition & 1 deletion common/model-views.h
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ namespace rs2
public:
stream_model();
std::shared_ptr<texture_buffer> upload_frame(frame&& f);
bool is_stream_visible();
bool is_stream_visible() const;
void update_ae_roi_rect(const rect& stream_rect, const mouse_info& mouse, std::string& error_message);
void show_frame(const rect& stream_rect, const mouse_info& g, std::string& error_message);
rect get_normalized_zoom(const rect& stream_rect, const mouse_info& g, bool is_middle_clicked, float zoom_val);
Expand Down
2 changes: 1 addition & 1 deletion common/reflectivity/reflectivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ float reflectivity::get_reflectivity( float raw_noise_estimation,

// STD based analysis
// STD values are at the edges, hard to get data
if( standard_deviation >= 1.5f || standard_deviation <= 10.f )
if( standard_deviation >= 1.5f && standard_deviation <= 10.f )
{
if( standard_deviation > 2.5f )
ref_from_std = 0.5f; // Low confidence data due to low STD values
Expand Down
8 changes: 4 additions & 4 deletions common/viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ namespace rs2
{
struct popup
{
const std::string header;
const std::string message;
std::function<void()> custom_command;
std::string header;
std::string message;
std::function< void() > custom_command;

bool operator =(const popup& p)
bool operator==( const popup & p ) const
{
return p.message == message;
}
Expand Down
24 changes: 12 additions & 12 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,25 @@ The scripts and commands below invoke `wget, git, add-apt-repository` which may
Unplug any connected Intel RealSense camera.<br />

2. Install the core packages required to build *librealsense* binaries and the affected kernel modules:

`sudo apt-get install git libssl-dev libusb-1.0-0-dev libudev-dev pkg-config libgtk-3-dev` <br /><br />
Distribution-specific packages: <br />
`sudo apt-get install git libssl-dev libusb-1.0-0-dev libudev-dev pkg-config libgtk-3-dev` <br /><br />
Distribution-specific packages:<br />
* Ubuntu 14 or when running Ubuntu 16.04 live-disk:<br />
`./scripts/install_glfw3.sh` <br />

* Ubuntu 16:<br />
`sudo apt-get install libglfw3-dev`<br />
`sudo apt-get install libglfw3-dev` <br />

* Ubuntu 18/20:<br />
`sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev at` <br /><br />

> **Cmake Note**: 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 />
**Note**: <br />
* 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.
* `libudev-dev` installation is optional but recommended, when the `libudev-dev` is installed the SDK will use an event-driven approach for triggering USB detection and enumeration, if not the SDK will use a timer polling approach which is less sensitive for device detection.
* `libudev-dev` installation is optional but recommended, when the `libudev-dev` is installed the SDK will use an event-driven approach for triggering USB detection and enumeration, if not the SDK will use a timer polling approach which is less sensitive for device detection.

3. Run Intel Realsense permissions script from librealsense root directory:<br />
`./scripts/setup_udev_rules.sh`
Expand All @@ -65,12 +64,13 @@ The scripts and commands below invoke `wget, git, add-apt-repository` which may
*`./scripts/setup_udev_rules.sh --uninstall`*

4. Build and apply patched kernel modules for: <br />

* **Ubuntu 14/16/18/20 with LTS kernel**
* **Ubuntu 20/22 (focal/jammy) with LTS kernel 5.13, 5.15 **<br />
`./scripts/patch-realsense-ubuntu-lts-hwe.sh`<br />
* **Ubuntu 14/16/18/20 with LTS kernel**<br />
`./scripts/patch-realsense-ubuntu-lts.sh`<br />
* **Ubuntu with Kernel 4.16**
* **Ubuntu with Kernel 4.16**<br />
`./scripts/patch-ubuntu-kernel-4.16.sh`<br />
* **Intel® Joule™ with Ubuntu**
* **Intel® Joule™ with Ubuntu**<br />
Based on the custom kernel provided by Canonical Ltd.

`./scripts/patch-realsense-ubuntu-xenial-joule.sh`<br />
Expand Down
1 change: 1 addition & 0 deletions include/librealsense2/h/rs_sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ typedef enum rs2_format
RS2_FORMAT_Z16H , /**< Variable-length Huffman-compressed 16-bit depth values. */
RS2_FORMAT_FG , /**< 16-bit per-pixel frame grabber format. */
RS2_FORMAT_Y411 , /**< 12-bit per-pixel. */
RS2_FORMAT_Y16I , /**< 12-bit per pixel interleaved. 12-bit left, 12-bit right. */
RS2_FORMAT_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
} rs2_format;
const char* rs2_format_to_string(rs2_format format);
Expand Down
2 changes: 1 addition & 1 deletion include/librealsense2/rs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern "C" {
#include "h/rs_sensor.h"

#define RS2_API_MAJOR_VERSION 2
#define RS2_API_MINOR_VERSION 52
#define RS2_API_MINOR_VERSION 53
#define RS2_API_PATCH_VERSION 0
#define RS2_API_BUILD_VERSION 0

Expand Down
59 changes: 59 additions & 0 deletions include/librealsense2/utilities/string/chrono.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2022 Intel Corporation. All Rights Reserved.

// This is in lieu of the C++20 chrono_io.h

// NOTE: make sure to include this file BEFORE any usage in another header
// (e.g., Catch should be include after this! Without these definitions, Catch
// output does not know how to stringify durations...)

#pragma once

#include <chrono>
#include <string>
#include <sstream>
#include <ctime>


inline std::string to_string( const std::time_t & time )
{
std::ostringstream os;
os << time;
return os.str();
}


template< typename Clock, typename Duration = typename Clock::duration >
std::string to_string( const std::chrono::time_point< Clock, Duration > & tp )
{
auto in_time_t = std::chrono::system_clock::to_time_t( tp );
return to_string( in_time_t );
}


template< typename Rep, typename Period = std::ratio< 1 > >
std::string to_string( const std::chrono::duration< Rep, Period > & duration )
{
auto seconds_as_int = std::chrono::duration_cast< std::chrono::seconds >( duration );
if( seconds_as_int == duration )
return std::to_string( seconds_as_int.count() ) + "s";
auto seconds_as_double = std::chrono::duration_cast< std::chrono::duration< double > >( duration );
std::ostringstream os;
os << seconds_as_double.count();
os << 's';
return os.str();
}


template< typename Clock, typename Duration = typename Clock::duration >
std::ostream & operator<<( std::ostream & o, const std::chrono::time_point< Clock, Duration > & tp )
{
return o << to_string( tp );
}


template< typename Rep, typename Period = std::ratio< 1 > >
std::ostream & operator<<( std::ostream & o, const std::chrono::duration< Rep, Period > & duration )
{
return o << to_string( duration );
}
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<package format="2">
<name>librealsense2</name>
<!-- The version tag needs to be updated with each new release of librealsense -->
<version>2.52.0</version>
<version>2.53.0</version>
<description>
Library for controlling and capturing data from the Intel(R) RealSense(TM) D400 devices.
</description>
Expand Down
12 changes: 6 additions & 6 deletions scripts/patch-realsense-ubuntu-L4T.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ kernel_ver=`uname -r`
sudo cp /usr/src/linux-headers-${kernel_ver}-ubuntu18.04_aarch64/kernel-4.9/Module.symvers .

#Jetpack prior to 4.4.1 requires manual reconfiguration of kernel
if [ "4.4" == PATCHES_REV ]; then
if [ "4.4" = "$PATCHES_REV" ]; then
echo -e "\e[32mUpdate the kernel tree to support HID IMU sensors\e[0m"
sudo sed -i '/CONFIG_HID_SENSOR_ACCEL_3D/c\CONFIG_HID_SENSOR_ACCEL_3D=m' .config
sudo sed -i '/CONFIG_HID_SENSOR_GYRO_3D/c\CONFIG_HID_SENSOR_GYRO_3D=m' .config
Expand All @@ -134,7 +134,7 @@ sudo git reset --hard
echo -e "\e[32mApply Librealsense Kernel Patches\e[0m"
sudo -s patch -p1 < ./LRS_Patches/01-realsense-camera-formats-L4T-${PATCHES_REV}.patch
sudo -s patch -p1 < ./LRS_Patches/02-realsense-metadata-L4T-${PATCHES_REV}.patch
if [ "4.4" == PATCHES_REV ]; then # for Jetpack 4.4 and older
if [ "4.4" = "$PATCHES_REV" ]; then # for Jetpack 4.4 and older
sudo -s patch -p1 < ./LRS_Patches/03-realsense-hid-L4T-4.9.patch
fi
sudo -s patch -p1 < ./LRS_Patches/04-media-uvcvideo-mark-buffer-error-where-overflow.patch
Expand All @@ -146,7 +146,7 @@ sudo -s make -j$(($(nproc)-1)) ARCH=arm64 M=drivers/media/usb/uvc/ modules
echo -e "\e[32mCompiling v4l2-core modules\e[0m"
#sudo -s make -j -C $KBASE M=$KBASE/drivers/media/v4l2-core modules
sudo -s make -j$(($(nproc)-1)) ARCH=arm64 M=drivers/media/v4l2-core modules
if [ "4.4" == PATCHES_REV ]; then # for Jetpack 4.4 and older
if [ "4.4" = "$PATCHES_REV" ]; then # for Jetpack 4.4 and older
echo -e "\e[32mCompiling accelerometer and gyro modules\e[0m"
sudo -s make -j$(($(nproc)-1)) ARCH=arm64 M=drivers/iio modules
fi
Expand All @@ -155,7 +155,7 @@ echo -e "\e[32mCopying the patched modules to (~/) \e[0m"
sudo cp drivers/media/usb/uvc/uvcvideo.ko ~/${TEGRA_TAG}-uvcvideo.ko
sudo cp drivers/media/v4l2-core/videobuf-vmalloc.ko ~/${TEGRA_TAG}-videobuf-vmalloc.ko
sudo cp drivers/media/v4l2-core/videobuf-core.ko ~/${TEGRA_TAG}-videobuf-core.ko
if [ "4.4" == PATCHES_REV ]; then # for Jetpack 4.4 and older
if [ "4.4" = "$PATCHES_REV" ]; then # for Jetpack 4.4 and older
sudo cp drivers/iio/common/hid-sensors/hid-sensor-iio-common.ko ~/${TEGRA_TAG}-hid-sensor-iio-common.ko
sudo cp drivers/iio/common/hid-sensors/hid-sensor-trigger.ko ~/${TEGRA_TAG}-hid-sensor-trigger.ko
sudo cp drivers/iio/accel/hid-sensor-accel-3d.ko ~/${TEGRA_TAG}-hid-sensor-accel-3d.ko
Expand All @@ -164,7 +164,7 @@ fi
popd

echo -e "\e[32mMove the modified modules into the modules tree\e[0m"
if [ "4.4" == PATCHES_REV ]; then # for Jetpack 4.4 and older
if [ "4.4" = "$PATCHES_REV" ]; then # for Jetpack 4.4 and older
#Optional - create kernel modules directories in kernel tree
sudo mkdir -p /lib/modules/`uname -r`/kernel/drivers/iio/accel
sudo mkdir -p /lib/modules/`uname -r`/kernel/drivers/iio/gyro
Expand All @@ -180,7 +180,7 @@ sudo depmod

echo -e "\e[32mInsert the modified kernel modules\e[0m"
try_module_insert uvcvideo ~/${TEGRA_TAG}-uvcvideo.ko /lib/modules/`uname -r`/kernel/drivers/media/usb/uvc/uvcvideo.ko
if [ "4.4" == PATCHES_REV ]; then # for Jetpack 4.4 and older
if [ "4.4" = "$PATCHES_REV" ]; then # for Jetpack 4.4 and older
try_module_insert hid_sensor_accel_3d ~/${TEGRA_TAG}-hid-sensor-accel-3d.ko /lib/modules/`uname -r`/kernel/drivers/iio/accel/hid-sensor-accel-3d.ko
try_module_insert hid_sensor_gyro_3d ~/${TEGRA_TAG}-hid-sensor-gyro-3d.ko /lib/modules/`uname -r`/kernel/drivers/iio/gyro/hid-sensor-gyro-3d.ko
#Preventively unload all HID-related modules
Expand Down
Loading

0 comments on commit 64e66a5

Please sign in to comment.