Pipeline changes - #672
Merged
Merged
Pipeline changes#672
Conversation
dorodnic
reviewed
Oct 2, 2017
dorodnic
left a comment
Contributor
There was a problem hiding this comment.
Please bump version to 2.8.0
and merge with dev branch
| rs2_pipeline_get_stream_type_selection | ||
| rs2_delete_pipeline | ||
|
|
||
| rs2_create_pipeline |
…d align sample and documentation. Removed "get" functions from pipeline APIs. fixed rs2_pipeline_start. Mosts Samples work. WIP - still has to handle configuration requests, not working with this commit.
…t, implemented get_active_streams for profile
Fixed multicam sample. Added readonly_device_info to allow creation of device info from a device. Fxied rs2_device_hub_wait_for_device() to return correct device info, same for pipeline_profile_get_device
…ensors. Fixed pipeline destructor. Fixed data collect tool to work with new pipeline
added can resolve. allowed empty rs2::pipeline_profile, to allow definition without intialization. Implemented create_matcher for playback device as identity_matcher. Fixed missing implementation of get_device_data for record and playback devices.
…rd to config (rs2_config_enable_record_to_file), and split start to 2 starts - no params and with config. Fixed librealsense::config so that stream index wildcard is "-1" instead of 0. Updated pipeline behavior to find playback file before loading it. use last resolved profile. updated samples to compile
Added validation for poll_for_frames paramter
Added overloads to enable_streams
Updated python sample
Fixed indentation for realsense.def Updated pipe doc
Added try/catch for context's device_change callback Added explicit device destructor to destroy all sensor before other members. W/A for deadlock on sensor destruction from within frame callback on syncer. Fixed tests.
zivsha
force-pushed
the
pipeline_changes
branch
from
October 3, 2017 17:47
5c5a787 to
26d95e4
Compare
…frame to prevent exception in case of device destruction prior to sensor destructions
dorodnic
approved these changes
Oct 4, 2017
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Comprehensive API refactoring of pipeline.
Split pipeline functionality into 3 classes: config, profile, pipeline.
Updated all samples, tools and tests to new API.
Previous API had a single class that encapsulated all capabilities, of both configuring, selecting and streaming with
rs2::pipeline. These capabilities have been split apart now for the simplest use, without any configuration requirements, thepipelineremains similar to before.rs2::config- responsible for configuration constraintsrs2::pipeline_profile- stateless object representing the device and streams of the pipeline (or of the resolved configuration)rs2::pipeline- facade for streaming over RealSense devices and in the future also managing computer vision modules.Pipeline API usage
Pipeline Creation
Starting streaming with default configuration:
The
startfunction now returns ars2::pipeline_profilewhich represents the profile that the pipeline chose to start the device with:Getting the device and active streams
Using the
rs2::pipeline_profilewe can get thers2::deviceandrs2::stream_profiles:The
rs2::pipeline_profilecan also be retrieved from an already startedpipelineby calling theget_active_profilefunction://pipe.start(); rs2::pipeline_profile profile = pipe.get_active_profile();Getting Frames
In order to get frames from an active
rs2::pipelinewe have 2 methods:Blocking
rs2::pipeline pipe; pipe.start(); rs2::frameset frames = pipe.wait_for_frames(); //Blocking callNon Blocking
Configuring the pipeline
The new API provides the
rs2::configclass that enablespipelineusers to add constraints on which device and/or which streams that pipeline will use.Creating a default configuration
This will create a default configuration object that has no constraints.
The
pipelinehas an overload for thestartfunction that takes ars2::config:Passing this default configuration to the
pipeline::startmethod is equivalent to calling thepipeline::startwithout any parameters.Adding constraints to the configuraion
The
rs2::configclass has a number of functions that allow users to add constrains on thepipelineSelecting a certain stream
To enable a specific stream, simply call the
rs2::config::enable_streamfunction with the desired stream:rs2::config cfg; cfg.enable_stream(RS2_STREAM_DEPTH); rs2::pipeline pipe; pipe.start(cfg);The above will indicate that the user is requesting the
pipelineto start with a device that provides a depth stream.If a certain device has a sensor that provides more than one stream of the same type, it is possible by passing a stream type and a corresponding stream index:
This will indicate that the user wants IR #1 to be streaming, and not just any IR stream.
Selecting a certain resolution / FPS / Format
The
rs2::config::enable_streamhas several overloads which allows users to easily specify a certain resolution, frame rate and/or format. In any case, the stream type is required to be specified.This will indicate that the user wants a color stream with a FHD resolution.
Selecting a specific device
The
rs2::configallows users to indicate which specific device they want to use.Selecting device by serial number
If you know the serial number of the device you wish to use, you can specify it to
enable_device:Selecting a device from file (playback)
rs2::config cfg; cfg.enable_device_from_file("my_recorded_file.bag"); rs2::pipeline pipe; pipe.start(cfg);Enabling recording to file
The configuration object can be used to indicate that the device which will be selected should be recorded to file. To allow this, simply call:
Testing a configuration
In order to allow users with means of testing whether the constraints on a configuration are valid the
rs2::configprovides two methods of resolution:bool rs2::config::can_resolve(...)- returns true if and only if a valid resolution can be made.rs2::pipeline_profile rs2::config::resolve(...)- Throws an exception on failure, returns the profile that will be chosen by the pipeline in case of successful resolution.The first function simply indicates if the configuration is valid. This use case will be common if your application programmatically tries to create a valid
rs2::config:The second option is request the
rs2::configto try to resolve and return thers2::pipeline_profilethat will be used if that configuration were to be passed topipeline::start: