Public Member Functions | Private Member Functions
rs::device Class Reference

Provides convenience methods relating to devices. More...

#include <rs.hpp>

List of all members.

Public Member Functions

void disable_motion_tracking (void)
 Disables events polling.
void disable_stream (stream stream)
 Disables specific stream.
void enable_motion_tracking (std::function< void(motion_data)> motion_handler, std::function< void(timestamp_data)> timestamp_handler)
 Sets callback for motion module event.
void enable_motion_tracking (std::function< void(motion_data)> motion_handler)
 Sets the callback for motion module event.
void enable_stream (stream stream, int width, int height, format format, int framerate, output_buffer_format output_buffer_type=output_buffer_format::continous)
 Enables specific stream and requests specific properties.
void enable_stream (stream stream, preset preset)
 Enables specific stream and requests properties using preset.
float get_depth_scale () const
 Retrieves mapping between units of depth image and meters.
extrinsics get_extrinsics (stream from_stream, stream to_stream) const
 Retrieves extrinsic transformation between viewpoints of two different streams.
const char * get_firmware_version () const
 Retrieves version of firmware currently installed on device.
const voidget_frame_data (stream stream) const
 Retrieves contents of latest frame on a stream.
unsigned long long get_frame_number (stream stream) const
 Retrieves frame number.
double get_frame_timestamp (stream stream) const
 Retrieves time at which the latest frame on a stream was captured.
const char * get_info (camera_info info) const
 Retrieves camera-specific information such as versions of various components.
extrinsics get_motion_extrinsics_from (stream from_stream) const
 Retrieves extrinsic transformation between viewpoints of specific stream and motion module.
motion_intrinsics get_motion_intrinsics () const
 Retrieves intrinsic camera parameters for motion module.
const char * get_name () const
 Retrieves human-readable device model string.
double get_option (option option)
 Retrieves current value of single option.
const char * get_option_description (option option)
 Retrieves device-specific option description.
void get_option_range (option option, double &min, double &max, double &step)
 Retrieves available range of values of supported option.
void get_option_range (option option, double &min, double &max, double &step, double &def)
 Retrieves available range of values of supported option.
void get_options (const option *options, size_t count, double *values)
 Efficiently retrieves value of arbitrary number of options, using minimal hardware IO.
const char * get_serial () const
 Retrieves unique serial number of device.
format get_stream_format (stream stream) const
 Retrieves pixel format for specific stream.
int get_stream_framerate (stream stream) const
 Retrieves frame rate for specific stream.
int get_stream_height (stream stream) const
 Retrieves height, in pixels, of a specific stream, equivalent to the height field from the stream's intrinsic.
intrinsics get_stream_intrinsics (stream stream) const
 Retrieves intrinsic camera parameters for specific stream.
void get_stream_mode (stream stream, int index, int &width, int &height, format &format, int &framerate) const
 Determines properties of specific streaming mode.
int get_stream_mode_count (stream stream) const
 Determines number of streaming modes available for given stream.
int get_stream_width (stream stream) const
 Retrieves width, in pixels, of a specific stream, equivalent to the width field from the stream's intrinsic.
const char * get_usb_port_id () const
 Retrieves USB port number of device.
int is_motion_tracking_active ()
 Checks if data acquisition is active.
bool is_stream_enabled (stream stream) const
 Determines if specific stream is enabled.
bool is_streaming () const
 Determines if device is currently streaming.
bool poll_for_frames ()
 Checks if new frames are available, without blocking.
void send_blob_to_device (rs::blob_type type, void *data, int size)
 Sends device-specific data to device.
void set_frame_callback (rs::stream stream, std::function< void(frame)> frame_handler)
 Sets callback for frame arrival event.
void set_option (option option, double value)
 Sets current value of single option.
void set_options (const option *options, size_t count, const double *values)
 Efficiently sets value of arbitrary number of options, using minimal hardware IO.
void start (rs::source source=rs::source::video)
 Begins streaming on all enabled streams for this device.
void stop (rs::source source=rs::source::video)
 Ends streaming on all streams for this device.
bool supports (capabilities capability) const
 Determines device capabilities.
bool supports (camera_info info_param) const
 Determines device capabilities.
bool supports_option (option option) const
 Determines if device allows specific option to be queried and set.
void wait_for_frames ()
 Blocks until new frames are available.

Private Member Functions

 device ()
 device (const device &)
deviceoperator= (const device &)
 ~device ()

Detailed Description

Provides convenience methods relating to devices.

Definition at line 567 of file rs.hpp.


Constructor & Destructor Documentation

rs::device::device ( ) [private]
rs::device::device ( const device ) [private]
rs::device::~device ( ) [private]

Member Function Documentation

Disables events polling.

Definition at line 861 of file rs.hpp.

void rs::device::disable_stream ( stream  stream) [inline]

Disables specific stream.

Parameters:
[in]streamStream

Definition at line 723 of file rs.hpp.

void rs::device::enable_motion_tracking ( std::function< void(motion_data)>  motion_handler,
std::function< void(timestamp_data)>  timestamp_handler 
) [inline]

Sets callback for motion module event.

The provided callback will be called the instant new motion or timestamp event is available. Note:

The rs_enable_motion_tracking_cpp() method is responsible for activating the motion module on-board the device. One of the services it provides is to produce shared and high-resolution timestamps for all components that are connected to it. For Depth, IR, Color and Fisheye sensors, librealsense takes care of that and copies the timestamps on the relevant frames.

However, when you have an external device (such as a compass, magnetometer, light sensor, or other) and wish to synchronize it precisely with image and motion streams, you can connect that sensor to a GPIO that is available on some devices. Every time the sensor signals, you get a timestamp callback with a frame number, source ID, and a timestamp. This timestamp callback allows advanced users to synchronize compass events (presumably coming though I2C or some other method) with RealSense data.

Parameters:
[in]motion_handlerFrame callback to be invoke on every new motion event
[in]timestamp_handlerFrame callback to be invoke on every new timestamp event (can be left-out)
Returns:
Frame rate of the stream, in frames per second

Definition at line 841 of file rs.hpp.

void rs::device::enable_motion_tracking ( std::function< void(motion_data)>  motion_handler) [inline]

Sets the callback for motion module event.

The provided callback will be called the instant new motion event is available.

Parameters:
[in]motion_handlerFrame callback to be invokes on every new motion event
Returns:
Frame rate of the stream, in frames per second

Definition at line 853 of file rs.hpp.

void rs::device::enable_stream ( stream  stream,
int  width,
int  height,
format  format,
int  framerate,
output_buffer_format  output_buffer_type = output_buffer_format::continous 
) [inline]

Enables specific stream and requests specific properties.

Parameters:
[in]streamStream
[in]widthDesired width of frame image in pixels, or 0 if any width is acceptable
[in]heightDesired height of frame image in pixels, or 0 if any height is acceptable
[in]formatPixel format of frame image, or ANY if any format is acceptable
[in]framerateNumber of frames that will be streamed per second, or 0 if any frame rate is acceptable
[in]output_buffer_typeoutput buffer format (continous in memory / native with pitch)

Definition at line 704 of file rs.hpp.

void rs::device::enable_stream ( stream  stream,
preset  preset 
) [inline]

Enables specific stream and requests properties using preset.

Parameters:
[in]streamStream to enable
[in]presetPreset to use to enable the stream

Definition at line 714 of file rs.hpp.

float rs::device::get_depth_scale ( ) const [inline]

Retrieves mapping between units of depth image and meters.

Returns:
Depth in meters corresponding to a depth value of 1

Definition at line 653 of file rs.hpp.

extrinsics rs::device::get_extrinsics ( stream  from_stream,
stream  to_stream 
) const [inline]

Retrieves extrinsic transformation between viewpoints of two different streams.

Parameters:
[in]from_streamStream whose coordinate space to transform from
[in]to_streamStream whose coordinate space to transform to
Returns:
Transformation between two streams

Definition at line 630 of file rs.hpp.

const char* rs::device::get_firmware_version ( ) const [inline]

Retrieves version of firmware currently installed on device.

Returns:
Firmware version string, in a format that is specific to device model

Definition at line 608 of file rs.hpp.

const void* rs::device::get_frame_data ( stream  stream) const [inline]

Retrieves contents of latest frame on a stream.

Parameters:
[in]streamStream
Returns:
Pointer to start of frame data

Definition at line 1050 of file rs.hpp.

unsigned long long rs::device::get_frame_number ( stream  stream) const [inline]

Retrieves frame number.

Parameters:
[in]streamStream of interest
Returns:
Number of frame since device was started

Definition at line 1039 of file rs.hpp.

double rs::device::get_frame_timestamp ( stream  stream) const [inline]

Retrieves time at which the latest frame on a stream was captured.

Parameters:
[in]streamStream of interest
Returns:
Timestamp of frame, in milliseconds since the device was started

Definition at line 1028 of file rs.hpp.

const char* rs::device::get_info ( camera_info  info) const [inline]

Retrieves camera-specific information such as versions of various components.

Returns:
Camera info string, in a format that is specific to device model

Definition at line 618 of file rs.hpp.

extrinsics rs::device::get_motion_extrinsics_from ( stream  from_stream) const [inline]

Retrieves extrinsic transformation between viewpoints of specific stream and motion module.

Parameters:
[in]from_streamStream whose coordinate space to transform from
Returns:
Transformation between specific stream and motion module

Definition at line 642 of file rs.hpp.

Retrieves intrinsic camera parameters for motion module.

Returns:
Intrinsic parameters

Definition at line 799 of file rs.hpp.

const char* rs::device::get_name ( ) const [inline]

Retrieves human-readable device model string.

Returns:
Model string, such as "Intel RealSense F200" or "Intel RealSense R200"

Definition at line 578 of file rs.hpp.

double rs::device::get_option ( option  option) [inline]

Retrieves current value of single option.

Parameters:
[in]optionOption
Returns:
Option value

Definition at line 954 of file rs.hpp.

const char* rs::device::get_option_description ( option  option) [inline]

Retrieves device-specific option description.

Parameters:
[in]optionOption
Returns:
Option value

Definition at line 965 of file rs.hpp.

void rs::device::get_option_range ( option  option,
double &  min,
double &  max,
double &  step 
) [inline]

Retrieves available range of values of supported option.

Parameters:
[in]optionOption
[out]minMinimum value that is acceptable for this option
[out]maxMaximum value that is acceptable for this option
[out]stepGranularity of options that accept discrete values, or zero if the option accepts continuous values

Definition at line 909 of file rs.hpp.

void rs::device::get_option_range ( option  option,
double &  min,
double &  max,
double &  step,
double &  def 
) [inline]

Retrieves available range of values of supported option.

Parameters:
[in]optionOption
[out]minMinimum value that is acceptable for this option
[out]maxMaximum value that is acceptable for this option
[out]stepGranularity of options that accept discrete values, or zero if the option accepts continuous values
[out]defDefault value of the option

Definition at line 922 of file rs.hpp.

void rs::device::get_options ( const option options,
size_t  count,
double *  values 
) [inline]

Efficiently retrieves value of arbitrary number of options, using minimal hardware IO.

Parameters:
[in]optionsArray of options that should be queried
[in]countLength of options and values arrays
[out]valuesArray that receives the values of the queried options

Definition at line 933 of file rs.hpp.

const char* rs::device::get_serial ( ) const [inline]

Retrieves unique serial number of device.

Returns:
Serial number, in a format specific to the device model

Definition at line 588 of file rs.hpp.

format rs::device::get_stream_format ( stream  stream) const [inline]

Retrieves pixel format for specific stream.

Parameters:
[in]streamStream
Returns:
Pixel format of the stream

Definition at line 766 of file rs.hpp.

int rs::device::get_stream_framerate ( stream  stream) const [inline]

Retrieves frame rate for specific stream.

Parameters:
[in]streamStream
Returns:
Frame rate of the stream, in frames per second

Definition at line 777 of file rs.hpp.

int rs::device::get_stream_height ( stream  stream) const [inline]

Retrieves height, in pixels, of a specific stream, equivalent to the height field from the stream's intrinsic.

Parameters:
[in]streamStream
Returns:
Height, in pixels of images from this stream

Definition at line 755 of file rs.hpp.

Retrieves intrinsic camera parameters for specific stream.

Parameters:
[in]streamStream
Returns:
Intrinsic parameters of the stream

Definition at line 788 of file rs.hpp.

void rs::device::get_stream_mode ( stream  stream,
int  index,
int width,
int height,
format format,
int framerate 
) const [inline]

Determines properties of specific streaming mode.

Parameters:
[in]streamStream whose mode will be queried
[in]indexZero-based index of streaming mode
[out]widthWidth of a frame image in pixels
[out]heightHeight of a frame image in pixels
[out]formatPixel format of a frame image
[out]framerateNumber of frames that will be streamed per second

Definition at line 690 of file rs.hpp.

int rs::device::get_stream_mode_count ( stream  stream) const [inline]

Determines number of streaming modes available for given stream.

Parameters:
[in]streamStream whose modes will be enumerated
Returns:
Count of available modes

Definition at line 675 of file rs.hpp.

int rs::device::get_stream_width ( stream  stream) const [inline]

Retrieves width, in pixels, of a specific stream, equivalent to the width field from the stream's intrinsic.

Parameters:
[in]streamStream
Returns:
Width, in pixels of images from this stream

Definition at line 744 of file rs.hpp.

const char* rs::device::get_usb_port_id ( ) const [inline]

Retrieves USB port number of device.

Returns:
USB port number, in a format that is specific to device model

Definition at line 598 of file rs.hpp.

Checks if data acquisition is active.

Definition at line 869 of file rs.hpp.

bool rs::device::is_stream_enabled ( stream  stream) const [inline]

Determines if specific stream is enabled.

Parameters:
[in]streamStream to check
Returns:
true if the stream is currently enabled

Definition at line 733 of file rs.hpp.

bool rs::device::is_streaming ( ) const [inline]

Determines if device is currently streaming.

Returns:
true if device is currently streaming

Definition at line 896 of file rs.hpp.

device& rs::device::operator= ( const device ) [private]
bool rs::device::poll_for_frames ( ) [inline]

Checks if new frames are available, without blocking.

Returns:
true if new frames are available; false if no new frames have arrived.

Definition at line 994 of file rs.hpp.

void rs::device::send_blob_to_device ( rs::blob_type  type,
void data,
int  size 
) [inline]

Sends device-specific data to device.

Parameters:
[in]typeType of raw data to send to the device
[in]dataRaw data pointer to send
[in]sizeSize, in bytes of the raw data to send

Definition at line 1062 of file rs.hpp.

void rs::device::set_frame_callback ( rs::stream  stream,
std::function< void(frame)>  frame_handler 
) [inline]

Sets callback for frame arrival event.

The provided callback will be called the instant new frame of given stream becomes available once callback is set on certain stream type, frames of this type will no longer be available throuhg wait/poll methods (those two approaches are mutually exclusive) while wait/poll methods provide consistent set of syncronized frames at the expense of extra latency, set frame callbacks provides low latency solution with no syncronization

Parameters:
[in]streamStream
[in]frame_handlerFrame callback to be invoked on every new frame
Returns:
Frame rate of the stream, in frames per second

Definition at line 817 of file rs.hpp.

void rs::device::set_option ( option  option,
double  value 
) [inline]

Sets current value of single option.

Parameters:
[in]optionOption
[in]valueOption value

Definition at line 976 of file rs.hpp.

void rs::device::set_options ( const option options,
size_t  count,
const double *  values 
) [inline]

Efficiently sets value of arbitrary number of options, using minimal hardware IO.

Parameters:
[in]optionsArray of options that should be set
[in]countLength of options and values arrays
[in]valuesArray of values to which the options should be set

Definition at line 944 of file rs.hpp.

void rs::device::start ( rs::source  source = rs::source::video) [inline]

Begins streaming on all enabled streams for this device.

Definition at line 879 of file rs.hpp.

void rs::device::stop ( rs::source  source = rs::source::video) [inline]

Ends streaming on all streams for this device.

Definition at line 887 of file rs.hpp.

bool rs::device::supports ( capabilities  capability) const [inline]

Determines device capabilities.

Parameters:
[in]capabilityCapability to check
Returns:
true if device has this capability

Definition at line 1005 of file rs.hpp.

bool rs::device::supports ( camera_info  info_param) const [inline]

Determines device capabilities.

Parameters:
[in]info_paramCapability to check for support
Returns:
true if device has this capability

Definition at line 1017 of file rs.hpp.

bool rs::device::supports_option ( option  option) const [inline]

Determines if device allows specific option to be queried and set.

Parameters:
[in]optionOption to check
Returns:
true if the option can be queried and set

Definition at line 664 of file rs.hpp.

Blocks until new frames are available.

Definition at line 985 of file rs.hpp.


The documentation for this class was generated from the following file:


librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Tue Jun 25 2019 19:54:41