-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pipeline changes #672
Merged
Merged
Pipeline changes #672
Conversation
This file contains 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
dorodnic
reviewed
Oct 2, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please bump version to 2.8.0
and merge with dev branch
CMake/realsense.def
Outdated
rs2_pipeline_get_stream_type_selection | ||
rs2_delete_pipeline | ||
|
||
rs2_create_pipeline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use spaces
…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.
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
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, thepipeline
remains 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
start
function now returns ars2::pipeline_profile
which represents the profile that the pipeline chose to start the device with:Getting the device and active streams
Using the
rs2::pipeline_profile
we can get thers2::device
andrs2::stream_profile
s:The
rs2::pipeline_profile
can also be retrieved from an already startedpipeline
by calling theget_active_profile
function://pipe.start(); rs2::pipeline_profile profile = pipe.get_active_profile();
Getting Frames
In order to get frames from an active
rs2::pipeline
we have 2 methods:Blocking
rs2::pipeline pipe; pipe.start(); rs2::frameset frames = pipe.wait_for_frames(); //Blocking call
Non Blocking
Configuring the pipeline
The new API provides the
rs2::config
class that enablespipeline
users 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
pipeline
has an overload for thestart
function that takes ars2::config
:Passing this default configuration to the
pipeline::start
method is equivalent to calling thepipeline::start
without any parameters.Adding constraints to the configuraion
The
rs2::config
class has a number of functions that allow users to add constrains on thepipeline
Selecting a certain stream
To enable a specific stream, simply call the
rs2::config::enable_stream
function with the desired stream:The above will indicate that the user is requesting the
pipeline
to 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:
rs2::config cfg; cfg.enable_stream(RS2_STREAM_INFRARED, 1); rs2::pipeline pipe; pipe.start(cfg);
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_stream
has 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::config
allows 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::config
provides 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::config
to try to resolve and return thers2::pipeline_profile
that will be used if that configuration were to be passed topipeline::start
: