diff --git a/README.md b/README.md
index 2d30095..76ee3c8 100644
--- a/README.md
+++ b/README.md
@@ -5,14 +5,14 @@
[](https://ci.appveyor.com/project/hiroMTB/ofxrealsense2)
# ofxRealsense2
-This repos is openFrameworks addon for [Intel® RealSense™ SDK 2.0](https://github.com/IntelRealSense/librealsense). You can test your D400 series camera quickly. If you dont have device, you cann still playback BAG files and see how it works (for example performance, postprocessing, depth quality, etc)
+This repos is openFrameworks addon for [Intel® RealSense™ SDK 2.0](https://github.com/IntelRealSense/librealsense), specifically the D435i. You can test your D400 series camera quickly. If you dont have device, you can still playback BAG files and see how it works (for example performance, postprocessing, depth quality, etc).
## Development period
-- 2018.7 ~ active
+- 2019.5 ~ active
## Version
-- Realsense 2.14.1 (released on 2018.7, this is not latest)
+- Realsense 2.2.22 (released on 2019.01, the latest as of May 2019)
- libusb 1.0.22
- openFrameworks 0.10.0, 0.10.1
@@ -25,15 +25,28 @@ This repos is openFrameworks addon for [Intel® RealSense™ SDK 2.0](https://gi
- [x] add bag file playback example
## Install Realsense SDK
-Follow the official instalaction [here](https://realsense.intel.com/sdk-2/) and check you can launch realsense viewer.
+Follow the official installation [here](https://realsense.intel.com/sdk-2/) and check you can launch realsense viewer.
+OR :
+using brew :
+```
+brew install libusb pkg-config
+brew install homebrew/core/glfw3
+brew install cmake
+brew install librealsense
-## Using oF Poroject Generator
+#all of these things should now be visible in /usr/local/lib
+#after brew installing librealsense you should be able to immediately type realsense-viewer into the terminal and see the viewer
+
+```
+
+
+## Using oF Project Generator
This repo does not contain any project file. Please generate project file by yourself.
-Project Generator needs addon_config.make for setting library properly. This repo contain follwing two .make. Please rename your favorite one to addon_config.make.
+Project Generator needs addon_config.make for setting library properly. This repo contain following two .make. Please rename your favorite one to addon_config.make.
- addon_config_shared.make : Generate project file which use shared library(.dylib, .dll + .lib)
-- addon_config_static.make : Generate project file which use static library(.a, .lib).
+- addon_config_static.make : Generate project file which use static library(.a, .lib).
## Static library vs Shared library
@@ -59,8 +72,8 @@ With Realsense Viewer you can record/playback depth & color stream to bag file.
## Hardware
- Sometimes I experienced collapesed data stream when I use USB 3.0 extension cable from D435 camera.
Unplug and plug camera again if you see strange data.
-- The quality of depth data from D400 series is depends on parameter of postprocessing. I recommend to check out [this PDF article](https://realsense.intel.com/wp-content/uploads/sites/63/BKM-For-Tuning-D435-and-D415-Cameras-Webinar_Rev3.pdf) and test with Realsense Viewer.
+- The quality of depth data from D400 series is depends on parameter of postprocessing. I recommend to check out [this PDF article](https://realsense.intel.com/wp-content/uploads/sites/63/BKM-For-Tuning-D435-and-D415-Cameras-Webinar_Rev3.pdf) and test with Realsense Viewer.
## Notice
### libusb in osx
-- libusb is NOT included in this repo. Should be installed to your system with 'brew install libusb' at first SDK install step.
\ No newline at end of file
+- libusb is NOT included in this repo. Should be installed to your system with 'brew install libusb' at first SDK install step.
diff --git a/exampleLiveCamera/exampleLiveCamera.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/exampleLiveCamera/exampleLiveCamera.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 0000000..949b678
--- /dev/null
+++ b/exampleLiveCamera/exampleLiveCamera.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ BuildSystemType
+ Original
+
+
diff --git a/exampleLiveCamera/src/ofApp.cpp b/exampleLiveCamera/src/ofApp.cpp
index 3eae946..c45e54f 100755
--- a/exampleLiveCamera/src/ofApp.cpp
+++ b/exampleLiveCamera/src/ofApp.cpp
@@ -9,18 +9,29 @@ void ofApp::setup(){
// if you see app crash at runtime, please check,
// 1. Copy Intel.Realsense.dll and realsense2.dll in to /bin?
// 2. Unplug and re-connect Realsense camera and restart app.
- pipe.start();
+ cfg.enable_stream(RS2_STREAM_DEPTH);
+ cfg.enable_stream(RS2_STREAM_COLOR);
+ pipe.start(cfg);
}
void ofApp::update(){
// Get depth data from camera
- auto frames = pipe.wait_for_frames();
+ rs2::frameset frames = pipe.wait_for_frames();
+
+ rs2::align align_to_color(RS2_STREAM_COLOR);
+ frames = align_to_color.process(frames);
+
auto depth = frames.get_depth_frame();
+ auto color = frames.get_color_frame();
+ pc.map_to(color);
points = pc.calculate(depth);
+ textureImg.setFromPixels((const unsigned char*) color.get_data(), color.get_width(), color.get_height(), OF_IMAGE_COLOR);
+
// Create oF mesh
mesh.clear();
+ mesh.setMode(OF_PRIMITIVE_POINTS);
int n = points.size();
if(n!=0){
const rs2::vertex * vs = points.get_vertices();
@@ -29,7 +40,13 @@ void ofApp::update(){
const rs2::vertex v = vs[i];
glm::vec3 v3(v.x,v.y,v.z);
mesh.addVertex(v3);
- mesh.addColor(ofFloatColor(0,0,ofMap(v.z, 2, 6, 1, 0), 0.8));
+
+ float red = (float)(textureImg.getPixels()[i * 3]);
+ float green = (float)(textureImg.getPixels()[(i * 3) + 1]);
+ float blue = (float)(textureImg.getPixels()[(i * 3) + 2]);
+ ofColor c = ofColor({red,green,blue});
+
+ mesh.addColor(c);
}
}
}
@@ -50,7 +67,7 @@ void ofApp::draw(){
ofDrawGridPlane(1, 5, true);
ofPopMatrix();
- mesh.drawVertices();
+ mesh.draw();
cam.end();
}
diff --git a/exampleLiveCamera/src/ofApp.h b/exampleLiveCamera/src/ofApp.h
index 875d7ef..71ebdb9 100755
--- a/exampleLiveCamera/src/ofApp.h
+++ b/exampleLiveCamera/src/ofApp.h
@@ -11,11 +11,17 @@ class ofApp : public ofBaseApp{
rs2::pipeline pipe;
rs2::device device;
+ rs2::config cfg;
+
rs2::points points;
rs2::pointcloud pc;
+ const rs2::texture_coordinate* texCoord;
+ rs2::frame colorFrame;
+
ofVboMesh mesh;
ofEasyCam cam;
+ ofImage textureImg;
};
diff --git a/examplePlayback/examplePlayback.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/examplePlayback/examplePlayback.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 0000000..949b678
--- /dev/null
+++ b/examplePlayback/examplePlayback.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ BuildSystemType
+ Original
+
+
diff --git a/libs/realsense2/include/librealsense2/h/rs_advanced_mode_command.h b/libs/realsense2/include/librealsense2/h/rs_advanced_mode_command.h
old mode 100755
new mode 100644
index eead854..ce8b462
--- a/libs/realsense2/include/librealsense2/h/rs_advanced_mode_command.h
+++ b/libs/realsense2/include/librealsense2/h/rs_advanced_mode_command.h
@@ -122,6 +122,11 @@ typedef struct
uint32_t vDiameter;
}STCensusRadius;
+typedef struct
+{
+ float amplitude;
+}STAFactor;
+
#ifdef __cplusplus
extern "C"{
#endif
diff --git a/libs/realsense2/include/librealsense2/h/rs_config.h b/libs/realsense2/include/librealsense2/h/rs_config.h
new file mode 100644
index 0000000..43bff1d
--- /dev/null
+++ b/libs/realsense2/include/librealsense2/h/rs_config.h
@@ -0,0 +1,200 @@
+/* License: Apache 2.0. See LICENSE file in root directory.
+Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
+
+/** \file rs_pipeline.h
+* \brief
+* Exposes RealSense processing-block functionality for C compilers
+*/
+
+
+#ifndef LIBREALSENSE_RS2_CONFIG_H
+#define LIBREALSENSE_RS2_CONFIG_H
+
+#define RS2_DEFAULT_TIMEOUT 15000
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "rs_types.h"
+#include "rs_sensor.h"
+
+ /**
+ * Create a config instance
+ * The config allows pipeline users to request filters for the pipeline streams and device selection and configuration.
+ * This is an optional step in pipeline creation, as the pipeline resolves its streaming device internally.
+ * Config provides its users a way to set the filters and test if there is no conflict with the pipeline requirements
+ * from the device. It also allows the user to find a matching device for the config filters and the pipeline, in order to
+ * select a device explicitly, and modify its controls before streaming starts.
+ *
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return rs2_config* A pointer to a new config instance
+ */
+ rs2_config* rs2_create_config(rs2_error** error);
+
+ /**
+ * Deletes an instance of a config
+ *
+ * \param[in] config A pointer to an instance of a config
+ */
+ void rs2_delete_config(rs2_config* config);
+
+ /**
+ * Enable a device stream explicitly, with selected stream parameters.
+ * The method allows the application to request a stream with specific configuration. If no stream is explicitly enabled, the pipeline
+ * configures the device and its streams according to the attached computer vision modules and processing blocks requirements, or
+ * default configuration for the first available device.
+ * The application can configure any of the input stream parameters according to its requirement, or set to 0 for don't care value.
+ * The config accumulates the application calls for enable configuration methods, until the configuration is applied. Multiple enable
+ * stream calls for the same stream with conflicting parameters override each other, and the last call is maintained.
+ * Upon calling \c resolve(), the config checks for conflicts between the application configuration requests and the attached computer
+ * vision modules and processing blocks requirements, and fails if conflicts are found. Before \c resolve() is called, no conflict
+ * check is done.
+ *
+ * \param[in] config A pointer to an instance of a config
+ * \param[in] stream Stream type to be enabled
+ * \param[in] index Stream index, used for multiple streams of the same type. -1 indicates any.
+ * \param[in] width Stream image width - for images streams. 0 indicates any.
+ * \param[in] height Stream image height - for images streams. 0 indicates any.
+ * \param[in] format Stream data format - pixel format for images streams, of data type for other streams. RS2_FORMAT_ANY indicates any.
+ * \param[in] framerate Stream frames per second. 0 indicates any.
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ void rs2_config_enable_stream(rs2_config* config,
+ rs2_stream stream,
+ int index,
+ int width,
+ int height,
+ rs2_format format,
+ int framerate,
+ rs2_error** error);
+
+ /**
+ * Enable all device streams explicitly.
+ * The conditions and behavior of this method are similar to those of \c enable_stream().
+ * This filter enables all raw streams of the selected device. The device is either selected explicitly by the application,
+ * or by the pipeline requirements or default. The list of streams is device dependent.
+ *
+ * \param[in] config A pointer to an instance of a config
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ void rs2_config_enable_all_stream(rs2_config* config, rs2_error ** error);
+
+ /**
+ * Select a specific device explicitly by its serial number, to be used by the pipeline.
+ * The conditions and behavior of this method are similar to those of \c enable_stream().
+ * This method is required if the application needs to set device or sensor settings prior to pipeline streaming, to enforce
+ * the pipeline to use the configured device.
+ *
+ * \param[in] config A pointer to an instance of a config
+ * \param[in] serial device serial number, as returned by RS2_CAMERA_INFO_SERIAL_NUMBER
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ void rs2_config_enable_device(rs2_config* config, const char* serial, rs2_error ** error);
+
+ /**
+ * Select a recorded device from a file, to be used by the pipeline through playback.
+ * The device available streams are as recorded to the file, and \c resolve() considers only this device and configuration
+ * as available.
+ * This request cannot be used if enable_record_to_file() is called for the current config, and vise versa
+ * By default, playback is repeated once the file ends. To control this, see 'rs2_config_enable_device_from_file_repeat_option'.
+ *
+ * \param[in] config A pointer to an instance of a config
+ * \param[in] file The playback file of the device
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ void rs2_config_enable_device_from_file(rs2_config* config, const char* file, rs2_error ** error);
+
+ /**
+ * Select a recorded device from a file, to be used by the pipeline through playback.
+ * The device available streams are as recorded to the file, and \c resolve() considers only this device and configuration
+ * as available.
+ * This request cannot be used if enable_record_to_file() is called for the current config, and vise versa
+ *
+ * \param[in] config A pointer to an instance of a config
+ * \param[in] file The playback file of the device
+ * \param[in] repeat_playback if true, when file ends the playback starts again, in an infinite loop;
+ if false, when file ends playback does not start again, and should by stopped manually by the user.
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ void rs2_config_enable_device_from_file_repeat_option(rs2_config* config, const char* file, int repeat_playback, rs2_error ** error);
+
+ /**
+ * Requires that the resolved device would be recorded to file
+ * This request cannot be used if enable_device_from_file() is called for the current config, and vise versa
+ *
+ * \param[in] config A pointer to an instance of a config
+ * \param[in] file The desired file for the output record
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ void rs2_config_enable_record_to_file(rs2_config* config, const char* file, rs2_error ** error);
+
+
+ /**
+ * Disable a device stream explicitly, to remove any requests on this stream type.
+ * The stream can still be enabled due to pipeline computer vision module request. This call removes any filter on the
+ * stream configuration.
+ *
+ * \param[in] config A pointer to an instance of a config
+ * \param[in] stream Stream type, for which the filters are cleared
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ void rs2_config_disable_stream(rs2_config* config, rs2_stream stream, rs2_error ** error);
+
+ /**
+ * Disable a device stream explicitly, to remove any requests on this stream profile.
+ * The stream can still be enabled due to pipeline computer vision module request. This call removes any filter on the
+ * stream configuration.
+ *
+ * \param[in] config A pointer to an instance of a config
+ * \param[in] stream Stream type, for which the filters are cleared
+ * \param[in] index Stream index, for which the filters are cleared
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ void rs2_config_disable_indexed_stream(rs2_config* config, rs2_stream stream, int index, rs2_error ** error);
+
+ /**
+ * Disable all device stream explicitly, to remove any requests on the streams profiles.
+ * The streams can still be enabled due to pipeline computer vision module request. This call removes any filter on the
+ * streams configuration.
+ *
+ * \param[in] config A pointer to an instance of a config
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ void rs2_config_disable_all_streams(rs2_config* config, rs2_error ** error);
+
+ /**
+ * Resolve the configuration filters, to find a matching device and streams profiles.
+ * The method resolves the user configuration filters for the device and streams, and combines them with the requirements of
+ * the computer vision modules and processing blocks attached to the pipeline. If there are no conflicts of requests, it looks
+ * for an available device, which can satisfy all requests, and selects the first matching streams configuration. In the absence
+ * of any request, the rs2::config selects the first available device and the first color and depth streams configuration.
+ * The pipeline profile selection during \c start() follows the same method. Thus, the selected profile is the same, if no
+ * change occurs to the available devices occurs.
+ * Resolving the pipeline configuration provides the application access to the pipeline selected device for advanced control.
+ * The returned configuration is not applied to the device, so the application doesn't own the device sensors. However, the
+ * application can call \c enable_device(), to enforce the device returned by this method is selected by pipeline \c start(),
+ * and configure the device and sensors options or extensions before streaming starts.
+ *
+ * \param[in] config A pointer to an instance of a config
+ * \param[in] pipe The pipeline for which the selected filters are applied
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return A matching device and streams profile, which satisfies the filters and pipeline requests.
+ */
+ rs2_pipeline_profile* rs2_config_resolve(rs2_config* config, rs2_pipeline* pipe, rs2_error ** error);
+
+ /**
+ * Check if the config can resolve the configuration filters, to find a matching device and streams profiles.
+ * The resolution conditions are as described in \c resolve().
+ *
+ * \param[in] config A pointer to an instance of a config
+ * \param[in] pipe The pipeline for which the selected filters are applied
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return True if a valid profile selection exists, false if no selection can be found under the config filters and the available devices.
+ */
+ int rs2_config_can_resolve(rs2_config* config, rs2_pipeline* pipe, rs2_error ** error);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/libs/realsense2/include/librealsense2/h/rs_context.h b/libs/realsense2/include/librealsense2/h/rs_context.h
old mode 100755
new mode 100644
index 52718f3..cd316cd
--- a/libs/realsense2/include/librealsense2/h/rs_context.h
+++ b/libs/realsense2/include/librealsense2/h/rs_context.h
@@ -54,6 +54,14 @@ void rs2_set_devices_changed_callback(const rs2_context* context, rs2_devices_ch
* @return A pointer to a device that plays data from the file, or null in case of failure
*/
rs2_device* rs2_context_add_device(rs2_context* ctx, const char* file, rs2_error** error);
+
+/**
+ * Add an instance of software device to the context
+ * \param ctx The context to which the new device will be added
+ * \param dev Instance of software device to register into the context
+ * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+void rs2_context_add_software_device(rs2_context* ctx, rs2_device* dev, rs2_error** error);
/**
* Removes a playback device from the context, if exists
@@ -63,6 +71,15 @@ rs2_device* rs2_context_add_device(rs2_context* ctx, const char* file, rs2_error
*/
void rs2_context_remove_device(rs2_context* ctx, const char* file, rs2_error** error);
+/**
+ * Removes tracking module.
+ * function query_devices() locks the tracking module in the tm_context object.
+ * If the tracking module device is not used it should be removed using this function, so that other applications could find it.
+ * This function can be used both before the call to query_device() to prevent enabling tracking modules or afterwards to
+ * release them.
+ */
+void rs2_context_unload_tracking_module(rs2_context* ctx, rs2_error** error);
+
/**
* create a static snapshot of all connected devices at the time of the call
* \param context Object representing librealsense session
@@ -71,6 +88,25 @@ void rs2_context_remove_device(rs2_context* ctx, const char* file, rs2_error** e
*/
rs2_device_list* rs2_query_devices(const rs2_context* context, rs2_error** error);
+#define RS2_PRODUCT_LINE_ANY 0xff
+#define RS2_PRODUCT_LINE_ANY_INTEL 0xfe
+#define RS2_PRODUCT_LINE_NON_INTEL 0x01
+#define RS2_PRODUCT_LINE_D400 0x02
+#define RS2_PRODUCT_LINE_SR300 0x04
+#define RS2_PRODUCT_LINE_L500 0x08
+#define RS2_PRODUCT_LINE_T200 0x10
+#define RS2_PRODUCT_LINE_DEPTH (RS2_PRODUCT_LINE_L500 | RS2_PRODUCT_LINE_SR300 | RS2_PRODUCT_LINE_D400)
+#define RS2_PRODUCT_LINE_TRACKING RS2_PRODUCT_LINE_T200
+
+/**
+* create a static snapshot of all connected devices at the time of the call
+* \param context Object representing librealsense session
+* \param product_mask Controls what kind of devices will be returned
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return the list of devices, should be released by rs2_delete_device_list
+*/
+rs2_device_list* rs2_query_devices_ex(const rs2_context* context, int product_mask, rs2_error** error);
+
/**
* \brief Creates RealSense device_hub .
* \param[in] context The context for the device hub
@@ -93,7 +129,7 @@ void rs2_delete_device_hub(const rs2_device_hub* hub);
* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
* \return device object
*/
-rs2_device* rs2_device_hub_wait_for_device(rs2_context* ctx, const rs2_device_hub* hub, rs2_error** error);
+rs2_device* rs2_device_hub_wait_for_device(const rs2_device_hub* hub, rs2_error** error);
/**
* Checks if device is still connected
diff --git a/libs/realsense2/include/librealsense2/h/rs_device.h b/libs/realsense2/include/librealsense2/h/rs_device.h
old mode 100755
new mode 100644
index 5ef5de3..3ed6031
--- a/libs/realsense2/include/librealsense2/h/rs_device.h
+++ b/libs/realsense2/include/librealsense2/h/rs_device.h
@@ -146,6 +146,275 @@ void rs2_connect_tm2_controller(const rs2_device* device, const unsigned char* m
*/
void rs2_disconnect_tm2_controller(const rs2_device* device, int id, rs2_error** error);
+
+/**
+* Reset device to factory calibration
+* \param[in] device The RealSense device
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_reset_to_factory_calibration(const rs2_device* device, rs2_error** e);
+
+/**
+* Write calibration to device's EEPROM
+* \param[in] device The RealSense device
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_write_calibration(const rs2_device* device, rs2_error** e);
+
+/**
+* Update device to the provided firmware, the device must be extendable to RS2_EXTENSION_UPDATABLE.
+* This call is executed on the caller's thread and it supports progress notifications via the optional callback.
+* \param[in] device Device to update
+* \param[in] fw_image Firmware image buffer
+* \param[in] fw_image_size Firmware image buffer size
+* \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_update_firmware_cpp(const rs2_device* device, const void* fw_image, int fw_image_size, rs2_update_progress_callback* callback, rs2_error** error);
+
+/**
+* Update device to the provided firmware, the device must be extendable to RS2_EXTENSION_UPDATABLE.
+* This call is executed on the caller's thread and it supports progress notifications via the optional callback.
+* \param[in] device Device to update
+* \param[in] fw_image Firmware image buffer
+* \param[in] fw_image_size Firmware image buffer size
+* \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
+* \param[in] client_data Optional client data for the callback
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_update_firmware(const rs2_device* device, const void* fw_image, int fw_image_size, rs2_update_progress_callback_ptr callback, void* client_data, rs2_error** error);
+
+/**
+* Create backup of camera flash memory. Such backup does not constitute valid firmware image, and cannot be
+* loaded back to the device, but it does contain all calibration and device information.
+* \param[in] device Device to update
+* \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+const rs2_raw_data_buffer* rs2_create_flash_backup_cpp(const rs2_device* device, rs2_update_progress_callback* callback, rs2_error** error);
+
+/**
+* Create backup of camera flash memory. Such backup does not constitute valid firmware image, and cannot be
+* loaded back to the device, but it does contain all calibration and device information.
+* \param[in] device Device to update
+* \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
+* \param[in] client_data Optional client data for the callback
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+const rs2_raw_data_buffer* rs2_create_flash_backup(const rs2_device* device, rs2_update_progress_callback_ptr callback, void* client_data, rs2_error** error);
+
+#define RS2_UNSIGNED_UPDATE_MODE_UPDATE 0
+#define RS2_UNSIGNED_UPDATE_MODE_READ_ONLY 1
+#define RS2_UNSIGNED_UPDATE_MODE_FULL 2
+
+/**
+* Update device to the provided firmware by writing raw data directly to the flash, this command can be executed only on unlocked camera.
+* The device must be extendable to RS2_EXTENSION_UPDATABLE.
+* This call is executed on the caller's thread and it supports progress notifications via the optional callback.
+* \param[in] device Device to update
+* \param[in] fw_image Firmware image buffer
+* \param[in] fw_image_size Firmware image buffer size
+* \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
+* \param[in] update_mode Select one of RS2_UNSIGNED_UPDATE_MODE, WARNING!!! setting to any option other than RS2_UNSIGNED_UPDATE_MODE_UPDATE will make this call unsafe and might damage the camera
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_update_firmware_unsigned_cpp(const rs2_device* device, const void* fw_image, int fw_image_size, rs2_update_progress_callback* callback, int update_mode, rs2_error** error);
+
+/**
+* Update device to the provided firmware by writing raw data directly to the flash, this command can be executed only on unlocked camera.
+* The device must be extendable to RS2_EXTENSION_UPDATABLE.
+* This call is executed on the caller's thread and it supports progress notifications via the optional callback.
+* \param[in] device Device to update
+* \param[in] fw_image Firmware image buffer
+* \param[in] fw_image_size Firmware image buffer size
+* \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
+* \param[in] client_data Optional client data for the callback
+* \param[in] update_mode Select one of RS2_UNSIGNED_UPDATE_MODE, WARNING!!! setting to any option other than RS2_UNSIGNED_UPDATE_MODE_UPDATE will make this call unsafe and might damage the camera
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_update_firmware_unsigned(const rs2_device* device, const void* fw_image, int fw_image_size, rs2_update_progress_callback_ptr callback, void* client_data, int update_mode, rs2_error** error);
+
+/**
+* Enter the device to update state, this will cause the updatable device to disconnect and reconnect as update device.
+* \param[in] device Device to update
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_enter_update_state(const rs2_device* device, rs2_error** error);
+
+/**
+* This will improve the depth noise.
+* \param[in] json_content Json string to configure speed on chip calibration parameters:
+ {
+ "speed": 3,
+ "scan parameter": 0,
+ "data sampling": 0
+ }
+ speed - value can be one of: Very fast = 0, Fast = 1, Medium = 2, Slow = 3, White wall = 4, default is Slow
+ scan_parameter - value can be one of: Py scan (default) = 0, Rx scan = 1
+ data_sampling - value can be one of:polling data sampling = 0, interrupt data sampling = 1
+ if json is nullptr it will be ignored and calibration will use the default parameters
+* \param[out] health Calibration Health-Check captures how far camera calibration is from the optimal one
+ [0, 0.25) - Good
+ [0.25, 0.75) - Can be Improved
+ [0.75, ) - Requires Calibration
+* \param[in] callback Optional callback to get progress notifications
+* \param[in] timeout_ms Timeout in ms (use 5000 msec unless instructed otherwise)
+* \return New calibration table
+*/
+const rs2_raw_data_buffer* rs2_run_on_chip_calibration_cpp(rs2_device* device, const void* json_content, int content_size, float* health, rs2_update_progress_callback* progress_callback, int timeout_ms, rs2_error** error);
+
+/**
+* This will improve the depth noise.
+* \param[in] json_content Json string to configure speed on chip calibration parameters:
+ {
+ "speed": 3,
+ "scan parameter": 0,
+ "data sampling": 0
+ }
+ speed - value can be one of: Very fast = 0, Fast = 1, Medium = 2, Slow = 3, White wall = 4, default is Slow
+ scan_parameter - value can be one of: Py scan (default) = 0, Rx scan = 1
+ data_sampling - value can be one of:polling data sampling = 0, interrupt data sampling = 1
+ if json is nullptr it will be ignored and calibration will use the default parameters
+* \param[out] health Calibration Health-Check captures how far camera calibration is from the optimal one
+ [0, 0.25) - Good
+ [0.25, 0.75) - Can be Improved
+ [0.75, ) - Requires Calibration
+* \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
+* \param[in] client_data Optional client data for the callback
+* \param[in] timeout_ms Timeout in ms (use 5000 msec unless instructed otherwise)
+* \return New calibration table
+*/
+const rs2_raw_data_buffer* rs2_run_on_chip_calibration(rs2_device* device, const void* json_content, int content_size, float* health, rs2_update_progress_callback_ptr callback, void* client_data, int timeout_ms, rs2_error** error);
+
+/**
+* This will adjust camera absolute distance to flat target. User needs to enter the known ground truth.
+* \param[in] ground_truth_mm Ground truth in mm must be between 2500 - 2000000
+* \param[in] json_content Json string to configure tare calibration parameters:
+ {
+ "average step count": 20,
+ "step count": 20,
+ "accuracy": 2,
+ "scan parameter": 0,
+ "data sampling": 0
+ }
+ average step count - number of frames to average, must be between 1 - 30, default = 20
+ step count - max iteration steps, must be between 5 - 30, default = 10
+ accuracy - Subpixel accuracy level, value can be one of: Very high = 0 (0.025%), High = 1 (0.05%), Medium = 2 (0.1%), Low = 3 (0.2%), Default = Very high (0.025%), default is very high (0.025%)
+ scan_parameter - value can be one of: Py scan (default) = 0, Rx scan = 1
+ data_sampling - value can be one of:polling data sampling = 0, interrupt data sampling = 1
+ if json is nullptr it will be ignored and calibration will use the default parameters
+* \param[in] content_size Json string size if its 0 the json will be ignored and calibration will use the default parameters
+* \param[in] callback Optional callback to get progress notifications
+* \param[in] timeout_ms Timeout in ms (use 5000 msec unless instructed otherwise)
+* \return New calibration table
+*/
+const rs2_raw_data_buffer* rs2_run_tare_calibration_cpp(rs2_device* dev, float ground_truth_mm, const void* json_content, int content_size, rs2_update_progress_callback* progress_callback, int timeout_ms, rs2_error** error);
+
+
+/**
+ * Used in device_calibration; enumerates the different calibration types
+ * available for that extension.
+ */
+typedef enum rs2_calibration_type
+{
+ RS2_CALIBRATION_DEPTH_TO_RGB,
+ RS2_CALIBRATION_TYPE_COUNT
+} rs2_calibration_type;
+const char* rs2_calibration_type_to_string( rs2_calibration_type );
+
+/**
+ * Used in device_calibration with rs2_calibration_change_callback
+ */
+typedef enum rs2_calibration_status
+{
+ // Anything >= 0 is not an issue
+ RS2_CALIBRATION_SPECIAL_FRAME = 0, // Special frame received; expect a frame-drop!
+ RS2_CALIBRATION_STARTED = 1, // Have all frames in hand; starting processing
+ RS2_CALIBRATION_NOT_NEEDED = 2, // Finished; existing calibration within tolerances; nothing done!
+ RS2_CALIBRATION_SUCCESSFUL = 3, // Finished; have new calibration in-hand
+
+ RS2_CALIBRATION_RETRY = -1, // Initiating retry (asked for a new special frame)
+ RS2_CALIBRATION_FAILED = -2,
+ RS2_CALIBRATION_SCENE_INVALID = -3, // Scene was not good enough for calibration; will retry
+ RS2_CALIBRATION_BAD_RESULT = -4, // Calibration finished, but results aren't good; will retry
+
+ RS2_CALIBRATION_STATUS_FIRST = -4,
+ RS2_CALIBRATION_STATUS_LAST = 3,
+ RS2_CALIBRATION_STATUS_COUNT = RS2_CALIBRATION_STATUS_LAST - RS2_CALIBRATION_STATUS_FIRST + 1,
+} rs2_calibration_status;
+const char* rs2_calibration_status_to_string( rs2_calibration_status );
+
+typedef struct rs2_calibration_change_callback rs2_calibration_change_callback;
+typedef void (*rs2_calibration_change_callback_ptr)(rs2_calibration_status, void* arg);
+
+/**
+ * Adds a callback for a sensor that gets called when calibration (intrinsics) changes, e.g. due to auto-calibration
+ * \param[in] sensor the sensor
+ * \param[in] callback the C callback function that gets called
+ * \param[in] user user argument that gets passed to the callback function
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+void rs2_register_calibration_change_callback( rs2_device* dev, rs2_calibration_change_callback_ptr callback, void* user, rs2_error** error );
+
+/**
+ * Adds a callback for a sensor that gets called when calibration (intrinsics) changes, e.g. due to auto-calibration
+ * \param[in] sensor the sensor
+ * \param[in] callback the C++ callback interface that gets called
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+void rs2_register_calibration_change_callback_cpp( rs2_device* dev, rs2_calibration_change_callback* callback, rs2_error** error );
+
+/**
+ * Triggers calibration of the given type
+ * \param[in] dev the device
+ * \param[in] type the type of calibration requested
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+void rs2_trigger_device_calibration( rs2_device* dev, rs2_calibration_type type, rs2_error** error );
+
+/**
+* This will adjust camera absolute distance to flat target. User needs to enter the known ground truth.
+* \param[in] ground_truth_mm Ground truth in mm must be between 2500 - 2000000
+* \param[in] json_content Json string to configure tare calibration parameters:
+ {
+ "average_step_count": 20,
+ "step count": 20,
+ "accuracy": 2,
+ "scan parameter": 0,
+ "data sampling": 0
+ }
+ average step count - number of frames to average, must be between 1 - 30, default = 20
+ step count - max iteration steps, must be between 5 - 30, default = 10
+ accuracy - Subpixel accuracy level, value can be one of: Very high = 0 (0.025%), High = 1 (0.05%), Medium = 2 (0.1%), Low = 3 (0.2%), Default = Very high (0.025%), default is very high (0.025%)
+ scan_parameter - value can be one of: Py scan (default) = 0, Rx scan = 1
+ data_sampling - value can be one of:polling data sampling = 0, interrupt data sampling = 1
+ if json is nullptr it will be ignored and calibration will use the default parameters
+* \param[in] content_size Json string size if its 0 the json will be ignored and calibration will use the default parameters
+* \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
+* \param[in] client_data Optional client data for the callback
+* \param[in] timeout_ms Timeout in ms (use 5000 msec unless instructed otherwise)
+* \return New calibration table
+*/
+const rs2_raw_data_buffer* rs2_run_tare_calibration(rs2_device* dev, float ground_truth_mm, const void* json_content, int content_size, rs2_update_progress_callback_ptr callback, void* client_data, int timeout_ms, rs2_error** error);
+
+/**
+* Read current calibration table from flash.
+* \return Calibration table
+*/
+const rs2_raw_data_buffer* rs2_get_calibration_table(const rs2_device* dev, rs2_error** error);
+
+/**
+* Set current table to dynamic area.
+* \param[in] Calibration table
+*/
+void rs2_set_calibration_table(const rs2_device* device, const void* calibration, int calibration_size, rs2_error** error);
+
+/* Serialize JSON content, returns ASCII-serialized JSON string on success. otherwise nullptr */
+rs2_raw_data_buffer* rs2_serialize_json(rs2_device* dev, rs2_error** error);
+
+/* Load JSON and apply advanced-mode controls */
+void rs2_load_json(rs2_device* dev, const void* json_content, unsigned content_size, rs2_error** error);
+
#ifdef __cplusplus
}
#endif
diff --git a/libs/realsense2/include/librealsense2/h/rs_frame.h b/libs/realsense2/include/librealsense2/h/rs_frame.h
old mode 100755
new mode 100644
index c346d24..f507362
--- a/libs/realsense2/include/librealsense2/h/rs_frame.h
+++ b/libs/realsense2/include/librealsense2/h/rs_frame.h
@@ -20,11 +20,12 @@ typedef enum rs2_timestamp_domain
{
RS2_TIMESTAMP_DOMAIN_HARDWARE_CLOCK, /**< Frame timestamp was measured in relation to the camera clock */
RS2_TIMESTAMP_DOMAIN_SYSTEM_TIME, /**< Frame timestamp was measured in relation to the OS system clock */
+ RS2_TIMESTAMP_DOMAIN_GLOBAL_TIME, /**< Frame timestamp was measured in relation to the camera clock and converted to OS system clock by constantly measure the difference*/
RS2_TIMESTAMP_DOMAIN_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
} rs2_timestamp_domain;
const char* rs2_timestamp_domain_to_string(rs2_timestamp_domain info);
-/** \brief Per-Frame-Metadata are set of read-only properties that might be exposed for each individual frame */
+/** \brief Per-Frame-Metadata is the set of read-only properties that might be exposed for each individual frame. */
typedef enum rs2_frame_metadata_value
{
RS2_FRAME_METADATA_FRAME_COUNTER , /**< A sequential index managed per-stream. Integer value*/
@@ -40,9 +41,9 @@ typedef enum rs2_frame_metadata_value
RS2_FRAME_METADATA_BACKEND_TIMESTAMP , /**< Timestamp get from uvc driver. usec*/
RS2_FRAME_METADATA_ACTUAL_FPS , /**< Actual fps */
RS2_FRAME_METADATA_FRAME_LASER_POWER , /**< Laser power value 0-360. */
- RS2_FRAME_METADATA_FRAME_LASER_POWER_MODE , /**< Laser power mode. Zero corresponds to Laser power switched off and one for switched on. */
+ RS2_FRAME_METADATA_FRAME_LASER_POWER_MODE , /**< Laser power mode. Zero corresponds to Laser power switched off and one for switched on. deprecated, replaced by RS2_FRAME_METADATA_FRAME_EMITTER_MODE*/
RS2_FRAME_METADATA_EXPOSURE_PRIORITY , /**< Exposure priority. */
- RS2_FRAME_METADATA_EXPOSURE_ROI_LEFT , /**< Left region of interest for the auto exposure Algorithm. */
+ RS2_FRAME_METADATA_EXPOSURE_ROI_LEFT , /**< Left region of interest for the auto exposure Algorithm. */
RS2_FRAME_METADATA_EXPOSURE_ROI_RIGHT , /**< Right region of interest for the auto exposure Algorithm. */
RS2_FRAME_METADATA_EXPOSURE_ROI_TOP , /**< Top region of interest for the auto exposure Algorithm. */
RS2_FRAME_METADATA_EXPOSURE_ROI_BOTTOM , /**< Bottom region of interest for the auto exposure Algorithm. */
@@ -57,49 +58,14 @@ typedef enum rs2_frame_metadata_value
RS2_FRAME_METADATA_MANUAL_WHITE_BALANCE , /**< Color image white balance. */
RS2_FRAME_METADATA_POWER_LINE_FREQUENCY , /**< Power Line Frequency for anti-flickering Off/50Hz/60Hz/Auto. */
RS2_FRAME_METADATA_LOW_LIGHT_COMPENSATION , /**< Color lowlight compensation. Zero corresponds to switched off. */
+ RS2_FRAME_METADATA_FRAME_EMITTER_MODE , /**< Emitter mode: 0 - all emitters disabled. 1 - laser enabled. 2 - auto laser enabled (opt). 3 - LED enabled (opt).*/
+ RS2_FRAME_METADATA_FRAME_LED_POWER , /**< Led power value 0-360. */
+ RS2_FRAME_METADATA_RAW_FRAME_SIZE , /**< The number of transmitted payload bytes, not including metadata */
RS2_FRAME_METADATA_COUNT
} rs2_frame_metadata_value;
const char* rs2_frame_metadata_to_string(rs2_frame_metadata_value metadata);
const char* rs2_frame_metadata_value_to_string(rs2_frame_metadata_value metadata);
-/** \brief 3D coordinates with origin at topmost left corner of the lense,
- with positive Z pointing away from the camera, positive X pointing camera right and positive Y pointing camera down */
-typedef struct rs2_vertex
-{
- float xyz[3];
-} rs2_vertex;
-
-/** \brief Pixel location within 2D image. (0,0) is the topmost, left corner. Positive X is right, positive Y is down */
-typedef struct rs2_pixel
-{
- int ij[2];
-} rs2_pixel;
-
-/** \brief 3D vector in Euclidean coordinate space */
-typedef struct rs2_vector
-{
- float x, y, z;
-}rs2_vector;
-
-/** \brief Quaternion used to represent rotation */
-typedef struct rs2_quaternion
-{
- float x, y, z, w;
-}rs2_quaternion;
-
-typedef struct rs2_pose
-{
- rs2_vector translation; /**< X, Y, Z values of translation, in meters (relative to initial position) */
- rs2_vector velocity; /**< X, Y, Z values of velocity, in meter/sec */
- rs2_vector acceleration; /**< X, Y, Z values of acceleration, in meter/sec^2 */
- rs2_quaternion rotation; /**< Qi, Qj, Qk, Qr components of rotation as represented in quaternion rotation (relative to initial position) */
- rs2_vector angular_velocity; /**< X, Y, Z values of angular velocity, in radians/sec */
- rs2_vector angular_acceleration; /**< X, Y, Z values of angular acceleration, in radians/sec^2 */
- unsigned int tracker_confidence; /**< pose data confidence 0x0 - Failed, 0x1 - Low, 0x2 - Medium, 0x3 - High */
- unsigned int mapper_confidence; /**< pose data confidence 0x0 - Failed, 0x1 - Low, 0x2 - Medium, 0x3 - High */
-} rs2_pose;
-
-
/**
* retrieve metadata from frame handle
* \param[in] frame handle returned from a callback
@@ -136,6 +102,14 @@ rs2_timestamp_domain rs2_get_frame_timestamp_domain(const rs2_frame* frameset, r
*/
rs2_time_t rs2_get_frame_timestamp(const rs2_frame* frame, rs2_error** error);
+/**
+* retrieve frame parent sensor from frame handle
+* \param[in] frame handle returned from a callback
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return the parent sensor of the frame
+*/
+rs2_sensor* rs2_get_frame_sensor(const rs2_frame* frame, rs2_error** error);
+
/**
* retrieve frame number from frame handle
* \param[in] frame handle returned from a callback
@@ -144,6 +118,14 @@ rs2_time_t rs2_get_frame_timestamp(const rs2_frame* frame, rs2_error** error);
*/
unsigned long long rs2_get_frame_number(const rs2_frame* frame, rs2_error** error);
+/**
+* retrieve data size from frame handle
+* \param[in] frame handle returned from a callback
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return the size of the frame data
+*/
+int rs2_get_frame_data_size(const rs2_frame* frame, rs2_error** error);
+
/**
* retrieve data from frame handle
* \param[in] frame handle returned from a callback
@@ -168,6 +150,12 @@ int rs2_get_frame_width(const rs2_frame* frame, rs2_error** error);
*/
int rs2_get_frame_height(const rs2_frame* frame, rs2_error** error);
+/**
+* retrieve the scaling factor to use when converting a depth frame's get_data() units to meters
+* \return float - depth, in meters, per 1 unit stored in the frame data
+*/
+float rs2_depth_frame_get_units( const rs2_frame* frame, rs2_error** error );
+
/**
* retrieve frame stride in bytes (number of bytes from start of line N to start of line N+1)
* \param[in] frame handle returned from a callback
@@ -276,6 +264,30 @@ int rs2_is_frame_extendable_to(const rs2_frame* frame, rs2_extension extension_t
rs2_frame* rs2_allocate_synthetic_video_frame(rs2_source* source, const rs2_stream_profile* new_stream, rs2_frame* original,
int new_bpp, int new_width, int new_height, int new_stride, rs2_extension frame_type, rs2_error** error);
+/**
+* Allocate new motion frame using a frame-source provided form a processing block
+* \param[in] source Frame pool to allocate the frame from
+* \param[in] new_stream New stream profile to assign to newly created frame
+* \param[in] original A reference frame that can be used to fill in auxilary information like format, width, height, bpp, stride (if applicable)
+* \param[in] frame_type New value for frame type for the allocated frame
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return reference to a newly allocated frame, must be released with release_frame
+* memory for the frame is likely to be re-used from previous frame, but in lack of available frames in the pool will be allocated from the free store
+*/
+rs2_frame* rs2_allocate_synthetic_motion_frame(rs2_source* source, const rs2_stream_profile* new_stream, rs2_frame* original,
+ rs2_extension frame_type, rs2_error** error);
+
+/**
+* Allocate new points frame using a frame-source provided from a processing block
+* \param[in] source Frame pool to allocate the frame from
+* \param[in] new_stream New stream profile to assign to newly created frame
+* \param[in] original A reference frame that can be used to fill in auxilary information like format, width, height, bpp, stride (if applicable)
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return reference to a newly allocated frame, must be released with release_frame
+* memory for the frame is likely to be re-used from previous frame, but in lack of available frames in the pool will be allocated from the free store
+*/
+rs2_frame* rs2_allocate_points(rs2_source* source, const rs2_stream_profile* new_stream, rs2_frame* original, rs2_error** error);
+
/**
* Allocate new composite frame, aggregating a set of existing frames
* \param[in] source Frame pool to allocate the frame from
@@ -323,9 +335,6 @@ void rs2_synthetic_frame_ready(rs2_source* source, rs2_frame* frame, rs2_error**
*/
void rs2_pose_frame_get_pose_data(const rs2_frame* frame, rs2_pose* pose, rs2_error** error);
-
-
-
#ifdef __cplusplus
}
#endif
diff --git a/libs/realsense2/include/librealsense2/h/rs_internal.h b/libs/realsense2/include/librealsense2/h/rs_internal.h
old mode 100755
new mode 100644
index d812c99..3807d6b
--- a/libs/realsense2/include/librealsense2/h/rs_internal.h
+++ b/libs/realsense2/include/librealsense2/h/rs_internal.h
@@ -30,7 +30,7 @@ typedef enum rs2_recording_mode
RS2_RECORDING_MODE_COUNT
} rs2_recording_mode;
-/** \brief All the parameters are requaired to defind video stream*/
+/** \brief All the parameters required to define a video stream. */
typedef struct rs2_video_stream
{
rs2_stream type;
@@ -44,7 +44,28 @@ typedef struct rs2_video_stream
rs2_intrinsics intrinsics;
} rs2_video_stream;
-/** \brief All the parameters are requaired to define video frame*/
+/** \brief All the parameters required to define a motion stream. */
+typedef struct rs2_motion_stream
+{
+ rs2_stream type;
+ int index;
+ int uid;
+ int fps;
+ rs2_format fmt;
+ rs2_motion_device_intrinsic intrinsics;
+} rs2_motion_stream;
+
+/** \brief All the parameters required to define a pose stream. */
+typedef struct rs2_pose_stream
+{
+ rs2_stream type;
+ int index;
+ int uid;
+ int fps;
+ rs2_format fmt;
+} rs2_pose_stream;
+
+/** \brief All the parameters required to define a video frame. */
typedef struct rs2_software_video_frame
{
void* pixels;
@@ -57,6 +78,51 @@ typedef struct rs2_software_video_frame
const rs2_stream_profile* profile;
} rs2_software_video_frame;
+/** \brief All the parameters required to define a motion frame. */
+typedef struct rs2_software_motion_frame
+{
+ void* data;
+ void(*deleter)(void*);
+ rs2_time_t timestamp;
+ rs2_timestamp_domain domain;
+ int frame_number;
+ const rs2_stream_profile* profile;
+} rs2_software_motion_frame;
+
+/** \brief All the parameters required to define a pose frame. */
+typedef struct rs2_software_pose_frame
+{
+ struct pose_frame_info
+ {
+ float translation[3];
+ float velocity[3];
+ float acceleration[3];
+ float rotation[4];
+ float angular_velocity[3];
+ float angular_acceleration[3];
+ int tracker_confidence;
+ int mapper_confidence;
+ };
+ void* data;
+ void(*deleter)(void*);
+ rs2_time_t timestamp;
+ rs2_timestamp_domain domain;
+ int frame_number;
+ const rs2_stream_profile* profile;
+} rs2_software_pose_frame;
+
+/** \brief All the parameters required to define a sensor notification. */
+typedef struct rs2_software_notification
+{
+ rs2_notification_category category;
+ int type;
+ rs2_log_severity severity;
+ const char* description;
+ const char* serialized_data;
+} rs2_software_notification;
+
+struct rs2_software_device_destruction_callback;
+
/**
* Create librealsense context that will try to record all operations over librealsense into a file
* \param[in] api_version realsense API version as provided by RS2_API_VERSION macro
@@ -108,13 +174,38 @@ rs2_device* rs2_create_software_device(rs2_error** error);
rs2_sensor* rs2_software_device_add_sensor(rs2_device* dev, const char* sensor_name, rs2_error** error);
/**
- * Inject frame to software sonsor
+ * Inject video frame to software sonsor
* \param[in] sensor the software sensor
* \param[in] frame all the frame components
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
void rs2_software_sensor_on_video_frame(rs2_sensor* sensor, rs2_software_video_frame frame, rs2_error** error);
+/**
+* Inject motion frame to software sonsor
+* \param[in] sensor the software sensor
+* \param[in] frame all the frame components
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_software_sensor_on_motion_frame(rs2_sensor* sensor, rs2_software_motion_frame frame, rs2_error** error);
+
+/**
+* Inject pose frame to software sonsor
+* \param[in] sensor the software sensor
+* \param[in] frame all the frame components
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_software_sensor_on_pose_frame(rs2_sensor* sensor, rs2_software_pose_frame frame, rs2_error** error);
+
+
+/**
+* Inject notification to software sonsor
+* \param[in] sensor the software sensor
+* \param[in] notif all the notification components
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_software_sensor_on_notification(rs2_sensor* sensor, rs2_software_notification notif, rs2_error** error);
+
/**
* Set frame metadata for the upcoming frames
* \param[in] sensor the software sensor
@@ -124,6 +215,22 @@ void rs2_software_sensor_on_video_frame(rs2_sensor* sensor, rs2_software_video_f
*/
void rs2_software_sensor_set_metadata(rs2_sensor* sensor, rs2_frame_metadata_value value, rs2_metadata_type type, rs2_error** error);
+/**
+* set callback to be notified when a specific software device is destroyed
+* \param[in] dev software device
+* \param[in] on_notification function pointer to register as callback
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_software_device_set_destruction_callback(const rs2_device* dev, rs2_software_device_destruction_callback_ptr on_notification, void* user, rs2_error** error);
+
+/**
+* set callback to be notified when a specific software device is destroyed
+* \param[in] dev software device
+* \param[in] callback callback object created from c++ application. ownership over the callback object is moved into the relevant device lock
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_software_device_set_destruction_callback_cpp(const rs2_device* dev, rs2_software_device_destruction_callback* callback, rs2_error** error);
+
/**
* Set the wanted matcher type that will be used by the syncer
* \param[in] dev the software device
@@ -132,6 +239,24 @@ void rs2_software_sensor_set_metadata(rs2_sensor* sensor, rs2_frame_metadata_val
*/
void rs2_software_device_create_matcher(rs2_device* dev, rs2_matchers matcher, rs2_error** error);
+/**
+ * Register a camera info value for the software device
+ * \param[in] dev the software device
+ * \param[in] info identifier for the camera info to add.
+ * \param[in] val string value for this new camera info.
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+void rs2_software_device_register_info(rs2_device* dev, rs2_camera_info info, const char *val, rs2_error** error);
+
+/**
+ * Update an existing camera info value for the software device
+ * \param[in] dev the software device
+ * \param[in] info identifier for the camera info to add.
+ * \param[in] val string value for this new camera info.
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+void rs2_software_device_update_info(rs2_device* dev, rs2_camera_info info, const char * val, rs2_error** error);
+
/**
* Add video stream to sensor
* \param[in] sensor the software sensor
@@ -140,6 +265,49 @@ void rs2_software_device_create_matcher(rs2_device* dev, rs2_matchers matcher, r
*/
rs2_stream_profile* rs2_software_sensor_add_video_stream(rs2_sensor* sensor, rs2_video_stream video_stream, rs2_error** error);
+/**
+ * Add video stream to sensor
+ * \param[in] sensor the software sensor
+ * \param[in] video_stream all the stream components
+ * \param[in] is_default whether or not the stream should be a default stream for the device
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+rs2_stream_profile* rs2_software_sensor_add_video_stream_ex(rs2_sensor* sensor, rs2_video_stream video_stream, int is_default, rs2_error** error);
+
+/**
+* Add motion stream to sensor
+* \param[in] sensor the software sensor
+* \param[in] motion_stream all the stream components
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+rs2_stream_profile* rs2_software_sensor_add_motion_stream(rs2_sensor* sensor, rs2_motion_stream motion_stream, rs2_error** error);
+
+/**
+* Add motion stream to sensor
+* \param[in] sensor the software sensor
+* \param[in] motion_stream all the stream components
+* \param[in] is_default whether or not the stream should be a default stream for the device
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+rs2_stream_profile* rs2_software_sensor_add_motion_stream_ex(rs2_sensor* sensor, rs2_motion_stream motion_stream, int is_default, rs2_error** error);
+
+/**
+* Add pose stream to sensor
+* \param[in] sensor the software sensor
+* \param[in] pose_stream all the stream components
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+rs2_stream_profile* rs2_software_sensor_add_pose_stream(rs2_sensor* sensor, rs2_pose_stream pose_stream, rs2_error** error);
+
+/**
+* Add pose stream to sensor
+* \param[in] sensor the software sensor
+* \param[in] pose_stream all the stream components
+* \param[in] is_default whether or not the stream should be a default stream for the device
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+rs2_stream_profile* rs2_software_sensor_add_pose_stream_ex(rs2_sensor* sensor, rs2_pose_stream pose_stream, int is_default, rs2_error** error);
+
/**
* Add read only option to sensor
* \param[in] sensor the software sensor
@@ -157,6 +325,217 @@ void rs2_software_sensor_add_read_only_option(rs2_sensor* sensor, rs2_option opt
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
void rs2_software_sensor_update_read_only_option(rs2_sensor* sensor, rs2_option option, float val, rs2_error** error);
+
+/**
+ * Add an option to sensor
+ * \param[in] sensor the software sensor
+ * \param[in] option the wanted option
+ * \param[in] min the minimum value which will be accepted for this option
+ * \param[in] max the maximum value which will be accepted for this option
+ * \param[in] step the granularity of options which accept discrete values, or zero if the option accepts continuous values
+ * \param[in] def the initial value of the option
+ * \param[in] is_writable should the option be read-only or not
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+void rs2_software_sensor_add_option(rs2_sensor* sensor, rs2_option option, float min, float max, float step, float def, int is_writable, rs2_error** error);
+
+/**
+* Sensors hold the parent device in scope via a shared_ptr. This function detaches that so that the software sensor doesn't keep the software device alive.
+* Note that this is dangerous as it opens the door to accessing freed memory if care isn't taken.
+* \param[in] sensor the software sensor
+* \param[out] error if non-null, recieves any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_software_sensor_detach(rs2_sensor* sensor, rs2_error** error);
+
+
+/**
+* \brief Creates RealSense firmware log message.
+* \param[in] dev Device from which the FW log will be taken using the created message
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return pointer to created empty firmware log message
+*/
+rs2_firmware_log_message* rs2_create_fw_log_message(rs2_device* dev, rs2_error** error);
+
+/**
+* \brief Gets RealSense firmware log.
+* \param[in] dev Device from which the FW log should be taken
+* \param[in] fw_log_msg Firmware log message object to be filled
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return true for success, false for failure - failure happens if no firmware log was sent by the hardware monitor
+*/
+int rs2_get_fw_log(rs2_device* dev, rs2_firmware_log_message* fw_log_msg, rs2_error** error);
+
+/**
+* \brief Gets RealSense flash log - this is a fw log that has been written in the device during the previous shutdown of the device
+* \param[in] dev Device from which the FW log should be taken
+* \param[in] fw_log_msg Firmware log message object to be filled
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return true for success, false for failure - failure happens if no firmware log was sent by the hardware monitor
+*/
+int rs2_get_flash_log(rs2_device* dev, rs2_firmware_log_message* fw_log_msg, rs2_error** error);
+
+/**
+* Delete RealSense firmware log message
+* \param[in] device Realsense firmware log message to delete
+*/
+void rs2_delete_fw_log_message(rs2_firmware_log_message* msg);
+
+/**
+* \brief Gets RealSense firmware log message data.
+* \param[in] msg firmware log message object
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return pointer to start of the firmware log message data
+*/
+const unsigned char* rs2_fw_log_message_data(rs2_firmware_log_message* msg, rs2_error** error);
+
+/**
+* \brief Gets RealSense firmware log message size.
+* \param[in] msg firmware log message object
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return size of the firmware log message data
+*/
+int rs2_fw_log_message_size(rs2_firmware_log_message* msg, rs2_error** error);
+
+
+/**
+* \brief Gets RealSense firmware log message timestamp.
+* \param[in] msg firmware log message object
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return timestamp of the firmware log message
+*/
+unsigned int rs2_fw_log_message_timestamp(rs2_firmware_log_message* msg, rs2_error** error);
+
+/**
+* \brief Gets RealSense firmware log message severity.
+* \param[in] msg firmware log message object
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return severity of the firmware log message data
+*/
+rs2_log_severity rs2_fw_log_message_severity(const rs2_firmware_log_message* msg, rs2_error** error);
+
+/**
+* \brief Initializes RealSense firmware logs parser in device.
+* \param[in] dev Device from which the FW log will be taken
+* \param[in] xml_content content of the xml file needed for parsing
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return true for success, false for failure - failure happens if opening the xml from the xml_path input fails
+*/
+int rs2_init_fw_log_parser(rs2_device* dev, const char* xml_content, rs2_error** error);
+
+
+/**
+* \brief Creates RealSense firmware log parsed message.
+* \param[in] dev Device from which the FW log will be taken using the created message
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return pointer to created empty firmware log message
+*/
+rs2_firmware_log_parsed_message* rs2_create_fw_log_parsed_message(rs2_device* dev, rs2_error** error);
+
+/**
+* \brief Deletes RealSense firmware log parsed message.
+* \param[in] msg message to be deleted
+*/
+void rs2_delete_fw_log_parsed_message(rs2_firmware_log_parsed_message* fw_log_parsed_msg);
+
+
+/**
+* \brief Gets RealSense firmware log parser
+* \param[in] dev Device from which the FW log will be taken
+* \param[in] fw_log_msg firmware log message to be parsed
+* \param[in] parsed_msg firmware log parsed message - place holder for the resulting parsed message
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return true for success, false for failure - failure happens if message could not be parsed
+*/
+int rs2_parse_firmware_log(rs2_device* dev, rs2_firmware_log_message* fw_log_msg, rs2_firmware_log_parsed_message* parsed_msg, rs2_error** error);
+
+/**
+* \brief Gets RealSense firmware log parsed message.
+* \param[in] fw_log_parsed_msg firmware log parsed message object
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return message of the firmware log parsed message
+*/
+const char* rs2_get_fw_log_parsed_message(rs2_firmware_log_parsed_message* fw_log_parsed_msg, rs2_error** error);
+
+/**
+* \brief Gets RealSense firmware log parsed message file name.
+* \param[in] fw_log_parsed_msg firmware log parsed message object
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return file name of the firmware log parsed message
+*/
+const char* rs2_get_fw_log_parsed_file_name(rs2_firmware_log_parsed_message* fw_log_parsed_msg, rs2_error** error);
+
+/**
+* \brief Gets RealSense firmware log parsed message thread name.
+* \param[in] fw_log_parsed_msg firmware log parsed message object
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return thread name of the firmware log parsed message
+*/
+const char* rs2_get_fw_log_parsed_thread_name(rs2_firmware_log_parsed_message* fw_log_parsed_msg, rs2_error** error);
+
+/**
+* \brief Gets RealSense firmware log parsed message severity.
+* \param[in] fw_log_parsed_msg firmware log parsed message object
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return severity of the firmware log parsed message
+*/
+rs2_log_severity rs2_get_fw_log_parsed_severity(rs2_firmware_log_parsed_message* fw_log_parsed_msg, rs2_error** error);
+
+/**
+* \brief Gets RealSense firmware log parsed message relevant line (in the file that is returned by rs2_get_fw_log_parsed_file_name).
+* \param[in] fw_log_parsed_msg firmware log parsed message object
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return line number of the firmware log parsed message
+*/
+unsigned int rs2_get_fw_log_parsed_line(rs2_firmware_log_parsed_message* fw_log_parsed_msg, rs2_error** error);
+
+/**
+* \brief Gets RealSense firmware log parsed message timestamp
+* \param[in] fw_log_parsed_msg firmware log parsed message object
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return timestamp of the firmware log parsed message
+*/
+unsigned int rs2_get_fw_log_parsed_timestamp(rs2_firmware_log_parsed_message* fw_log_parsed_msg, rs2_error** error);
+
+/**
+* \brief Creates RealSense terminal parser.
+* \param[in] xml_content content of the xml file needed for parsing
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return pointer to created terminal parser object
+*/
+rs2_terminal_parser* rs2_create_terminal_parser(const char* xml_content, rs2_error** error);
+
+/**
+* \brief Deletes RealSense terminal parser.
+* \param[in] terminal_parser terminal parser to be deleted
+*/
+void rs2_delete_terminal_parser(rs2_terminal_parser* terminal_parser);
+
+/**
+* \brief Parses terminal command via RealSense terminal parser
+* \param[in] terminal_parser Terminal parser object
+* \param[in] command command to be sent to the hw monitor of the device
+* \param[in] size_of_command size of command to be sent to the hw monitor of the device
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return command to hw monitor, in hex
+*/
+rs2_raw_data_buffer* rs2_terminal_parse_command(rs2_terminal_parser* terminal_parser,
+ const char* command, unsigned int size_of_command, rs2_error** error);
+
+/**
+* \brief Parses terminal response via RealSense terminal parser
+* \param[in] terminal_parser Terminal parser object
+* \param[in] command command sent to the hw monitor of the device
+* \param[in] size_of_command size of the command to sent to the hw monitor of the device
+* \param[in] response response received by the hw monitor of the device
+* \param[in] size_of_response size of the response received by the hw monitor of the device
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return answer parsed
+*/
+rs2_raw_data_buffer* rs2_terminal_parse_response(rs2_terminal_parser* terminal_parser,
+ const char* command, unsigned int size_of_command,
+ const void* response, unsigned int size_of_response, rs2_error** error);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/libs/realsense2/include/librealsense2/h/rs_option.h b/libs/realsense2/include/librealsense2/h/rs_option.h
old mode 100755
new mode 100644
index 71be14b..ad6e5a2
--- a/libs/realsense2/include/librealsense2/h/rs_option.h
+++ b/libs/realsense2/include/librealsense2/h/rs_option.h
@@ -1,5 +1,5 @@
/* License: Apache 2.0. See LICENSE file in root directory.
- Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
+Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
/** \file rs_option.h
* \brief
@@ -16,156 +16,257 @@ extern "C" {
#include "rs_types.h"
-/** \brief Defines general configuration controls.
- These can generally be mapped to camera UVC controls, and unless stated otherwise, can be set/queried at any time.
+ /** \brief Defines general configuration controls.
+ These can generally be mapped to camera UVC controls, and can be set / queried at any time unless stated otherwise.
*/
-typedef enum rs2_option
-{
- RS2_OPTION_BACKLIGHT_COMPENSATION , /**< Enable / disable color backlight compensation*/
- RS2_OPTION_BRIGHTNESS , /**< Color image brightness*/
- RS2_OPTION_CONTRAST , /**< Color image contrast*/
- RS2_OPTION_EXPOSURE , /**< Controls exposure time of color camera. Setting any value will disable auto exposure*/
- RS2_OPTION_GAIN , /**< Color image gain*/
- RS2_OPTION_GAMMA , /**< Color image gamma setting*/
- RS2_OPTION_HUE , /**< Color image hue*/
- RS2_OPTION_SATURATION , /**< Color image saturation setting*/
- RS2_OPTION_SHARPNESS , /**< Color image sharpness setting*/
- RS2_OPTION_WHITE_BALANCE , /**< Controls white balance of color image. Setting any value will disable auto white balance*/
- RS2_OPTION_ENABLE_AUTO_EXPOSURE , /**< Enable / disable color image auto-exposure*/
- RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE , /**< Enable / disable color image auto-white-balance*/
- RS2_OPTION_VISUAL_PRESET , /**< Provide access to several recommend sets of option presets for the depth camera */
- RS2_OPTION_LASER_POWER , /**< Power of the F200 / SR300 projector, with 0 meaning projector off*/
- RS2_OPTION_ACCURACY , /**< Set the number of patterns projected per frame. The higher the accuracy value the more patterns projected. Increasing the number of patterns help to achieve better accuracy. Note that this control is affecting the Depth FPS */
- RS2_OPTION_MOTION_RANGE , /**< Motion vs. Range trade-off, with lower values allowing for better motion sensitivity and higher values allowing for better depth range*/
- RS2_OPTION_FILTER_OPTION , /**< Set the filter to apply to each depth frame. Each one of the filter is optimized per the application requirements*/
- RS2_OPTION_CONFIDENCE_THRESHOLD , /**< The confidence level threshold used by the Depth algorithm pipe to set whether a pixel will get a valid range or will be marked with invalid range*/
- RS2_OPTION_EMITTER_ENABLED , /**< Laser Emitter enabled */
- RS2_OPTION_FRAMES_QUEUE_SIZE , /**< Number of frames the user is allowed to keep per stream. Trying to hold-on to more frames will cause frame-drops.*/
- RS2_OPTION_TOTAL_FRAME_DROPS , /**< Total number of detected frame drops from all streams */
- RS2_OPTION_AUTO_EXPOSURE_MODE , /**< Auto-Exposure modes: Static, Anti-Flicker and Hybrid */
- RS2_OPTION_POWER_LINE_FREQUENCY , /**< Power Line Frequency control for anti-flickering Off/50Hz/60Hz/Auto */
- RS2_OPTION_ASIC_TEMPERATURE , /**< Current Asic Temperature */
- RS2_OPTION_ERROR_POLLING_ENABLED , /**< disable error handling */
- RS2_OPTION_PROJECTOR_TEMPERATURE , /**< Current Projector Temperature */
- RS2_OPTION_OUTPUT_TRIGGER_ENABLED , /**< Enable / disable trigger to be outputed from the camera to any external device on every depth frame */
- RS2_OPTION_MOTION_MODULE_TEMPERATURE , /**< Current Motion-Module Temperature */
- RS2_OPTION_DEPTH_UNITS , /**< Number of meters represented by a single depth unit */
- RS2_OPTION_ENABLE_MOTION_CORRECTION , /**< Enable/Disable automatic correction of the motion data */
- RS2_OPTION_AUTO_EXPOSURE_PRIORITY , /**< Allows sensor to dynamically ajust the frame rate depending on lighting conditions */
- RS2_OPTION_COLOR_SCHEME , /**< Color scheme for data visualization */
- RS2_OPTION_HISTOGRAM_EQUALIZATION_ENABLED , /**< Perform histogram equalization post-processing on the depth data */
- RS2_OPTION_MIN_DISTANCE , /**< Minimal distance to the target */
- RS2_OPTION_MAX_DISTANCE , /**< Maximum distance to the target */
- RS2_OPTION_TEXTURE_SOURCE , /**< Texture mapping stream unique ID */
- RS2_OPTION_FILTER_MAGNITUDE , /**< The 2D-filter effect. The specific interpretation is given within the context of the filter */
- RS2_OPTION_FILTER_SMOOTH_ALPHA , /**< 2D-filter parameter controls the weight/radius for smoothing.*/
- RS2_OPTION_FILTER_SMOOTH_DELTA , /**< 2D-filter range/validity threshold*/
- RS2_OPTION_HOLES_FILL , /**< Enhance depth data post-processing with holes filling where appropriate*/
- RS2_OPTION_STEREO_BASELINE , /**< The distance in mm between the first and the second imagers in stereo-based depth cameras*/
- RS2_OPTION_AUTO_EXPOSURE_CONVERGE_STEP , /**< Allows dynamically ajust the converge step value of the target exposure in Auto-Exposure algorithm*/
- RS2_OPTION_INTER_CAM_SYNC_MODE , /**< Impose Inter-camera HW synchronization mode. Applicable for D400/Rolling Shutter SKUs */
- RS2_OPTION_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
-} rs2_option;
-const char* rs2_option_to_string(rs2_option option);
-
-/** \brief For SR300 devices: provides optimized settings (presets) for specific types of usage. */
-typedef enum rs2_sr300_visual_preset
-{
- RS2_SR300_VISUAL_PRESET_SHORT_RANGE , /**< Preset for short range */
- RS2_SR300_VISUAL_PRESET_LONG_RANGE , /**< Preset for long range */
- RS2_SR300_VISUAL_PRESET_BACKGROUND_SEGMENTATION , /**< Preset for background segmentation */
- RS2_SR300_VISUAL_PRESET_GESTURE_RECOGNITION , /**< Preset for gesture recognition */
- RS2_SR300_VISUAL_PRESET_OBJECT_SCANNING , /**< Preset for object scanning */
- RS2_SR300_VISUAL_PRESET_FACE_ANALYTICS , /**< Preset for face analytics */
- RS2_SR300_VISUAL_PRESET_FACE_LOGIN , /**< Preset for face login */
- RS2_SR300_VISUAL_PRESET_GR_CURSOR , /**< Preset for GR cursor */
- RS2_SR300_VISUAL_PRESET_DEFAULT , /**< Camera default settings */
- RS2_SR300_VISUAL_PRESET_MID_RANGE , /**< Preset for mid-range */
- RS2_SR300_VISUAL_PRESET_IR_ONLY , /**< Preset for IR only */
- RS2_SR300_VISUAL_PRESET_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
-} rs2_sr300_visual_preset;
-const char* rs2_sr300_visual_preset_to_string(rs2_sr300_visual_preset preset);
-
-/** \brief For RS400 devices: provides optimized settings (presets) for specific types of usage. */
-typedef enum rs2_rs400_visual_preset
-{
- RS2_RS400_VISUAL_PRESET_CUSTOM,
- RS2_RS400_VISUAL_PRESET_DEFAULT,
- RS2_RS400_VISUAL_PRESET_HAND,
- RS2_RS400_VISUAL_PRESET_HIGH_ACCURACY,
- RS2_RS400_VISUAL_PRESET_HIGH_DENSITY,
- RS2_RS400_VISUAL_PRESET_MEDIUM_DENSITY,
- RS2_RS400_VISUAL_PRESET_REMOVE_IR_PATTERN,
- RS2_RS400_VISUAL_PRESET_COUNT
-} rs2_rs400_visual_preset;
-const char* rs2_rs400_visual_preset_to_string(rs2_rs400_visual_preset preset);
-
-/**
-* check if an option is read-only
-* \param[in] sensor the RealSense sensor
-* \param[in] option option id to be checked
-* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
-* \return true if option is read-only
-*/
-int rs2_is_option_read_only(const rs2_options* options, rs2_option option, rs2_error** error);
-
-/**
-* read option value from the sensor
-* \param[in] sensor the RealSense sensor
-* \param[in] option option id to be queried
-* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
-* \return value of the option
-*/
-float rs2_get_option(const rs2_options* options, rs2_option option, rs2_error** error);
-
-/**
-* write new value to sensor option
-* \param[in] sensor the RealSense sensor
-* \param[in] option option id to be queried
-* \param[in] value new value for the option
-* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
-*/
-void rs2_set_option(const rs2_options* options, rs2_option option, float value, rs2_error** error);
-
-/**
-* check if particular option is supported by a subdevice
-* \param[in] sensor the RealSense sensor
-* \param[in] option option id to be checked
-* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
-* \return true if option is supported
-*/
-int rs2_supports_option(const rs2_options* options, rs2_option option, rs2_error** error);
-
-/**
-* retrieve the available range of values of a supported option
-* \param[in] sensor the RealSense device
-* \param[in] option the option whose range should be queried
-* \param[out] min the minimum value which will be accepted for this option
-* \param[out] max the maximum value which will be accepted for this option
-* \param[out] step the granularity of options which accept discrete values, or zero if the option accepts continuous values
-* \param[out] def the default value of the option
-* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
-*/
-void rs2_get_option_range(const rs2_options* sensor, rs2_option option, float* min, float* max, float* step, float* def, rs2_error** error);
-
-/**
-* get option description
-* \param[in] sensor the RealSense sensor
-* \param[in] option option id to be checked
-* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
-* \return human-readable option description
-*/
-const char* rs2_get_option_description(const rs2_options* options, rs2_option option, rs2_error ** error);
-
-/**
-* get option value description (in case specific option value hold special meaning)
-* \param[in] device the RealSense device
-* \param[in] option option id to be checked
-* \param[in] value value of the option
-* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
-* \return human-readable description of a specific value of an option or null if no special meaning
-*/
-const char* rs2_get_option_value_description(const rs2_options* options, rs2_option option, float value, rs2_error ** error);
+ typedef enum rs2_option
+ {
+ RS2_OPTION_BACKLIGHT_COMPENSATION, /**< Enable / disable color backlight compensation*/
+ RS2_OPTION_BRIGHTNESS, /**< Color image brightness*/
+ RS2_OPTION_CONTRAST, /**< Color image contrast*/
+ RS2_OPTION_EXPOSURE, /**< Controls exposure time of color camera. Setting any value will disable auto exposure*/
+ RS2_OPTION_GAIN, /**< Color image gain*/
+ RS2_OPTION_GAMMA, /**< Color image gamma setting*/
+ RS2_OPTION_HUE, /**< Color image hue*/
+ RS2_OPTION_SATURATION, /**< Color image saturation setting*/
+ RS2_OPTION_SHARPNESS, /**< Color image sharpness setting*/
+ RS2_OPTION_WHITE_BALANCE, /**< Controls white balance of color image. Setting any value will disable auto white balance*/
+ RS2_OPTION_ENABLE_AUTO_EXPOSURE, /**< Enable / disable color image auto-exposure*/
+ RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE, /**< Enable / disable color image auto-white-balance*/
+ RS2_OPTION_VISUAL_PRESET, /**< Provide access to several recommend sets of option presets for the depth camera */
+ RS2_OPTION_LASER_POWER, /**< Power of the laser emitter, with 0 meaning projector off*/
+ RS2_OPTION_ACCURACY, /**< Set the number of patterns projected per frame. The higher the accuracy value the more patterns projected. Increasing the number of patterns help to achieve better accuracy. Note that this control is affecting the Depth FPS */
+ RS2_OPTION_MOTION_RANGE, /**< Motion vs. Range trade-off, with lower values allowing for better motion sensitivity and higher values allowing for better depth range*/
+ RS2_OPTION_FILTER_OPTION, /**< Set the filter to apply to each depth frame. Each one of the filter is optimized per the application requirements*/
+ RS2_OPTION_CONFIDENCE_THRESHOLD, /**< The confidence level threshold used by the Depth algorithm pipe to set whether a pixel will get a valid range or will be marked with invalid range*/
+ RS2_OPTION_EMITTER_ENABLED, /**< Emitter select: 0 – disable all emitters. 1 – enable laser. 2 – enable auto laser. 3 – enable LED.*/
+ RS2_OPTION_FRAMES_QUEUE_SIZE, /**< Number of frames the user is allowed to keep per stream. Trying to hold-on to more frames will cause frame-drops.*/
+ RS2_OPTION_TOTAL_FRAME_DROPS, /**< Total number of detected frame drops from all streams */
+ RS2_OPTION_AUTO_EXPOSURE_MODE, /**< Auto-Exposure modes: Static, Anti-Flicker and Hybrid */
+ RS2_OPTION_POWER_LINE_FREQUENCY, /**< Power Line Frequency control for anti-flickering Off/50Hz/60Hz/Auto */
+ RS2_OPTION_ASIC_TEMPERATURE, /**< Current Asic Temperature */
+ RS2_OPTION_ERROR_POLLING_ENABLED, /**< disable error handling */
+ RS2_OPTION_PROJECTOR_TEMPERATURE, /**< Current Projector Temperature */
+ RS2_OPTION_OUTPUT_TRIGGER_ENABLED, /**< Enable / disable trigger to be outputed from the camera to any external device on every depth frame */
+ RS2_OPTION_MOTION_MODULE_TEMPERATURE, /**< Current Motion-Module Temperature */
+ RS2_OPTION_DEPTH_UNITS, /**< Number of meters represented by a single depth unit */
+ RS2_OPTION_ENABLE_MOTION_CORRECTION, /**< Enable/Disable automatic correction of the motion data */
+ RS2_OPTION_AUTO_EXPOSURE_PRIORITY, /**< Allows sensor to dynamically ajust the frame rate depending on lighting conditions */
+ RS2_OPTION_COLOR_SCHEME, /**< Color scheme for data visualization */
+ RS2_OPTION_HISTOGRAM_EQUALIZATION_ENABLED, /**< Perform histogram equalization post-processing on the depth data */
+ RS2_OPTION_MIN_DISTANCE, /**< Minimal distance to the target */
+ RS2_OPTION_MAX_DISTANCE, /**< Maximum distance to the target */
+ RS2_OPTION_TEXTURE_SOURCE, /**< Texture mapping stream unique ID */
+ RS2_OPTION_FILTER_MAGNITUDE, /**< The 2D-filter effect. The specific interpretation is given within the context of the filter */
+ RS2_OPTION_FILTER_SMOOTH_ALPHA, /**< 2D-filter parameter controls the weight/radius for smoothing.*/
+ RS2_OPTION_FILTER_SMOOTH_DELTA, /**< 2D-filter range/validity threshold*/
+ RS2_OPTION_HOLES_FILL, /**< Enhance depth data post-processing with holes filling where appropriate*/
+ RS2_OPTION_STEREO_BASELINE, /**< The distance in mm between the first and the second imagers in stereo-based depth cameras*/
+ RS2_OPTION_AUTO_EXPOSURE_CONVERGE_STEP, /**< Allows dynamically ajust the converge step value of the target exposure in Auto-Exposure algorithm*/
+ RS2_OPTION_INTER_CAM_SYNC_MODE, /**< Impose Inter-camera HW synchronization mode. Applicable for D400/L500/Rolling Shutter SKUs */
+ RS2_OPTION_STREAM_FILTER, /**< Select a stream to process */
+ RS2_OPTION_STREAM_FORMAT_FILTER, /**< Select a stream format to process */
+ RS2_OPTION_STREAM_INDEX_FILTER, /**< Select a stream index to process */
+ RS2_OPTION_EMITTER_ON_OFF, /**< When supported, this option make the camera to switch the emitter state every frame. 0 for disabled, 1 for enabled */
+ RS2_OPTION_ZERO_ORDER_POINT_X, /**< Zero order point x*/
+ RS2_OPTION_ZERO_ORDER_POINT_Y, /**< Zero order point y*/
+ RS2_OPTION_LLD_TEMPERATURE, /**< LLD temperature*/
+ RS2_OPTION_MC_TEMPERATURE, /**< MC temperature*/
+ RS2_OPTION_MA_TEMPERATURE, /**< MA temperature*/
+ RS2_OPTION_HARDWARE_PRESET, /**< Hardware stream configuration */
+ RS2_OPTION_GLOBAL_TIME_ENABLED, /**< disable global time */
+ RS2_OPTION_APD_TEMPERATURE, /**< APD temperature*/
+ RS2_OPTION_ENABLE_MAPPING, /**< Enable an internal map */
+ RS2_OPTION_ENABLE_RELOCALIZATION, /**< Enable appearance based relocalization */
+ RS2_OPTION_ENABLE_POSE_JUMPING, /**< Enable position jumping */
+ RS2_OPTION_ENABLE_DYNAMIC_CALIBRATION, /**< Enable dynamic calibration */
+ RS2_OPTION_DEPTH_OFFSET, /**< Offset from sensor to depth origin in millimetrers*/
+ RS2_OPTION_LED_POWER, /**< Power of the LED (light emitting diode), with 0 meaning LED off*/
+ RS2_OPTION_ZERO_ORDER_ENABLED, /**< Toggle Zero-Order mode */
+ RS2_OPTION_ENABLE_MAP_PRESERVATION, /**< Preserve previous map when starting */
+ RS2_OPTION_FREEFALL_DETECTION_ENABLED, /**< Enable/disable sensor shutdown when a free-fall is detected (on by default) */
+ RS2_OPTION_AVALANCHE_PHOTO_DIODE, /**< Changes the exposure time of Avalanche Photo Diode in the receiver */
+ RS2_OPTION_POST_PROCESSING_SHARPENING, /**< Changes the amount of sharpening in the post-processed image */
+ RS2_OPTION_PRE_PROCESSING_SHARPENING, /**< Changes the amount of sharpening in the pre-processed image */
+ RS2_OPTION_NOISE_FILTERING, /**< Control edges and background noise */
+ RS2_OPTION_INVALIDATION_BYPASS, /**< Enable\disable pixel invalidation */
+ RS2_OPTION_AMBIENT_LIGHT, /**< Change the depth ambient light see rs2_ambient_light for values */
+ RS2_OPTION_SENSOR_MODE, /**< The resolution mode: see rs2_sensor_mode for values */
+ RS2_OPTION_EMITTER_ALWAYS_ON, /**< Enable Laser On constantly (GS SKU Only) */
+ RS2_OPTION_THERMAL_COMPENSATION, /**< Depth Thermal Compensation for selected D400 SKUs */
+ RS2_OPTION_TRIGGER_CAMERA_ACCURACY_HEALTH, /**< Enable depth & color frame sync with periodic calibration for proper alignment */
+ RS2_OPTION_RESET_CAMERA_ACCURACY_HEALTH,
+ RS2_OPTION_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
+ } rs2_option;
+
+ // This function is being deprecated. For existing options it will return option name, but for future API additions the user should call rs2_get_option_name instead.
+ const char* rs2_option_to_string(rs2_option option);
+
+ /** \brief For SR300 devices: provides optimized settings (presets) for specific types of usage. */
+ typedef enum rs2_sr300_visual_preset
+ {
+ RS2_SR300_VISUAL_PRESET_SHORT_RANGE, /**< Preset for short range */
+ RS2_SR300_VISUAL_PRESET_LONG_RANGE, /**< Preset for long range */
+ RS2_SR300_VISUAL_PRESET_BACKGROUND_SEGMENTATION, /**< Preset for background segmentation */
+ RS2_SR300_VISUAL_PRESET_GESTURE_RECOGNITION, /**< Preset for gesture recognition */
+ RS2_SR300_VISUAL_PRESET_OBJECT_SCANNING, /**< Preset for object scanning */
+ RS2_SR300_VISUAL_PRESET_FACE_ANALYTICS, /**< Preset for face analytics */
+ RS2_SR300_VISUAL_PRESET_FACE_LOGIN, /**< Preset for face login */
+ RS2_SR300_VISUAL_PRESET_GR_CURSOR, /**< Preset for GR cursor */
+ RS2_SR300_VISUAL_PRESET_DEFAULT, /**< Camera default settings */
+ RS2_SR300_VISUAL_PRESET_MID_RANGE, /**< Preset for mid-range */
+ RS2_SR300_VISUAL_PRESET_IR_ONLY, /**< Preset for IR only */
+ RS2_SR300_VISUAL_PRESET_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
+ } rs2_sr300_visual_preset;
+ const char* rs2_sr300_visual_preset_to_string(rs2_sr300_visual_preset preset);
+
+ /** \brief For RS400 devices: provides optimized settings (presets) for specific types of usage. */
+ typedef enum rs2_rs400_visual_preset
+ {
+ RS2_RS400_VISUAL_PRESET_CUSTOM,
+ RS2_RS400_VISUAL_PRESET_DEFAULT,
+ RS2_RS400_VISUAL_PRESET_HAND,
+ RS2_RS400_VISUAL_PRESET_HIGH_ACCURACY,
+ RS2_RS400_VISUAL_PRESET_HIGH_DENSITY,
+ RS2_RS400_VISUAL_PRESET_MEDIUM_DENSITY,
+ RS2_RS400_VISUAL_PRESET_REMOVE_IR_PATTERN,
+ RS2_RS400_VISUAL_PRESET_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
+ } rs2_rs400_visual_preset;
+ const char* rs2_rs400_visual_preset_to_string(rs2_rs400_visual_preset preset);
+
+ /** \brief For L500 devices: provides optimized settings (presets) for specific types of usage. */
+ typedef enum rs2_l500_visual_preset
+ {
+ RS2_L500_VISUAL_PRESET_CUSTOM,
+ RS2_L500_VISUAL_PRESET_DEFAULT,
+ RS2_L500_VISUAL_PRESET_NO_AMBIENT,
+ RS2_L500_VISUAL_PRESET_LOW_AMBIENT,
+ RS2_L500_VISUAL_PRESET_MAX_RANGE,
+ RS2_L500_VISUAL_PRESET_SHORT_RANGE,
+ RS2_L500_VISUAL_PRESET_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
+ } rs2_l500_visual_preset;
+ const char* rs2_l500_visual_preset_to_string(rs2_l500_visual_preset preset);
+
+ /** \brief For setting the camera_mode option */
+ typedef enum rs2_sensor_mode
+ {
+ RS2_SENSOR_MODE_VGA,
+ RS2_SENSOR_MODE_XGA,
+ RS2_SENSOR_MODE_QVGA,
+ RS2_SENSOR_MODE_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
+ } rs2_sensor_mode;
+ const char* rs2_sensor_mode_to_string(rs2_sensor_mode preset);
+
+ /** \brief ambient light for RS2_OPTION_AMBIENT_LIGHT option. */
+ typedef enum rs2_ambient_light
+ {
+ RS2_AMBIENT_LIGHT_NO_AMBIENT = 1,
+ RS2_AMBIENT_LIGHT_LOW_AMBIENT = 2,
+ } rs2_ambient_light;
+ const char* rs2_ambient_light_to_string(rs2_ambient_light preset);
+
+ /**
+ * check if an option is read-only
+ * \param[in] options the options container
+ * \param[in] option option id to be checked
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return true if option is read-only
+ */
+ int rs2_is_option_read_only(const rs2_options* options, rs2_option option, rs2_error** error);
+
+ /**
+ * read option value from the sensor
+ * \param[in] options the options container
+ * \param[in] option option id to be queried
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return value of the option
+ */
+ float rs2_get_option(const rs2_options* options, rs2_option option, rs2_error** error);
+
+ /**
+ * write new value to sensor option
+ * \param[in] options the options container
+ * \param[in] option option id to be queried
+ * \param[in] value new value for the option
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ void rs2_set_option(const rs2_options* options, rs2_option option, float value, rs2_error** error);
+
+ /**
+ * get the list of supported options of options container
+ * \param[in] options the options container
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ rs2_options_list* rs2_get_options_list(const rs2_options* options, rs2_error** error);
+
+ /**
+ * get the size of options list
+ * \param[in] options the option list
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ int rs2_get_options_list_size(const rs2_options_list* options, rs2_error** error);
+
+ /**
+ * get option name
+ * \param[in] options the options container
+ * \param[in] option option id to be checked
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return human-readable option name
+ */
+ const char* rs2_get_option_name(const rs2_options* options, rs2_option option, rs2_error** error);
+
+ /**
+ * get the specific option from options list
+ * \param[in] i the index of the option
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ rs2_option rs2_get_option_from_list(const rs2_options_list* options, int i, rs2_error** error);
+
+ /**
+ * Deletes options list
+ * \param[in] list list to delete
+ */
+ void rs2_delete_options_list(rs2_options_list* list);
+
+ /**
+ * check if particular option is supported by a subdevice
+ * \param[in] options the options container
+ * \param[in] option option id to be checked
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return true if option is supported
+ */
+ int rs2_supports_option(const rs2_options* options, rs2_option option, rs2_error** error);
+
+ /**
+ * retrieve the available range of values of a supported option
+ * \param[in] sensor the RealSense device
+ * \param[in] option the option whose range should be queried
+ * \param[out] min the minimum value which will be accepted for this option
+ * \param[out] max the maximum value which will be accepted for this option
+ * \param[out] step the granularity of options which accept discrete values, or zero if the option accepts continuous values
+ * \param[out] def the default value of the option
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+ void rs2_get_option_range(const rs2_options* sensor, rs2_option option, float* min, float* max, float* step, float* def, rs2_error** error);
+
+ /**
+ * get option description
+ * \param[in] options the options container
+ * \param[in] option option id to be checked
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return human-readable option description
+ */
+ const char* rs2_get_option_description(const rs2_options* options, rs2_option option, rs2_error ** error);
+
+ /**
+ * get option value description (in case specific option value hold special meaning)
+ * \param[in] options the options container
+ * \param[in] option option id to be checked
+ * \param[in] value value of the option
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return human-readable description of a specific value of an option or null if no special meaning
+ */
+ const char* rs2_get_option_value_description(const rs2_options* options, rs2_option option, float value, rs2_error ** error);
#ifdef __cplusplus
}
diff --git a/libs/realsense2/include/librealsense2/h/rs_pipeline.h b/libs/realsense2/include/librealsense2/h/rs_pipeline.h
old mode 100755
new mode 100644
index f617236..1018c77
--- a/libs/realsense2/include/librealsense2/h/rs_pipeline.h
+++ b/libs/realsense2/include/librealsense2/h/rs_pipeline.h
@@ -16,6 +16,7 @@ extern "C" {
#include "rs_types.h"
#include "rs_sensor.h"
+#include "rs_config.h"
/**
* Create a pipeline instance
@@ -111,7 +112,6 @@ extern "C" {
*/
rs2_pipeline_profile* rs2_pipeline_start(rs2_pipeline* pipe, rs2_error ** error);
-
/**
* Start the pipeline streaming according to the configuraion.
* The pipeline streaming loop captures samples from the device, and delivers them to the attached computer vision modules
@@ -132,6 +132,72 @@ extern "C" {
*/
rs2_pipeline_profile* rs2_pipeline_start_with_config(rs2_pipeline* pipe, rs2_config* config, rs2_error ** error);
+ /**
+ * Start the pipeline streaming with its default configuration.
+ * The pipeline captures samples from the device, and delivers them to the through the provided frame callback.
+ * Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised.
+ * When starting the pipeline with a callback both \c wait_for_frames() or \c poll_for_frames() will throw exception.
+ *
+ * \param[in] pipe A pointer to an instance of the pipeline
+ * \param[in] on_frame function pointer to register as per-frame callback
+ * \param[in] user auxiliary data the user wishes to receive together with every frame callback
+ * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return The actual pipeline device and streams profile, which was successfully configured to the streaming device.
+ */
+ rs2_pipeline_profile* rs2_pipeline_start_with_callback(rs2_pipeline* pipe, rs2_frame_callback_ptr on_frame, void* user, rs2_error ** error);
+
+ /**
+ * Start the pipeline streaming with its default configuration.
+ * The pipeline captures samples from the device, and delivers them to the through the provided frame callback.
+ * Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised.
+ * When starting the pipeline with a callback both \c wait_for_frames() or \c poll_for_frames() will throw exception.
+ *
+ * \param[in] pipe A pointer to an instance of the pipeline
+ * \param[in] callback callback object created from c++ application. ownership over the callback object is moved into the relevant streaming lock
+ * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return The actual pipeline device and streams profile, which was successfully configured to the streaming device.
+ */
+ rs2_pipeline_profile* rs2_pipeline_start_with_callback_cpp(rs2_pipeline* pipe, rs2_frame_callback* callback, rs2_error ** error);
+
+ /**
+ * Start the pipeline streaming according to the configuraion.
+ * The pipeline captures samples from the device, and delivers them to the through the provided frame callback.
+ * Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised.
+ * When starting the pipeline with a callback both \c wait_for_frames() or \c poll_for_frames() will throw exception.
+ * The pipeline selects and activates the device upon start, according to configuration or a default configuration.
+ * When the rs2::config is provided to the method, the pipeline tries to activate the config \c resolve() result. If the application
+ * requests are conflicting with pipeline computer vision modules or no matching device is available on the platform, the method fails.
+ * Available configurations and devices may change between config \c resolve() call and pipeline start, in case devices are connected
+ * or disconnected, or another application acquires ownership of a device.
+ *
+ * \param[in] pipe A pointer to an instance of the pipeline
+ * \param[in] config A rs2::config with requested filters on the pipeline configuration. By default no filters are applied.
+ * \param[in] on_frame function pointer to register as per-frame callback
+ * \param[in] user auxiliary data the user wishes to receive together with every frame callback
+ * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return The actual pipeline device and streams profile, which was successfully configured to the streaming device.
+ */
+ rs2_pipeline_profile* rs2_pipeline_start_with_config_and_callback(rs2_pipeline* pipe, rs2_config* config, rs2_frame_callback_ptr on_frame, void* user, rs2_error ** error);
+
+ /**
+ * Start the pipeline streaming according to the configuraion.
+ * The pipeline captures samples from the device, and delivers them to the through the provided frame callback.
+ * Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised.
+ * When starting the pipeline with a callback both \c wait_for_frames() or \c poll_for_frames() will throw exception.
+ * The pipeline selects and activates the device upon start, according to configuration or a default configuration.
+ * When the rs2::config is provided to the method, the pipeline tries to activate the config \c resolve() result. If the application
+ * requests are conflicting with pipeline computer vision modules or no matching device is available on the platform, the method fails.
+ * Available configurations and devices may change between config \c resolve() call and pipeline start, in case devices are connected
+ * or disconnected, or another application acquires ownership of a device.
+ *
+ * \param[in] pipe A pointer to an instance of the pipeline
+ * \param[in] config A rs2::config with requested filters on the pipeline configuration. By default no filters are applied.
+ * \param[in] callback callback object created from c++ application. ownership over the callback object is moved into the relevant streaming lock
+ * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return The actual pipeline device and streams profile, which was successfully configured to the streaming device.
+ */
+ rs2_pipeline_profile* rs2_pipeline_start_with_config_and_callback_cpp(rs2_pipeline* pipe, rs2_config* config, rs2_frame_callback* callback, rs2_error ** error);
+
/**
* Return the active device and streams profiles, used by the pipeline.
* The pipeline streams profiles are selected during \c start(). The method returns a valid result only when the pipeline is active -
@@ -175,181 +241,6 @@ extern "C" {
*/
void rs2_delete_pipeline_profile(rs2_pipeline_profile* profile);
- /**
- * Create a config instance
- * The config allows pipeline users to request filters for the pipeline streams and device selection and configuration.
- * This is an optional step in pipeline creation, as the pipeline resolves its streaming device internally.
- * Config provides its users a way to set the filters and test if there is no conflict with the pipeline requirements
- * from the device. It also allows the user to find a matching device for the config filters and the pipeline, in order to
- * select a device explicitly, and modify its controls before streaming starts.
- *
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- * \return rs2_config* A pointer to a new config instance
- */
- rs2_config* rs2_create_config(rs2_error** error);
-
- /**
- * Deletes an instance of a config
- *
- * \param[in] config A pointer to an instance of a config
- */
- void rs2_delete_config(rs2_config* config);
-
- /**
- * Enable a device stream explicitly, with selected stream parameters.
- * The method allows the application to request a stream with specific configuration. If no stream is explicitly enabled, the pipeline
- * configures the device and its streams according to the attached computer vision modules and processing blocks requirements, or
- * default configuration for the first available device.
- * The application can configure any of the input stream parameters according to its requirement, or set to 0 for don't care value.
- * The config accumulates the application calls for enable configuration methods, until the configuration is applied. Multiple enable
- * stream calls for the same stream with conflicting parameters override each other, and the last call is maintained.
- * Upon calling \c resolve(), the config checks for conflicts between the application configuration requests and the attached computer
- * vision modules and processing blocks requirements, and fails if conflicts are found. Before \c resolve() is called, no conflict
- * check is done.
- *
- * \param[in] config A pointer to an instance of a config
- * \param[in] stream Stream type to be enabled
- * \param[in] index Stream index, used for multiple streams of the same type. -1 indicates any.
- * \param[in] width Stream image width - for images streams. 0 indicates any.
- * \param[in] height Stream image height - for images streams. 0 indicates any.
- * \param[in] format Stream data format - pixel format for images streams, of data type for other streams. RS2_FORMAT_ANY indicates any.
- * \param[in] framerate Stream frames per second. 0 indicates any.
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- */
- void rs2_config_enable_stream(rs2_config* config,
- rs2_stream stream,
- int index,
- int width,
- int height,
- rs2_format format,
- int framerate,
- rs2_error** error);
-
- /**
- * Enable all device streams explicitly.
- * The conditions and behavior of this method are similar to those of \c enable_stream().
- * This filter enables all raw streams of the selected device. The device is either selected explicitly by the application,
- * or by the pipeline requirements or default. The list of streams is device dependent.
- *
- * \param[in] config A pointer to an instance of a config
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- */
- void rs2_config_enable_all_stream(rs2_config* config, rs2_error ** error);
-
- /**
- * Select a specific device explicitly by its serial number, to be used by the pipeline.
- * The conditions and behavior of this method are similar to those of \c enable_stream().
- * This method is required if the application needs to set device or sensor settings prior to pipeline streaming, to enforce
- * the pipeline to use the configured device.
- *
- * \param[in] config A pointer to an instance of a config
- * \param[in] serial device serial number, as returned by RS2_CAMERA_INFO_SERIAL_NUMBER
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- */
- void rs2_config_enable_device(rs2_config* config, const char* serial, rs2_error ** error);
-
- /**
- * Select a recorded device from a file, to be used by the pipeline through playback.
- * The device available streams are as recorded to the file, and \c resolve() considers only this device and configuration
- * as available.
- * This request cannot be used if enable_record_to_file() is called for the current config, and vise versa
- * By default, playback is repeated once the file ends. To control this, see 'rs2_config_enable_device_from_file_repeat_option'.
- *
- * \param[in] config A pointer to an instance of a config
- * \param[in] file The playback file of the device
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- */
- void rs2_config_enable_device_from_file(rs2_config* config, const char* file, rs2_error ** error);
-
- /**
- * Select a recorded device from a file, to be used by the pipeline through playback.
- * The device available streams are as recorded to the file, and \c resolve() considers only this device and configuration
- * as available.
- * This request cannot be used if enable_record_to_file() is called for the current config, and vise versa
- *
- * \param[in] config A pointer to an instance of a config
- * \param[in] file The playback file of the device
- * \param[in] repeat_playback if true, when file ends the playback starts again, in an infinite loop;
- if false, when file ends playback does not start again, and should by stopped manually by the user.
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- */
- void rs2_config_enable_device_from_file_repeat_option(rs2_config* config, const char* file, int repeat_playback, rs2_error ** error);
-
- /**
- * Requires that the resolved device would be recorded to file
- * This request cannot be used if enable_device_from_file() is called for the current config, and vise versa
- *
- * \param[in] config A pointer to an instance of a config
- * \param[in] file The desired file for the output record
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- */
- void rs2_config_enable_record_to_file(rs2_config* config, const char* file, rs2_error ** error);
-
-
- /**
- * Disable a device stream explicitly, to remove any requests on this stream type.
- * The stream can still be enabled due to pipeline computer vision module request. This call removes any filter on the
- * stream configuration.
- *
- * \param[in] config A pointer to an instance of a config
- * \param[in] stream Stream type, for which the filters are cleared
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- */
- void rs2_config_disable_stream(rs2_config* config, rs2_stream stream, rs2_error ** error);
-
- /**
- * Disable a device stream explicitly, to remove any requests on this stream profile.
- * The stream can still be enabled due to pipeline computer vision module request. This call removes any filter on the
- * stream configuration.
- *
- * \param[in] config A pointer to an instance of a config
- * \param[in] stream Stream type, for which the filters are cleared
- * \param[in] index Stream index, for which the filters are cleared
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- */
- void rs2_config_disable_indexed_stream(rs2_config* config, rs2_stream stream, int index, rs2_error ** error);
-
- /**
- * Disable all device stream explicitly, to remove any requests on the streams profiles.
- * The streams can still be enabled due to pipeline computer vision module request. This call removes any filter on the
- * streams configuration.
- *
- * \param[in] config A pointer to an instance of a config
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- */
- void rs2_config_disable_all_streams(rs2_config* config, rs2_error ** error);
-
- /**
- * Resolve the configuration filters, to find a matching device and streams profiles.
- * The method resolves the user configuration filters for the device and streams, and combines them with the requirements of
- * the computer vision modules and processing blocks attached to the pipeline. If there are no conflicts of requests, it looks
- * for an available device, which can satisfy all requests, and selects the first matching streams configuration. In the absence
- * of any request, the rs2::config selects the first available device and the first color and depth streams configuration.
- * The pipeline profile selection during \c start() follows the same method. Thus, the selected profile is the same, if no
- * change occurs to the available devices occurs.
- * Resolving the pipeline configuration provides the application access to the pipeline selected device for advanced control.
- * The returned configuration is not applied to the device, so the application doesn't own the device sensors. However, the
- * application can call \c enable_device(), to enforce the device returned by this method is selected by pipeline \c start(),
- * and configure the device and sensors options or extensions before streaming starts.
- *
- * \param[in] config A pointer to an instance of a config
- * \param[in] pipe The pipeline for which the selected filters are applied
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- * \return A matching device and streams profile, which satisfies the filters and pipeline requests.
- */
- rs2_pipeline_profile* rs2_config_resolve(rs2_config* config, rs2_pipeline* pipe, rs2_error ** error);
-
- /**
- * Check if the config can resolve the configuration filters, to find a matching device and streams profiles.
- * The resolution conditions are as described in \c resolve().
- *
- * \param[in] config A pointer to an instance of a config
- * \param[in] pipe The pipeline for which the selected filters are applied
- * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
- * \return True if a valid profile selection exists, false if no selection can be found under the config filters and the available devices.
- */
- int rs2_config_can_resolve(rs2_config* config, rs2_pipeline* pipe, rs2_error ** error);
-
#ifdef __cplusplus
}
#endif
diff --git a/libs/realsense2/include/librealsense2/h/rs_processing.h b/libs/realsense2/include/librealsense2/h/rs_processing.h
old mode 100755
new mode 100644
index 7836470..240b5c5
--- a/libs/realsense2/include/librealsense2/h/rs_processing.h
+++ b/libs/realsense2/include/librealsense2/h/rs_processing.h
@@ -16,6 +16,7 @@ extern "C" {
#include "rs_types.h"
#include "rs_sensor.h"
+#include "rs_option.h"
/**
* Creates Depth-Colorizer processing block that can be used to quickly visualize the depth data
@@ -41,6 +42,32 @@ rs2_processing_block* rs2_create_sync_processing_block(rs2_error** error);
*/
rs2_processing_block* rs2_create_pointcloud(rs2_error** error);
+/**
+* Creates YUY decoder processing block. This block accepts raw YUY frames and outputs frames of other formats.
+* YUY is a common video format used by a variety of web-cams. It benefits from packing pixels into 2 bytes per pixel
+* without signficant quality drop. YUY representation can be converted back to more usable RGB form,
+* but this requires somewhat costly conversion.
+* The SDK will automatically try to use SSE2 and AVX instructions and CUDA where available to get
+* best performance. Other implementations (using GLSL, OpenCL, Neon and NCS) should follow.
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+rs2_processing_block* rs2_create_yuy_decoder(rs2_error** error);
+
+/**
+* Creates depth thresholding processing block
+* By controlling min and max options on the block, one could filter out depth values
+* that are either too large or too small, as a software post-processing step
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+rs2_processing_block* rs2_create_threshold(rs2_error** error);
+
+/**
+* Creates depth units transformation processing block
+* All of the pixels are transformed from depth units into meters.
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+rs2_processing_block* rs2_create_units_transform(rs2_error** error);
+
/**
* This method creates new custom processing block. This lets the users pass frames between module boundaries for processing
* This is an infrastructure function aimed at middleware developers, and also used by provided blocks such as sync, colorizer, etc..
@@ -60,6 +87,20 @@ rs2_processing_block* rs2_create_processing_block(rs2_frame_processor_callback*
*/
rs2_processing_block* rs2_create_processing_block_fptr(rs2_frame_processor_callback_ptr proc, void * context, rs2_error** error);
+/**
+* This method adds a custom option to a custom processing block. This is a simple float that can be accessed via rs2_set_option and rs2_get_option
+* This is an infrastructure function aimed at middleware developers, and also used by provided blocks such as save_to_ply, etc..
+* \param[in] block Processing block
+* \param[in] option_id an int ID for referencing the option
+* \param[in] min the minimum value which will be accepted for this option
+* \param[in] max the maximum value which will be accepted for this option
+* \param[in] step the granularity of options which accept discrete values, or zero if the option accepts continuous values
+* \param[in] def the default value of the option. This will be the initial value.
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return true if adding the option succeeds. false if it fails e.g. an option with this id is already registered
+*/
+int rs2_processing_block_register_simple_option(rs2_processing_block* block, rs2_option option_id, float min, float max, float step, float def, rs2_error** error);
+
/**
* This method is used to direct the output from the processing block to some callback or sink object
* \param[in] block Processing block
@@ -151,6 +192,7 @@ void rs2_enqueue_frame(rs2_frame* frame, void* queue);
/**
* Creates Align processing block.
+* \param[in] align_to stream type to be used as the target of frameset alignment
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
rs2_processing_block* rs2_create_align(rs2_stream align_to, rs2_error** error);
@@ -187,6 +229,55 @@ rs2_processing_block* rs2_create_disparity_transform_block(unsigned char transfo
*/
rs2_processing_block* rs2_create_hole_filling_filter_block(rs2_error** error);
+/**
+* Creates a rates printer block. The printer prints the actual FPS of the invoked frame stream.
+* The block ignores reapiting frames and calculats the FPS only if the frame number of the relevant frame was changed.
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+rs2_processing_block* rs2_create_rates_printer_block(rs2_error** error);
+
+/**
+* Creates Depth post-processing zero order fix block. The filter invalidates pixels that has a wrong value due to zero order effect
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return zero order fix processing block
+*/
+rs2_processing_block* rs2_create_zero_order_invalidation_block(rs2_error** error);
+
+/**
+* Creates Depth frame decompression module. Decoded frames compressed and transmitted with Z16H variable-lenght Huffman code to
+* standartized Z16 Depth data format. Using the compression allows to reduce the Depth frames bandwidth by more than 50 percent
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return Huffman-code decompression processing block
+*/
+rs2_processing_block* rs2_create_huffman_depth_decompress_block(rs2_error** error);
+
+/**
+* Retrieve processing block specific information, like name.
+* \param[in] block The processing block
+* \param[in] info processing block info type to retrieve
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return The requested processing block info string, in a format specific to the device model
+*/
+const char* rs2_get_processing_block_info(const rs2_processing_block* block, rs2_camera_info info, rs2_error** error);
+
+/**
+* Check if a processing block supports a specific info type.
+* \param[in] block The processing block to check
+* \param[in] info The parameter to check for support
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return True if the parameter both exist and well-defined for the specific device
+*/
+int rs2_supports_processing_block_info(const rs2_processing_block* block, rs2_camera_info info, rs2_error** error);
+
+/**
+ * Test if the given processing block can be extended to the requested extension
+ * \param[in] block processing block
+ * \param[in] extension The extension to which the sensor should be tested if it is extendable
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return non-zero value iff the processing block can be extended to the given extension
+ */
+int rs2_is_processing_block_extendable_to(const rs2_processing_block* block, rs2_extension extension_type, rs2_error** error);
+
#ifdef __cplusplus
}
#endif
diff --git a/libs/realsense2/include/librealsense2/h/rs_record_playback.h b/libs/realsense2/include/librealsense2/h/rs_record_playback.h
old mode 100755
new mode 100644
index cddec6d..a540e6d
--- a/libs/realsense2/include/librealsense2/h/rs_record_playback.h
+++ b/libs/realsense2/include/librealsense2/h/rs_record_playback.h
@@ -24,6 +24,7 @@ typedef enum rs2_playback_status
RS2_PLAYBACK_STATUS_STOPPED, /**< All sensors were stopped, or playback has ended (all data was read). This is the initial playback status*/
RS2_PLAYBACK_STATUS_COUNT
} rs2_playback_status;
+
const char* rs2_playback_status_to_string(rs2_playback_status status);
typedef void (*rs2_playback_status_changed_callback_ptr)(rs2_playback_status);
@@ -37,6 +38,16 @@ typedef void (*rs2_playback_status_changed_callback_ptr)(rs2_playback_status);
*/
rs2_device* rs2_create_record_device(const rs2_device* device, const char* file, rs2_error** error);
+/**
+* Creates a recording device to record the given device and save it to the given file
+* \param[in] device The device to record
+* \param[in] file The desired path to which the recorder should save the data
+* \param[in] compression_enabled Indicates if compression is enabled, 0 means false, otherwise true
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return A pointer to a device that records its data to file, or null in case of failure
+*/
+rs2_device* rs2_create_record_device_ex(const rs2_device* device, const char* file, int compression_enabled, rs2_error** error);
+
/**
* Pause the recording device without stopping the actual device from streaming.
* Pausing will cause the device to stop writing new data to the file, in particular, frames and changes to extensions
diff --git a/libs/realsense2/include/librealsense2/h/rs_sensor.h b/libs/realsense2/include/librealsense2/h/rs_sensor.h
old mode 100755
new mode 100644
index 9120275..975e6ef
--- a/libs/realsense2/include/librealsense2/h/rs_sensor.h
+++ b/libs/realsense2/include/librealsense2/h/rs_sensor.h
@@ -30,11 +30,15 @@ typedef enum rs2_camera_info {
RS2_CAMERA_INFO_PRODUCT_ID , /**< Product ID as reported in the USB descriptor */
RS2_CAMERA_INFO_CAMERA_LOCKED , /**< True iff EEPROM is locked */
RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR , /**< Designated USB specification: USB2/USB3 */
+ RS2_CAMERA_INFO_PRODUCT_LINE , /**< Device product line D400/SR300/L500/T200 */
+ RS2_CAMERA_INFO_ASIC_SERIAL_NUMBER , /**< ASIC serial number */
+ RS2_CAMERA_INFO_FIRMWARE_UPDATE_ID , /**< Firmware update ID */
+ RS2_CAMERA_INFO_IP_ADDRESS , /**< IP address for remote camera. */
RS2_CAMERA_INFO_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
} rs2_camera_info;
const char* rs2_camera_info_to_string(rs2_camera_info info);
-/** \brief Streams are different types of data provided by RealSense devices */
+/** \brief Streams are different types of data provided by RealSense devices. */
typedef enum rs2_stream
{
RS2_STREAM_ANY,
@@ -46,17 +50,17 @@ typedef enum rs2_stream
RS2_STREAM_ACCEL , /**< Native stream of accelerometer motion data produced by RealSense device */
RS2_STREAM_GPIO , /**< Signals from external device connected through GPIO */
RS2_STREAM_POSE , /**< 6 Degrees of Freedom pose data, calculated by RealSense device */
- RS2_STREAM_CONFIDENCE,
+ RS2_STREAM_CONFIDENCE , /**< 4 bit per-pixel depth confidence level */
RS2_STREAM_COUNT
} rs2_stream;
const char* rs2_stream_to_string(rs2_stream stream);
-/** \brief Format identifies how binary data is encoded within a frame */
+/** \brief A stream's format identifies how binary data is encoded within a frame. */
typedef enum rs2_format
{
RS2_FORMAT_ANY , /**< When passed to enable stream, librealsense will try to provide best suited format */
RS2_FORMAT_Z16 , /**< 16-bit linear depth values. The depth is meters is equal to depth scale * pixel value. */
- RS2_FORMAT_DISPARITY16 , /**< 16-bit linear disparity values. The depth in meters is equal to depth scale / pixel value. */
+ RS2_FORMAT_DISPARITY16 , /**< 16-bit float-point disparity values. Depth->Disparity conversion : Disparity = Baseline*FocalLength/Depth. */
RS2_FORMAT_XYZ32F , /**< 32-bit floating point 3D coordinates. */
RS2_FORMAT_YUYV , /**< 32-bit y0, u, y1, v data for every two pixels. Similar to YUV422 but packed in a different order - https://en.wikipedia.org/wiki/YUV */
RS2_FORMAT_RGB8 , /**< 8-bit red, green and blue channels */
@@ -65,7 +69,7 @@ typedef enum rs2_format
RS2_FORMAT_BGRA8 , /**< 8-bit blue, green, and red channels + constant alpha channel equal to FF */
RS2_FORMAT_Y8 , /**< 8-bit per-pixel grayscale image */
RS2_FORMAT_Y16 , /**< 16-bit per-pixel grayscale image */
- RS2_FORMAT_RAW10 , /**< Four 10-bit luminance values encoded into a 5-byte macropixel */
+ RS2_FORMAT_RAW10 , /**< Four 10 bits per pixel luminance values packed into a 5-byte macropixel */
RS2_FORMAT_RAW16 , /**< 16-bit raw image */
RS2_FORMAT_RAW8 , /**< 8-bit raw image */
RS2_FORMAT_UYVY , /**< Similar to the standard YUYV pixel format, but packed in a different order */
@@ -74,11 +78,20 @@ typedef enum rs2_format
RS2_FORMAT_GPIO_RAW , /**< Raw data from the external sensors hooked to one of the GPIO's */
RS2_FORMAT_6DOF , /**< Pose data packed as floats array, containing translation vector, rotation quaternion and prediction velocities and accelerations vectors */
RS2_FORMAT_DISPARITY32 , /**< 32-bit float-point disparity values. Depth->Disparity conversion : Disparity = Baseline*FocalLength/Depth */
+ RS2_FORMAT_Y10BPACK , /**< 16-bit per-pixel grayscale image unpacked from 10 bits per pixel packed ([8:8:8:8:2222]) grey-scale image. The data is unpacked to LSB and padded with 6 zero bits */
+ RS2_FORMAT_DISTANCE , /**< 32-bit float-point depth distance value. */
+ RS2_FORMAT_MJPEG , /**< Bitstream encoding for video in which an image of each frame is encoded as JPEG-DIB */
+ RS2_FORMAT_Y8I , /**< 8-bit per pixel interleaved. 8-bit left, 8-bit right. */
+ RS2_FORMAT_Y12I , /**< 12-bit per pixel interleaved. 12-bit left, 12-bit right. Each pixel is stored in a 24-bit word in little-endian order. */
+ RS2_FORMAT_INZI , /**< multi-planar Depth 16bit + IR 10bit. */
+ RS2_FORMAT_INVI , /**< 8-bit IR stream. */
+ RS2_FORMAT_W10 , /**< Grey-scale image as a bit-packed array. 4 pixel data stream taking 5 bytes */
+ RS2_FORMAT_Z16H , /**< Variable-length Huffman-compressed 16-bit depth values. */
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);
-/** \brief Cross-stream extrinsics: encode the topology describing how the different devices are connected. */
+/** \brief Cross-stream extrinsics: encodes the topology describing how the different devices are oriented. */
typedef struct rs2_extrinsics
{
float rotation[9]; /**< Column-major 3x3 rotation matrix */
@@ -155,12 +168,19 @@ int rs2_is_sensor_extendable_to(const rs2_sensor* sensor, rs2_extension extensio
float rs2_get_depth_scale(rs2_sensor* sensor, rs2_error** error);
/**
-* Retrieve the stereoscopic baseline value. Applicable to stereo-based depth modules
+* Retrieve the stereoscopic baseline value from frame. Applicable to stereo-based depth modules
* \param[out] float Stereoscopic baseline in millimeters
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
float rs2_depth_stereo_frame_get_baseline(const rs2_frame* frame_ref, rs2_error** error);
+/**
+* Retrieve the stereoscopic baseline value from sensor. Applicable to stereo-based depth modules
+* \param[out] float Stereoscopic baseline in millimeters
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+float rs2_get_stereo_baseline(rs2_sensor* sensor, rs2_error** error);
+
/**
* \brief sets the active region of interest to be used by auto-exposure algorithm
* \param[in] sensor the RealSense sensor
@@ -298,11 +318,19 @@ const char* rs2_get_notification_serialized_data(rs2_notification* notification,
/**
* check if physical subdevice is supported
-* \param[in] device input RealSense device
+* \param[in] sensor input RealSense subdevice
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
* \return list of stream profiles that given subdevice can provide, should be released by rs2_delete_profiles_list
*/
-rs2_stream_profile_list* rs2_get_stream_profiles(rs2_sensor* device, rs2_error** error);
+rs2_stream_profile_list* rs2_get_stream_profiles(rs2_sensor* sensor, rs2_error** error);
+
+/**
+* check how subdevice is streaming
+* \param[in] sensor input RealSense subdevice
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return list of stream profiles that given subdevice is currently streaming, should be released by rs2_delete_profiles_list
+*/
+rs2_stream_profile_list* rs2_get_active_streams(rs2_sensor* sensor, rs2_error** error);
/**
* Get pointer to specific stream profile
@@ -345,6 +373,21 @@ void rs2_set_stream_profile_data(rs2_stream_profile* mode, rs2_stream stream, in
*/
rs2_stream_profile* rs2_clone_stream_profile(const rs2_stream_profile* mode, rs2_stream stream, int index, rs2_format format, rs2_error** error);
+/**
+* Creates a copy of stream profile, assigning new values to some of the fields
+* \param[in] mode input stream profile
+* \param[in] stream stream type for the profile
+* \param[in] format binary data format of the profile
+* \param[in] width new width for the profile
+* \param[in] height new height for the profile
+* \param[in] intr new intrinsics for the profile
+* \param[in] index stream index the profile in case there are multiple streams of the same type
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return new stream profile, must be deleted by rs2_delete_stream_profile
+*/
+rs2_stream_profile* rs2_clone_video_stream_profile(const rs2_stream_profile* mode, rs2_stream stream, int index, rs2_format format, int width, int height, const rs2_intrinsics* intr, rs2_error** error);
+
+
/**
* Delete stream profile allocated by rs2_clone_stream_profile
* Should not be called on stream profiles returned by the device
@@ -421,6 +464,17 @@ void rs2_register_extrinsics(const rs2_stream_profile* from,
const rs2_stream_profile* to,
rs2_extrinsics extrin, rs2_error** error);
+/**
+ * \brief Override extrinsics of a given sensor that supports calibrated_sensor.
+ *
+ * This will affect extrinsics at the source device and may affect multiple profiles. Used for DEPTH_TO_RGB calibration.
+ *
+* \param[in] sensor The sensor
+* \param[in] extrinsics Extrinsics from Depth to the named sensor
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_override_extrinsics( const rs2_sensor* sensor, const rs2_extrinsics* extrinsics, rs2_error** error );
+
/**
* When called on a video profile, returns the intrinsics of specific stream configuration
* \param[in] mode input stream profile
@@ -429,8 +483,172 @@ void rs2_register_extrinsics(const rs2_stream_profile* from,
*/
void rs2_get_video_stream_intrinsics(const rs2_stream_profile* mode, rs2_intrinsics* intrinsics, rs2_error** error);
+/**
+ * Returns the list of recommended processing blocks for a specific sensor.
+ * Order and configuration of the blocks are decided by the sensor
+ * \param[in] sensor input sensor
+ * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ * \return list of supported sensor recommended processing blocks
+*/
+rs2_processing_block_list* rs2_get_recommended_processing_blocks(rs2_sensor* sensor, rs2_error** error);
+
+/**
+* Returns specific processing blocks from processing blocks list
+* \param[in] list the processing blocks list
+* \param[in] index the requested processing block
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return processing block
+*/
+rs2_processing_block* rs2_get_processing_block(const rs2_processing_block_list* list, int index, rs2_error** error);
+
+/**
+* Returns the processing blocks list size
+* \param[in] list the processing blocks list
+* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return the processing block list size
+*/
+int rs2_get_recommended_processing_blocks_count(const rs2_processing_block_list* list, rs2_error** error);
+
+/**
+* Deletes processing blocks list
+* \param[in] list list to delete
+*/
+void rs2_delete_recommended_processing_blocks(rs2_processing_block_list* list);
+
+/**
+* Imports a localization map from file to tm2 tracking device
+* \param[in] sensor TM2 position-tracking sensor
+* \param[in] lmap_blob Localization map raw buffer, serialized
+* \param[in] blob_size The buffer's size in bytes
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return Non-zero if succeeded, otherwise 0
+*/
+int rs2_import_localization_map(const rs2_sensor* sensor, const unsigned char* lmap_blob, unsigned int blob_size, rs2_error** error);
+
+/**
+* Extract and store the localization map of tm2 tracking device to file
+* \param[in] sensor TM2 position-tracking sensor
+* \param[in] lmap_fname The file name of the localization map
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return Device's response in a rs2_raw_data_buffer, which should be released by rs2_delete_raw_data
+*/
+//void rs2_export_localization_map(const rs2_sensor* sensor, const char* lmap_fname, rs2_error** error);
+const rs2_raw_data_buffer* rs2_export_localization_map(const rs2_sensor* sensor, rs2_error** error);
+
+/**
+* Create a named location tag
+* \param[in] sensor T2xx position-tracking sensor
+* \param[in] guid Null-terminated string of up to 127 characters
+* \param[in] pos Position in meters, relative to the current tracking session
+* \param[in] orient Quaternion orientation, expressed the the coordinate system of the current tracking session
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return Non-zero if succeeded, otherwise 0
+*/
+int rs2_set_static_node(const rs2_sensor* sensor, const char* guid, const rs2_vector pos, const rs2_quaternion orient, rs2_error** error);
+
+/**
+* Retrieve a named location tag
+* \param[in] sensor T2xx position-tracking sensor
+* \param[in] guid Null-terminated string of up to 127 characters
+* \param[out] pos Position in meters of the tagged (stored) location
+* \param[out] orient Quaternion orientation of the tagged (stored) location
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return Non-zero if succeeded, otherwise 0
+*/
+int rs2_get_static_node(const rs2_sensor* sensor, const char* guid, rs2_vector *pos, rs2_quaternion *orient, rs2_error** error);
+
+/**
+* Remove a named location tag
+* \param[in] sensor T2xx position-tracking sensor
+* \param[in] guid Null-terminated string of up to 127 characters
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+* \return Non-zero if succeeded, otherwise 0
+*/
+int rs2_remove_static_node(const rs2_sensor* sensor, const char* guid, rs2_error** error);
+
+/** Load Wheel odometer settings from host to device
+* \param[in] odometry_config_buf odometer configuration/calibration blob serialized from jsom file
+* \return true on success
+*/
+int rs2_load_wheel_odometry_config(const rs2_sensor* sensor, const unsigned char* odometry_config_buf, unsigned int blob_size, rs2_error** error);
+
+/** Send wheel odometry data for each individual sensor (wheel)
+* \param[in] wo_sensor_id - Zero-based index of (wheel) sensor with the same type within device
+* \param[in] frame_num - Monotonocally increasing frame number, managed per sensor.
+* \param[in] translational_velocity - Translational velocity of the wheel sensor [meter/sec]
+* \return true on success
+*/
+int rs2_send_wheel_odometry(const rs2_sensor* sensor, char wo_sensor_id, unsigned int frame_num,
+ const rs2_vector translational_velocity, rs2_error** error);
+
+/**
+* Set intrinsics of a given sensor
+* \param[in] sensor The RealSense device
+* \param[in] profile Target stream profile
+* \param[in] intrinsics Intrinsics value to be written to the device
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_set_intrinsics(const rs2_sensor* sensor, const rs2_stream_profile* profile , const rs2_intrinsics* intrinsics, rs2_error** error);
+
+/**
+ * \brief Override intrinsics of a given sensor that supports calibrated_sensor.
+ *
+ * This will affect intrinsics at the source and may affect multiple profiles. Used for DEPTH_TO_RGB calibration.
+ *
+* \param[in] sensor The RealSense device
+* \param[in] intrinsics Intrinsics value to be written to the sensor
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_override_intrinsics( const rs2_sensor* sensor, const rs2_intrinsics* intrinsics, rs2_error** error );
+
+/**
+ * Set extrinsics between two sensors
+ * \param[in] from_sensor Origin sensor
+ * \param[in] from_profile Origin profile
+ * \param[in] to_sensor Target sensor
+ * \param[in] to_profile Target profile
+ * \param[out] extrinsics Extrinsics from origin to target
+ * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+void rs2_set_extrinsics(const rs2_sensor* from_sensor, const rs2_stream_profile* from_profile, rs2_sensor* to_sensor, const rs2_stream_profile* to_profile, const rs2_extrinsics* extrinsics, rs2_error** error);
+
+/**
+ * Get the DSM parameters for a sensor
+ * \param[in] sensor Sensor that supports the CALIBRATED_SENSOR extension
+ * \param[out] p_params_out Pointer to the structure that will get the DSM parameters
+ * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+void rs2_get_dsm_params( rs2_sensor const * sensor, rs2_dsm_params * p_params_out, rs2_error** error );
+
+/**
+ * Set the sensor DSM parameters
+ * This should ideally be done when the stream is NOT running. If it is, the
+ * parameters may not take effect immediately.
+ * \param[in] sensor Sensor that supports the CALIBRATED_SENSOR extension
+ * \param[out] p_params Pointer to the structure that contains the DSM parameters
+ * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+void rs2_override_dsm_params( rs2_sensor const * sensor, rs2_dsm_params const * p_params, rs2_error** error );
+
+/**
+ * Reset the sensor DSM parameters
+ * This should ideally be done when the stream is NOT running. May not take effect immediately.
+ * \param[in] sensor Sensor that supports the CALIBRATED_SENSOR extension
+ * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+ */
+void rs2_reset_sensor_calibration( rs2_sensor const * sensor, rs2_error** error );
+
+/**
+* Set motion device intrinsics
+* \param[in] sensor Motion sensor
+* \param[in] profile Motion stream profile
+* \param[out] intrinsics Pointer to the struct to store the data in
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
+*/
+void rs2_set_motion_device_intrinsics(const rs2_sensor* sensor, const rs2_stream_profile* profile, const rs2_motion_device_intrinsic* intrinsics, rs2_error** error);
+
#ifdef __cplusplus
}
#endif
-#endif
+#endif // LIBREALSENSE_RS2_SENSOR_H
diff --git a/libs/realsense2/include/librealsense2/h/rs_terminal_parser.h b/libs/realsense2/include/librealsense2/h/rs_terminal_parser.h
new file mode 100644
index 0000000..f0728f1
--- /dev/null
+++ b/libs/realsense2/include/librealsense2/h/rs_terminal_parser.h
@@ -0,0 +1,63 @@
+/* License: Apache 2.0. See LICENSE file in root directory.
+ Copyright(c) 2020 Intel Corporation. All Rights Reserved. */
+
+/** \file rs_terminal.h
+* \brief Exposes RealSense terminal functionality for C compilers
+*/
+
+
+#ifndef LIBREALSENSE_RS2_TERMINAL_H
+#define LIBREALSENSE_RS2_TERMINAL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "rs_types.h"
+
+/**
+* \brief Creates RealSense terminal parser.
+* \param[in] xml_content content of the xml file needed for parsing
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return pointer to created terminal parser object
+*/
+rs2_terminal_parser* rs2_create_terminal_parser(const char* xml_content, rs2_error** error);
+
+/**
+* \brief Deletes RealSense terminal parser.
+* \param[in] terminal_parser terminal parser to be deleted
+*/
+void rs2_delete_terminal_parser(rs2_terminal_parser* terminal_parser);
+
+/**
+* \brief Parses terminal command via RealSense terminal parser
+* \param[in] terminal_parser Terminal parser object
+* \param[in] command command to be sent to the hw monitor of the device
+* \param[in] size_of_command size of command to be sent to the hw monitor of the device
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return command to hw monitor, in hex
+*/
+rs2_raw_data_buffer* rs2_terminal_parse_command(rs2_terminal_parser* terminal_parser,
+ const char* command, unsigned int size_of_command, rs2_error** error);
+
+/**
+* \brief Parses terminal response via RealSense terminal parser
+* \param[in] terminal_parser Terminal parser object
+* \param[in] command command sent to the hw monitor of the device
+* \param[in] size_of_command size of the command to sent to the hw monitor of the device
+* \param[in] response response received by the hw monitor of the device
+* \param[in] size_of_response size of the response received by the hw monitor of the device
+* \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
+* \return answer parsed
+*/
+rs2_raw_data_buffer* rs2_terminal_parse_response(rs2_terminal_parser* terminal_parser,
+ const char* command, unsigned int size_of_command,
+ const void* response, unsigned int size_of_response, rs2_error** error);
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/libs/realsense2/include/librealsense2/h/rs_types.h b/libs/realsense2/include/librealsense2/h/rs_types.h
old mode 100755
new mode 100644
index fa088d4..ef2ef62
--- a/libs/realsense2/include/librealsense2/h/rs_types.h
+++ b/libs/realsense2/include/librealsense2/h/rs_types.h
@@ -13,7 +13,7 @@
extern "C" {
#endif
-/** \brief Category of the librealsense notifications */
+/** \brief Category of the librealsense notification. */
typedef enum rs2_notification_category{
RS2_NOTIFICATION_CATEGORY_FRAMES_TIMEOUT, /**< Frames didn't arrived within 5 seconds */
RS2_NOTIFICATION_CATEGORY_FRAME_CORRUPTED, /**< Received partial/incomplete frame */
@@ -21,11 +21,12 @@ typedef enum rs2_notification_category{
RS2_NOTIFICATION_CATEGORY_HARDWARE_EVENT, /**< General Hardeware notification that is not an error */
RS2_NOTIFICATION_CATEGORY_UNKNOWN_ERROR, /**< Received unknown error from the device */
RS2_NOTIFICATION_CATEGORY_FIRMWARE_UPDATE_RECOMMENDED, /**< Current firmware version installed is not the latest available */
+ RS2_NOTIFICATION_CATEGORY_POSE_RELOCALIZATION, /**< A relocalization event has updated the pose provided by a pose sensor */
RS2_NOTIFICATION_CATEGORY_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
} rs2_notification_category;
const char* rs2_notification_category_to_string(rs2_notification_category category);
-/** \brief Exception types are the different categories of errors that RealSense API might return */
+/** \brief Exception types are the different categories of errors that RealSense API might return. */
typedef enum rs2_exception_type
{
RS2_EXCEPTION_TYPE_UNKNOWN,
@@ -48,11 +49,12 @@ typedef enum rs2_distortion
RS2_DISTORTION_INVERSE_BROWN_CONRADY , /**< Equivalent to Brown-Conrady distortion, except undistorts image instead of distorting it */
RS2_DISTORTION_FTHETA , /**< F-Theta fish-eye distortion model */
RS2_DISTORTION_BROWN_CONRADY , /**< Unmodified Brown-Conrady distortion model */
+ RS2_DISTORTION_KANNALA_BRANDT4 , /**< Four parameter Kannala Brandt distortion model */
RS2_DISTORTION_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
} rs2_distortion;
const char* rs2_distortion_to_string(rs2_distortion distortion);
-/** \brief Video stream intrinsics */
+/** \brief Video stream intrinsics. */
typedef struct rs2_intrinsics
{
int width; /**< Width of the image in pixels */
@@ -62,10 +64,36 @@ typedef struct rs2_intrinsics
float fx; /**< Focal length of the image plane, as a multiple of pixel width */
float fy; /**< Focal length of the image plane, as a multiple of pixel height */
rs2_distortion model; /**< Distortion model of the image */
- float coeffs[5]; /**< Distortion coefficients, order: k1, k2, p1, p2, k3 */
+ float coeffs[5]; /**< Distortion coefficients */
} rs2_intrinsics;
-/** \brief Motion device intrinsics: scale, bias, and variances */
+/** \brief Video DSM (Digital Sync Module) parameters for calibration (same layout as in FW ac_depth_params)
+ This is the block in MC that converts angles to dimensionless integers reported to MA (using "DSM coefficients").
+*/
+typedef struct rs2_dsm_params
+{
+ unsigned long long timestamp; /**< system_clock::time_point::time_since_epoch().count() */
+ unsigned short version; /**< MAJOR<<12 | MINOR<<4 | PATCH */
+ unsigned char model; /**< rs2_dsm_correction_model */
+ unsigned char flags[5]; /**< TBD, now 0s */
+ float h_scale; /**< the scale factor to horizontal DSM scale thermal results */
+ float v_scale; /**< the scale factor to vertical DSM scale thermal results */
+ float h_offset; /**< the offset to horizontal DSM offset thermal results */
+ float v_offset; /**< the offset to vertical DSM offset thermal results */
+ float rtd_offset; /**< the offset to the Round-Trip-Distance delay thermal results */
+ unsigned char temp_x2; /**< the temperature recorded times 2 (ldd for depth; hum for rgb) */
+ unsigned char reserved[11];
+} rs2_dsm_params;
+
+typedef enum rs2_dsm_correction_model
+{
+ RS2_DSM_CORRECTION_NONE, /**< hFactor and hOffset are not used, and no artificial error is induced */
+ RS2_DSM_CORRECTION_AOT, /**< Aging-over-thermal (default); aging-induced error is uniform across temperature */
+ RS2_DSM_CORRECTION_TOA, /**< Thermal-over-aging; aging-induced error changes alongside temperature */
+ RS2_DSM_CORRECTION_COUNT
+} rs2_dsm_correction_model;
+
+/** \brief Motion device intrinsics: scale, bias, and variances. */
typedef struct rs2_motion_device_intrinsic
{
/* \internal
@@ -78,7 +106,44 @@ typedef struct rs2_motion_device_intrinsic
float bias_variances[3]; /**< Variance of bias for X, Y, and Z axis */
} rs2_motion_device_intrinsic;
-/** \brief Severity of the librealsense logger */
+/** \brief 3D coordinates with origin at topmost left corner of the lense,
+ with positive Z pointing away from the camera, positive X pointing camera right and positive Y pointing camera down */
+typedef struct rs2_vertex
+{
+ float xyz[3];
+} rs2_vertex;
+
+/** \brief Pixel location within 2D image. (0,0) is the topmost, left corner. Positive X is right, positive Y is down */
+typedef struct rs2_pixel
+{
+ int ij[2];
+} rs2_pixel;
+
+/** \brief 3D vector in Euclidean coordinate space */
+typedef struct rs2_vector
+{
+ float x, y, z;
+}rs2_vector;
+
+/** \brief Quaternion used to represent rotation */
+typedef struct rs2_quaternion
+{
+ float x, y, z, w;
+}rs2_quaternion;
+
+typedef struct rs2_pose
+{
+ rs2_vector translation; /**< X, Y, Z values of translation, in meters (relative to initial position) */
+ rs2_vector velocity; /**< X, Y, Z values of velocity, in meters/sec */
+ rs2_vector acceleration; /**< X, Y, Z values of acceleration, in meters/sec^2 */
+ rs2_quaternion rotation; /**< Qi, Qj, Qk, Qr components of rotation as represented in quaternion rotation (relative to initial position) */
+ rs2_vector angular_velocity; /**< X, Y, Z values of angular velocity, in radians/sec */
+ rs2_vector angular_acceleration; /**< X, Y, Z values of angular acceleration, in radians/sec^2 */
+ unsigned int tracker_confidence; /**< Pose confidence 0x0 - Failed, 0x1 - Low, 0x2 - Medium, 0x3 - High */
+ unsigned int mapper_confidence; /**< Pose map confidence 0x0 - Failed, 0x1 - Low, 0x2 - Medium, 0x3 - High */
+} rs2_pose;
+
+/** \brief Severity of the librealsense logger. */
typedef enum rs2_log_severity {
RS2_LOG_SEVERITY_DEBUG, /**< Detailed information about ordinary operations */
RS2_LOG_SEVERITY_INFO , /**< Terse information about ordinary operations */
@@ -86,11 +151,12 @@ typedef enum rs2_log_severity {
RS2_LOG_SEVERITY_ERROR, /**< Indication of definite failure */
RS2_LOG_SEVERITY_FATAL, /**< Indication of unrecoverable failure */
RS2_LOG_SEVERITY_NONE , /**< No logging will occur */
- RS2_LOG_SEVERITY_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
-} rs2_log_severity;
+ RS2_LOG_SEVERITY_COUNT, /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
+ RS2_LOG_SEVERITY_ALL = RS2_LOG_SEVERITY_DEBUG /**< Include any/all log messages */
+ } rs2_log_severity;
const char* rs2_log_severity_to_string(rs2_log_severity info);
-/** \brief Specifies advanced interfaces (capabilities) objects may implement */
+/** \brief Specifies advanced interfaces (capabilities) objects may implement. */
typedef enum rs2_extension
{
RS2_EXTENSION_UNKNOWN,
@@ -118,6 +184,32 @@ typedef enum rs2_extension
RS2_EXTENSION_TM2,
RS2_EXTENSION_SOFTWARE_DEVICE,
RS2_EXTENSION_SOFTWARE_SENSOR,
+ RS2_EXTENSION_DECIMATION_FILTER,
+ RS2_EXTENSION_THRESHOLD_FILTER,
+ RS2_EXTENSION_DISPARITY_FILTER,
+ RS2_EXTENSION_SPATIAL_FILTER,
+ RS2_EXTENSION_TEMPORAL_FILTER,
+ RS2_EXTENSION_HOLE_FILLING_FILTER,
+ RS2_EXTENSION_ZERO_ORDER_FILTER,
+ RS2_EXTENSION_RECOMMENDED_FILTERS,
+ RS2_EXTENSION_POSE,
+ RS2_EXTENSION_POSE_SENSOR,
+ RS2_EXTENSION_WHEEL_ODOMETER,
+ RS2_EXTENSION_GLOBAL_TIMER,
+ RS2_EXTENSION_UPDATABLE,
+ RS2_EXTENSION_UPDATE_DEVICE,
+ RS2_EXTENSION_L500_DEPTH_SENSOR,
+ RS2_EXTENSION_TM2_SENSOR,
+ RS2_EXTENSION_AUTO_CALIBRATED_DEVICE,
+ RS2_EXTENSION_COLOR_SENSOR,
+ RS2_EXTENSION_MOTION_SENSOR,
+ RS2_EXTENSION_FISHEYE_SENSOR,
+ RS2_EXTENSION_DEPTH_HUFFMAN_DECODER,
+ RS2_EXTENSION_SERIALIZABLE,
+ RS2_EXTENSION_FW_LOGGER,
+ RS2_EXTENSION_AUTO_CALIBRATION_FILTER,
+ RS2_EXTENSION_DEVICE_CALIBRATION,
+ RS2_EXTENSION_CALIBRATED_SENSOR,
RS2_EXTENSION_COUNT
} rs2_extension;
const char* rs2_extension_type_to_string(rs2_extension type);
@@ -130,14 +222,20 @@ typedef enum rs2_matchers
RS2_MATCHER_DI_C, //compare depth and ir based on frame number,
//compare the pair of corresponding depth and ir with color based on closest timestamp,
- //commonlly used by SR300
+ //commonly used by SR300
RS2_MATCHER_DLR_C, //compare depth, left and right ir based on frame number,
//compare the set of corresponding depth, left and right with color based on closest timestamp,
- //commonlly used by RS415, RS435
+ //commonly used by RS415, RS435
RS2_MATCHER_DLR, //compare depth, left and right ir based on frame number,
- //commonlly used by RS400, RS405, RS410, RS420, RS430
+ //commonly used by RS400, RS405, RS410, RS420, RS430
+
+ RS2_MATCHER_DIC, //compare depth, ir and confidence based on frame number used by RS500
+
+ RS2_MATCHER_DIC_C, //compare depth, ir and confidence based on frame number,
+ //compare the set of corresponding depth, ir and confidence with color based on closest timestamp,
+ //commonly used by RS515
RS2_MATCHER_DEFAULT, //the default matcher compare all the streams based on closest timestamp
@@ -147,6 +245,7 @@ typedef enum rs2_matchers
typedef struct rs2_device_info rs2_device_info;
typedef struct rs2_device rs2_device;
typedef struct rs2_error rs2_error;
+typedef struct rs2_log_message rs2_log_message;
typedef struct rs2_raw_data_buffer rs2_raw_data_buffer;
typedef struct rs2_frame rs2_frame;
typedef struct rs2_frame_queue rs2_frame_queue;
@@ -155,6 +254,7 @@ typedef struct rs2_pipeline_profile rs2_pipeline_profile;
typedef struct rs2_config rs2_config;
typedef struct rs2_device_list rs2_device_list;
typedef struct rs2_stream_profile_list rs2_stream_profile_list;
+typedef struct rs2_processing_block_list rs2_processing_block_list;
typedef struct rs2_stream_profile rs2_stream_profile;
typedef struct rs2_frame_callback rs2_frame_callback;
typedef struct rs2_log_callback rs2_log_callback;
@@ -164,22 +264,32 @@ typedef struct rs2_source rs2_source;
typedef struct rs2_processing_block rs2_processing_block;
typedef struct rs2_frame_processor_callback rs2_frame_processor_callback;
typedef struct rs2_playback_status_changed_callback rs2_playback_status_changed_callback;
+typedef struct rs2_update_progress_callback rs2_update_progress_callback;
typedef struct rs2_context rs2_context;
typedef struct rs2_device_hub rs2_device_hub;
typedef struct rs2_sensor_list rs2_sensor_list;
typedef struct rs2_sensor rs2_sensor;
typedef struct rs2_options rs2_options;
+typedef struct rs2_options_list rs2_options_list;
typedef struct rs2_devices_changed_callback rs2_devices_changed_callback;
typedef struct rs2_notification rs2_notification;
typedef struct rs2_notifications_callback rs2_notifications_callback;
+typedef struct rs2_firmware_log_message rs2_firmware_log_message;
+typedef struct rs2_firmware_log_parsed_message rs2_firmware_log_parsed_message;
+typedef struct rs2_firmware_log_parser rs2_firmware_log_parser;
+typedef struct rs2_terminal_parser rs2_terminal_parser;
+typedef void (*rs2_log_callback_ptr)(rs2_log_severity, rs2_log_message const *, void * arg);
typedef void (*rs2_notification_callback_ptr)(rs2_notification*, void*);
+typedef void(*rs2_software_device_destruction_callback_ptr)(void*);
typedef void (*rs2_devices_changed_callback_ptr)(rs2_device_list*, rs2_device_list*, void*);
typedef void (*rs2_frame_callback_ptr)(rs2_frame*, void*);
typedef void (*rs2_frame_processor_callback_ptr)(rs2_frame*, rs2_source*, void*);
+typedef void(*rs2_update_progress_callback_ptr)(const float, void*);
typedef double rs2_time_t; /**< Timestamp format. units are milliseconds */
typedef long long rs2_metadata_type; /**< Metadata attribute type is defined as 64 bit signed integer*/
+rs2_error * rs2_create_error(const char* what, const char* name, const char* args, rs2_exception_type type);
rs2_exception_type rs2_get_librealsense_exception_type(const rs2_error* error);
const char* rs2_get_failed_function (const rs2_error* error);
const char* rs2_get_failed_args (const rs2_error* error);
diff --git a/libs/realsense2/include/librealsense2/hpp/rs_context.hpp b/libs/realsense2/include/librealsense2/hpp/rs_context.hpp
old mode 100755
new mode 100644
index 6b383ce..3d105aa
--- a/libs/realsense2/include/librealsense2/hpp/rs_context.hpp
+++ b/libs/realsense2/include/librealsense2/hpp/rs_context.hpp
@@ -17,7 +17,7 @@ namespace rs2
:_removed(removed), _added(added) {}
/**
- * check if specific device was disconnected
+ * check if a specific device was disconnected
* \return true if device disconnected, false if device connected
*/
bool was_removed(const rs2::device& dev) const
@@ -34,7 +34,7 @@ namespace rs2
}
/**
- * check if specific device was added
+ * check if a specific device was added
* \return true if device added, false otherwise
*/
bool was_added(const rs2::device& dev) const
@@ -49,7 +49,7 @@ namespace rs2
return res > 0;
}
-
+
/**
* returns a list of all newly connected devices
* \return the list of all new connected devices
@@ -59,15 +59,6 @@ namespace rs2
return _added;
}
- /**
- * returns a list of all newly removed devices
- * \return the list of all newly removed devices
- */
- device_list get_removed_devices() const
- {
- return _removed;
- }
-
private:
device_list _removed;
device_list _added;
@@ -96,6 +87,7 @@ namespace rs2
class pipeline;
class device_hub;
+ class software_device;
/**
* default librealsense context class
@@ -128,6 +120,21 @@ namespace rs2
return device_list(list);
}
+ /**
+ * create a static snapshot of all connected devices at the time of the call
+ * \return the list of devices connected devices at the time of the call
+ */
+ device_list query_devices(int mask) const
+ {
+ rs2_error* e = nullptr;
+ std::shared_ptr list(
+ rs2_query_devices_ex(_context.get(), mask, &e),
+ rs2_delete_device_list);
+ error::handle(e);
+
+ return device_list(list);
+ }
+
/**
* @brief Generate a flat list of all available sensors from all RealSense devices
* @return List of sensors
@@ -192,13 +199,22 @@ namespace rs2
rs2::error::handle(e);
}
-protected:
- friend class rs2::pipeline;
- friend class rs2::device_hub;
+ void unload_tracking_module()
+ {
+ rs2_error* e = nullptr;
+ rs2_context_unload_tracking_module(_context.get(), &e);
+ rs2::error::handle(e);
+ }
context(std::shared_ptr ctx)
: _context(ctx)
{}
+ explicit operator std::shared_ptr() { return _context; };
+ protected:
+ friend class rs2::pipeline;
+ friend class rs2::device_hub;
+ friend class rs2::software_device;
+
std::shared_ptr _context;
};
@@ -209,11 +225,10 @@ namespace rs2
{
public:
explicit device_hub(context ctx)
- : _ctx(std::move(ctx))
{
rs2_error* e = nullptr;
_device_hub = std::shared_ptr(
- rs2_create_device_hub(_ctx._context.get(), &e),
+ rs2_create_device_hub(ctx._context.get(), &e),
rs2_delete_device_hub);
error::handle(e);
}
@@ -226,7 +241,7 @@ namespace rs2
{
rs2_error* e = nullptr;
std::shared_ptr dev(
- rs2_device_hub_wait_for_device(_ctx._context.get(), _device_hub.get(), &e),
+ rs2_device_hub_wait_for_device(_device_hub.get(), &e),
rs2_delete_device);
error::handle(e);
@@ -247,8 +262,10 @@ namespace rs2
return res > 0 ? true : false;
}
+
+ explicit operator std::shared_ptr() { return _device_hub; }
+ explicit device_hub(std::shared_ptr hub) : _device_hub(std::move(hub)) {}
private:
- context _ctx;
std::shared_ptr _device_hub;
};
diff --git a/libs/realsense2/include/librealsense2/hpp/rs_device.hpp b/libs/realsense2/include/librealsense2/hpp/rs_device.hpp
old mode 100755
new mode 100644
index 917450d..b23f177
--- a/libs/realsense2/include/librealsense2/hpp/rs_device.hpp
+++ b/libs/realsense2/include/librealsense2/hpp/rs_device.hpp
@@ -134,6 +134,9 @@ namespace rs2
virtual ~device()
{
}
+
+ explicit operator std::shared_ptr() { return _dev; };
+ explicit device(std::shared_ptr dev) : _dev(dev) {}
protected:
friend class rs2::context;
friend class rs2::device_list;
@@ -141,8 +144,451 @@ namespace rs2
friend class rs2::device_hub;
std::shared_ptr _dev;
- explicit device(std::shared_ptr dev) : _dev(dev)
+
+ };
+
+ template
+ class update_progress_callback : public rs2_update_progress_callback
+ {
+ T _callback;
+
+ public:
+ explicit update_progress_callback(T callback) : _callback(callback) {}
+
+ void on_update_progress(const float progress) override
+ {
+ _callback(progress);
+ }
+
+ void release() override { delete this; }
+ };
+
+ class updatable : public device
+ {
+ public:
+ updatable() : device() {}
+ updatable(device d)
+ : device(d.get())
+ {
+ rs2_error* e = nullptr;
+ if (rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_UPDATABLE, &e) == 0 && !e)
+ {
+ _dev.reset();
+ }
+ error::handle(e);
+ }
+
+ // Move the device to update state, this will cause the updatable device to disconnect and reconnect as an update device.
+ void enter_update_state() const
+ {
+ rs2_error* e = nullptr;
+ rs2_enter_update_state(_dev.get(), &e);
+ error::handle(e);
+ }
+
+ // Create backup of camera flash memory. Such backup does not constitute valid firmware image, and cannot be
+ // loaded back to the device, but it does contain all calibration and device information."
+ std::vector create_flash_backup() const
+ {
+ std::vector results;
+
+ rs2_error* e = nullptr;
+ std::shared_ptr list(
+ rs2_create_flash_backup_cpp(_dev.get(), nullptr, &e),
+ rs2_delete_raw_data);
+ error::handle(e);
+
+ auto size = rs2_get_raw_data_size(list.get(), &e);
+ error::handle(e);
+
+ auto start = rs2_get_raw_data(list.get(), &e);
+
+ results.insert(results.begin(), start, start + size);
+
+ return results;
+ }
+
+ template
+ std::vector create_flash_backup(T callback) const
+ {
+ std::vector results;
+
+ rs2_error* e = nullptr;
+ std::shared_ptr list(
+ rs2_create_flash_backup_cpp(_dev.get(), new update_progress_callback(std::move(callback)), &e),
+ rs2_delete_raw_data);
+ error::handle(e);
+
+ auto size = rs2_get_raw_data_size(list.get(), &e);
+ error::handle(e);
+
+ auto start = rs2_get_raw_data(list.get(), &e);
+
+ results.insert(results.begin(), start, start + size);
+
+ return results;
+ }
+
+ // Update an updatable device to the provided unsigned firmware. This call is executed on the caller's thread.
+ void update_unsigned(const std::vector& image, int update_mode = RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
+ {
+ rs2_error* e = nullptr;
+ rs2_update_firmware_unsigned_cpp(_dev.get(), image.data(), (int)image.size(), nullptr, update_mode, &e);
+ error::handle(e);
+ }
+
+ // Update an updatable device to the provided unsigned firmware. This call is executed on the caller's thread and it supports progress notifications via the callback.
+ template
+ void update_unsigned(const std::vector& image, T callback, int update_mode = RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
+ {
+ rs2_error* e = nullptr;
+ rs2_update_firmware_unsigned_cpp(_dev.get(), image.data(), int(image.size()), new update_progress_callback(std::move(callback)), update_mode, &e);
+ error::handle(e);
+ }
+ };
+
+ class update_device : public device
+ {
+ public:
+ update_device() : device() {}
+ update_device(device d)
+ : device(d.get())
+ {
+ rs2_error* e = nullptr;
+ if (rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_UPDATE_DEVICE, &e) == 0 && !e)
+ {
+ _dev.reset();
+ }
+ error::handle(e);
+ }
+
+ // Update an updatable device to the provided firmware.
+ // This call is executed on the caller's thread.
+ void update(const std::vector& fw_image) const
+ {
+ rs2_error* e = nullptr;
+ rs2_update_firmware_cpp(_dev.get(), fw_image.data(), (int)fw_image.size(), NULL, &e);
+ error::handle(e);
+ }
+
+ // Update an updatable device to the provided firmware.
+ // This call is executed on the caller's thread and it supports progress notifications via the callback.
+ template
+ void update(const std::vector& fw_image, T callback) const
+ {
+ rs2_error* e = nullptr;
+ rs2_update_firmware_cpp(_dev.get(), fw_image.data(), int(fw_image.size()), new update_progress_callback(std::move(callback)), &e);
+ error::handle(e);
+ }
+ };
+
+ typedef std::vector calibration_table;
+
+ class calibrated_device : public device
+ {
+ public:
+ calibrated_device(device d)
+ : device(d.get())
+ {}
+
+ /**
+ * Write calibration that was set by set_calibration_table to device's EEPROM.
+ */
+ void write_calibration() const
+ {
+ rs2_error* e = nullptr;
+ rs2_write_calibration(_dev.get(), &e);
+ error::handle(e);
+ }
+
+ /**
+ * Reset device to factory calibration
+ */
+ void reset_to_factory_calibration()
+ {
+ rs2_error* e = nullptr;
+ rs2_reset_to_factory_calibration(_dev.get(), &e);
+ error::handle(e);
+ }
+ };
+
+ class auto_calibrated_device : public calibrated_device
+ {
+ public:
+ auto_calibrated_device(device d)
+ : calibrated_device(d)
+ {
+ rs2_error* e = nullptr;
+ if (rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_AUTO_CALIBRATED_DEVICE, &e) == 0 && !e)
+ {
+ _dev.reset();
+ }
+ error::handle(e);
+ }
+
+ /**
+ * This will improve the depth noise.
+ * \param[in] json_content Json string to configure speed on chip calibration parameters:
+ {
+ "speed": 3,
+ "scan parameter": 0,
+ "data sampling": 0
+ }
+ speed - value can be one of: Very fast = 0, Fast = 1, Medium = 2, Slow = 3, White wall = 4, default is Slow
+ scan_parameter - value can be one of: Py scan (default) = 0, Rx scan = 1
+ data_sampling - value can be one of:polling data sampling = 0, interrupt data sampling = 1
+ if json is nullptr it will be ignored and calibration will use the default parameters
+ * \param[out] health Calibration Health-Check captures how far camera calibration is from the optimal one
+ [0, 0.25) - Good
+ [0.25, 0.75) - Can be Improved
+ [0.75, ) - Requires Calibration
+ * \param[in] callback Optional callback to get progress notifications
+ * \param[in] timeout_ms Timeout in ms
+ * \return New calibration table
+ */
+ template
+ calibration_table run_on_chip_calibration(std::string json_content, float* health, T callback, int timeout_ms = 5000) const
+ {
+ std::vector results;
+
+ rs2_error* e = nullptr;
+ std::shared_ptr list(
+ rs2_run_on_chip_calibration_cpp(_dev.get(), json_content.data(), int(json_content.size()), health, new update_progress_callback(std::move(callback)), timeout_ms, &e),
+ rs2_delete_raw_data);
+ error::handle(e);
+
+ auto size = rs2_get_raw_data_size(list.get(), &e);
+ error::handle(e);
+
+ auto start = rs2_get_raw_data(list.get(), &e);
+
+ results.insert(results.begin(), start, start + size);
+
+ return results;
+ }
+
+ /**
+ * This will improve the depth noise.
+ * \param[in] json_content Json string to configure speed on chip calibration parameters:
+ {
+ "speed": 3,
+ "scan parameter": 0,
+ "data sampling": 0
+ }
+ speed - value can be one of: Very fast = 0, Fast = 1, Medium = 2, Slow = 3, White wall = 4, default is Slow
+ scan parameter - value can be one of: Py scan (default) = 0, Rx scan = 1
+ data sampling - value can be one of:polling data sampling = 0, interrupt data sampling = 1
+ if json is nullptr it will be ignored and calibration will use the default parameters
+ * \param[out] health Calibration Health-Check captures how far camera calibration is from the optimal one
+ [0, 0.25) - Good
+ [0.25, 0.75) - Can be Improved
+ [0.75, ) - Requires Calibration
+ * \param[in] timeout_ms Timeout in ms
+ * \return New calibration table
+ */
+ calibration_table run_on_chip_calibration(std::string json_content, float* health, int timeout_ms = 5000) const
{
+ std::vector results;
+
+ rs2_error* e = nullptr;
+ std::shared_ptr list(
+ rs2_run_on_chip_calibration_cpp(_dev.get(), json_content.data(), static_cast< int >( json_content.size() ), health, nullptr, timeout_ms, &e),
+ rs2_delete_raw_data);
+ error::handle(e);
+ auto size = rs2_get_raw_data_size(list.get(), &e);
+ error::handle(e);
+
+ auto start = rs2_get_raw_data(list.get(), &e);
+
+ results.insert(results.begin(), start, start + size);
+
+ return results;
+ }
+
+ /**
+ * This will adjust camera absolute distance to flat target. User needs to enter the known ground truth.
+ * \param[in] ground_truth_mm Ground truth in mm must be between 2500 - 2000000
+ * \param[in] json_content Json string to configure tare calibration parameters:
+ {
+ "average step count": 20,
+ "step count": 20,
+ "accuracy": 2,
+ "scan parameter": 0,
+ "data sampling": 0
+ }
+ average step count - number of frames to average, must be between 1 - 30, default = 20
+ step count - max iteration steps, must be between 5 - 30, default = 10
+ accuracy - Subpixel accuracy level, value can be one of: Very high = 0 (0.025%), High = 1 (0.05%), Medium = 2 (0.1%), Low = 3 (0.2%), Default = Very high (0.025%), default is very high (0.025%)
+ scan_parameter - value can be one of: Py scan (default) = 0, Rx scan = 1
+ data_sampling - value can be one of:polling data sampling = 0, interrupt data sampling = 1
+ if json is nullptr it will be ignored and calibration will use the default parameters
+ * \param[in] content_size Json string size if its 0 the json will be ignored and calibration will use the default parameters
+ * \param[in] callback Optional callback to get progress notifications
+ * \param[in] timeout_ms Timeout in ms
+ * \return New calibration table
+ */
+ template
+ calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, T callback, int timeout_ms = 5000) const
+ {
+ std::vector results;
+
+ rs2_error* e = nullptr;
+ std::shared_ptr list(
+ rs2_run_tare_calibration_cpp(_dev.get(), ground_truth_mm, json_content.data(), int(json_content.size()), new update_progress_callback(std::move(callback)), timeout_ms, &e),
+ rs2_delete_raw_data);
+ error::handle(e);
+
+ auto size = rs2_get_raw_data_size(list.get(), &e);
+ error::handle(e);
+
+ auto start = rs2_get_raw_data(list.get(), &e);
+
+ results.insert(results.begin(), start, start + size);
+
+ return results;
+ }
+
+ /**
+ * This will adjust camera absolute distance to flat target. User needs to enter the known ground truth.
+ * \param[in] ground_truth_mm Ground truth in mm must be between 2500 - 2000000
+ * \param[in] json_content Json string to configure tare calibration parameters:
+ {
+ "average step count": 20,
+ "step count": 20,
+ "accuracy": 2,
+ "scan parameter": 0,
+ "data sampling": 0
+ }
+ average step count - number of frames to average, must be between 1 - 30, default = 20
+ step count - max iteration steps, must be between 5 - 30, default = 10
+ accuracy - Subpixel accuracy level, value can be one of: Very high = 0 (0.025%), High = 1 (0.05%), Medium = 2 (0.1%), Low = 3 (0.2%), Default = Very high (0.025%), default is very high (0.025%)
+ scan_parameter - value can be one of: Py scan (default) = 0, Rx scan = 1
+ data_sampling - value can be one of:polling data sampling = 0, interrupt data sampling = 1
+ if json is nullptr it will be ignored and calibration will use the default parameters
+ * \param[in] content_size Json string size if its 0 the json will be ignored and calibration will use the default parameters
+ * \param[in] timeout_ms Timeout in ms
+ * \return New calibration table
+ */
+ calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, int timeout_ms = 5000) const
+ {
+ std::vector results;
+
+ rs2_error* e = nullptr;
+ std::shared_ptr list(
+ rs2_run_tare_calibration_cpp(_dev.get(), ground_truth_mm, json_content.data(), static_cast< int >( json_content.size() ), nullptr, timeout_ms, &e),
+ rs2_delete_raw_data);
+ error::handle(e);
+
+ auto size = rs2_get_raw_data_size(list.get(), &e);
+ error::handle(e);
+
+ auto start = rs2_get_raw_data(list.get(), &e);
+
+ results.insert(results.begin(), start, start + size);
+
+ return results;
+ }
+
+ /**
+ * Read current calibration table from flash.
+ * \return Calibration table
+ */
+ calibration_table get_calibration_table()
+ {
+ std::vector results;
+
+ rs2_error* e = nullptr;
+ std::shared_ptr list(
+ rs2_get_calibration_table(_dev.get(), &e),
+ rs2_delete_raw_data);
+ error::handle(e);
+
+ auto size = rs2_get_raw_data_size(list.get(), &e);
+ error::handle(e);
+
+ auto start = rs2_get_raw_data(list.get(), &e);
+
+ results.insert(results.begin(), start, start + size);
+
+ return results;
+ }
+
+ /**
+ * Set current table to dynamic area.
+ * \param[in] Calibration table
+ */
+ void set_calibration_table(const calibration_table& calibration)
+ {
+ rs2_error* e = nullptr;
+ rs2_set_calibration_table(_dev.get(), calibration.data(), static_cast< int >( calibration.size() ), &e);
+ error::handle(e);
+ }
+
+
+ };
+
+ /*
+ Wrapper around any callback function that is given to calibration_change_callback.
+ */
+ template< class callback >
+ class calibration_change_callback : public rs2_calibration_change_callback
+ {
+ //using callback = std::function< void( rs2_calibration_status ) >;
+ callback _callback;
+ public:
+ calibration_change_callback( callback cb ) : _callback( cb ) {}
+
+ void on_calibration_change( rs2_calibration_status status ) noexcept override
+ {
+ _callback( status );
+ }
+ void release() override { delete this; }
+ };
+
+ class device_calibration : public device
+ {
+ public:
+ device_calibration( device d )
+ : device( d.get() )
+ {
+ rs2_error* e = nullptr;
+ if( rs2_is_device_extendable_to( _dev.get(), RS2_EXTENSION_DEVICE_CALIBRATION, &e ) == 0 && !e )
+ {
+ _dev.reset();
+ }
+ error::handle( e );
+ }
+
+ /*
+ Your callback should look like this, for example:
+ sensor.register_calibration_change_callback(
+ []( rs2_calibration_status ) noexcept
+ {
+ ...
+ })
+ */
+ template< typename T >
+ void register_calibration_change_callback( T callback )
+ {
+ // We wrap the callback with an interface and pass it to librealsense, who will
+ // now manage its lifetime. Rather than deleting it, though, it will call its
+ // release() function, where (back in our context) it can be safely deleted:
+ rs2_error* e = nullptr;
+ rs2_register_calibration_change_callback_cpp(
+ _dev.get(),
+ new calibration_change_callback< T >( std::move( callback )),
+ &e );
+ error::handle( e );
+ }
+
+ /**
+ * This will trigger the given calibration, if available
+ */
+ void trigger_device_calibration( rs2_calibration_type type )
+ {
+ rs2_error* e = nullptr;
+ rs2_trigger_device_calibration( _dev.get(), type, &e );
+ error::handle( e );
}
};
@@ -283,15 +729,26 @@ namespace rs2
return _list.get();
}
+ operator std::shared_ptr() { return _list; };
+
private:
std::shared_ptr _list;
};
- class tm2 : public device //TODO: add to wrappers
+ /**
+ * The tm2 class is an interface for T2XX devices, such as T265.
+ *
+ * For T265, it provides RS2_STREAM_FISHEYE (2), RS2_STREAM_GYRO, RS2_STREAM_ACCEL, and RS2_STREAM_POSE streams,
+ * and contains the following sensors:
+ *
+ * - pose_sensor: map and relocalization functions.
+ * - wheel_odometer: input for odometry data.
+ */
+ class tm2 : public calibrated_device // TODO: add to wrappers [Python done]
{
public:
tm2(device d)
- : device(d.get())
+ : calibrated_device(d)
{
rs2_error* e = nullptr;
if (rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_TM2, &e) == 0 && !e)
@@ -355,6 +812,61 @@ namespace rs2
rs2_disconnect_tm2_controller(_dev.get(), id, &e);
error::handle(e);
}
+
+ /**
+ * Set tm2 camera intrinsics
+ * \param[in] fisheye_senor_id The ID of the fisheye sensor
+ * \param[in] intrinsics value to be written to the device
+ */
+ void set_intrinsics(int fisheye_sensor_id, const rs2_intrinsics& intrinsics)
+ {
+ rs2_error* e = nullptr;
+ auto fisheye_sensor = get_sensor_profile(RS2_STREAM_FISHEYE, fisheye_sensor_id);
+ rs2_set_intrinsics(fisheye_sensor.first.get().get(), fisheye_sensor.second.get(), &intrinsics, &e);
+ error::handle(e);
+ }
+
+ /**
+ * Set tm2 camera extrinsics
+ * \param[in] from_stream only support RS2_STREAM_FISHEYE
+ * \param[in] from_id only support left fisheye = 1
+ * \param[in] to_stream only support RS2_STREAM_FISHEYE
+ * \param[in] to_id only support right fisheye = 2
+ * \param[in] extrinsics extrinsics value to be written to the device
+ */
+ void set_extrinsics(rs2_stream from_stream, int from_id, rs2_stream to_stream, int to_id, rs2_extrinsics& extrinsics)
+ {
+ rs2_error* e = nullptr;
+ auto from_sensor = get_sensor_profile(from_stream, from_id);
+ auto to_sensor = get_sensor_profile(to_stream, to_id);
+ rs2_set_extrinsics(from_sensor.first.get().get(), from_sensor.second.get(), to_sensor.first.get().get(), to_sensor.second.get(), &extrinsics, &e);
+ error::handle(e);
+ }
+
+ /**
+ * Set tm2 motion device intrinsics
+ * \param[in] stream_type stream type of the motion device
+ * \param[in] motion_intriniscs intrinsics value to be written to the device
+ */
+ void set_motion_device_intrinsics(rs2_stream stream_type, const rs2_motion_device_intrinsic& motion_intriniscs)
+ {
+ rs2_error* e = nullptr;
+ auto motion_sensor = get_sensor_profile(stream_type, 0);
+ rs2_set_motion_device_intrinsics(motion_sensor.first.get().get(), motion_sensor.second.get(), &motion_intriniscs, &e);
+ error::handle(e);
+ }
+
+ private:
+
+ std::pair get_sensor_profile(rs2_stream stream_type, int stream_index) {
+ for (auto s : query_sensors()) {
+ for (auto p : s.get_stream_profiles()) {
+ if (p.stream_type() == stream_type && p.stream_index() == stream_index)
+ return std::pair(s, p);
+ }
+ }
+ return std::pair();
+ }
};
}
#endif // LIBREALSENSE_RS2_DEVICE_HPP
diff --git a/libs/realsense2/include/librealsense2/hpp/rs_export.hpp b/libs/realsense2/include/librealsense2/hpp/rs_export.hpp
new file mode 100644
index 0000000..55f52f0
--- /dev/null
+++ b/libs/realsense2/include/librealsense2/hpp/rs_export.hpp
@@ -0,0 +1,390 @@
+// License: Apache 2.0. See LICENSE file in root directory.
+// Copyright(c) 2017 Intel Corporation. All Rights Reserved.
+
+#ifndef LIBREALSENSE_RS2_EXPORT_HPP
+#define LIBREALSENSE_RS2_EXPORT_HPP
+
+#include