Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
Public Member Functions | List of all members
rs::device Class Reference

#include <rs.hpp>

Public Member Functions

const char * get_name () const
 
const char * get_serial () const
 
const char * get_usb_port_id () const
 
const char * get_firmware_version () const
 
const char * get_info (camera_info info) const
 
extrinsics get_extrinsics (stream from_stream, stream to_stream) const
 
extrinsics get_motion_extrinsics_from (stream from_stream) const
 
float get_depth_scale () const
 
bool supports_option (option option) const
 
int get_stream_mode_count (stream stream) const
 
void get_stream_mode (stream stream, int index, int &width, int &height, format &format, int &framerate) const
 
void enable_stream (stream stream, int width, int height, format format, int framerate, output_buffer_format output_buffer_type=output_buffer_format::continous)
 
void enable_stream (stream stream, preset preset)
 
void disable_stream (stream stream)
 
bool is_stream_enabled (stream stream) const
 
int get_stream_width (stream stream) const
 
int get_stream_height (stream stream) const
 
format get_stream_format (stream stream) const
 
int get_stream_framerate (stream stream) const
 
intrinsics get_stream_intrinsics (stream stream) const
 
motion_intrinsics get_motion_intrinsics () const
 
void set_frame_callback (rs::stream stream, std::function< void(frame)> frame_handler)
 
void enable_motion_tracking (std::function< void(motion_data)> motion_handler, std::function< void(timestamp_data)> timestamp_handler)
 
void enable_motion_tracking (std::function< void(motion_data)> motion_handler)
 
void disable_motion_tracking (void)
 disable events polling More...
 
int is_motion_tracking_active ()
 check if data acquisition is active More...
 
void start (rs::source source=rs::source::video)
 begin streaming on all enabled streams for this device More...
 
void stop (rs::source source=rs::source::video)
 end streaming on all streams for this device More...
 
bool is_streaming () const
 
void get_option_range (option option, double &min, double &max, double &step)
 
void get_option_range (option option, double &min, double &max, double &step, double &def)
 
void get_options (const option *options, size_t count, double *values)
 
void set_options (const option *options, size_t count, const double *values)
 
double get_option (option option)
 
const char * get_option_description (option option)
 
void set_option (option option, double value)
 
void wait_for_frames ()
 
bool poll_for_frames ()
 
bool supports (capabilities capability) const
 
bool supports (camera_info info_param) const
 
double get_frame_timestamp (stream stream) const
 
unsigned long long get_frame_number (stream stream) const
 
const void * get_frame_data (stream stream) const
 
void send_blob_to_device (rs::blob_type type, void *data, int size)
 

Member Function Documentation

◆ disable_motion_tracking()

void rs::device::disable_motion_tracking ( void  )
inline

disable events polling

◆ disable_stream()

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

disable a specific stream

Parameters
[in]streamthe stream to disable

◆ enable_motion_tracking() [1/2]

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

sets the callback for motion module event. provided callback will be called the instant new motion or timestamp event is available. Note: rs_enable_motion_tracking is responsible for activating the motion module on-board the device. One of the services it provides is producing shared and high-resolution timestamps for all component hooked-up to it. Usually, librealsense takes care of that and copies the timestamps to the relevant frames. However, when the user has an external device(like a compass) and wishes to synchronize it precisely with image and motion stream he can connect the sensor to a GPIO avaialbe on some devices. Every time sensor will signal, the user will get a timestamp callback with a frame number, source ID and a timestamp. This would allow advanced user to synchronize his compass events(presumably coming though I2C or some other method) with realsense data.

Parameters
[in]streamthe stream
[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
the framerate of the stream, in frames per second

◆ enable_motion_tracking() [2/2]

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

sets the callback for motion module event. provided callback will be called the instant new motion event is available.

Parameters
[in]streamthe stream
[in]motion_handlerframe callback to be invoke on every new motion event
Returns
the framerate of the stream, in frames per second

◆ enable_stream() [1/2]

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

enable a specific stream and request specific properties

Parameters
[in]streamthe stream to enable
[in]widththe desired width of a frame image in pixels, or 0 if any width is acceptable
[in]heightthe desired height of a frame image in pixels, or 0 if any height is acceptable
[in]formatthe pixel format of a frame image, or ANY if any format is acceptable
[in]frameratethe number of frames which will be streamed per second, or 0 if any framerate is acceptable
[in]output_buffer_typeoutput buffer format (continous in memory / native with pitch)

◆ enable_stream() [2/2]

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

enable a specific stream and request properties using a preset

Parameters
[in]streamthe stream to enable
[in]presetthe preset to use to enable the stream

◆ get_depth_scale()

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

retrieve mapping between the units of the depth image and meters

Returns
depth in meters corresponding to a depth value of 1

◆ get_extrinsics()

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

retrieve extrinsic transformation between the viewpoints of two different streams

Parameters
[in]from_streamstream whose coordinate space we will transform from
[in]to_streamstream whose coordinate space we will transform to
Returns
the transformation between the two streams

◆ get_firmware_version()

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

retrieve the version of the firmware currently installed on the device

Returns
firmware version string, in a format is specific to device model

◆ get_frame_data()

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

retrieve the contents of the latest frame on a stream

Parameters
[in]streamthe stream whose latest frame we are interested in
Returns
the pointer to the start of the frame data

◆ get_frame_number()

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

retrieve the frame number

Parameters
[in]streamthe stream whose latest frame we are interested in
Returns
the number of the frame, since the device was started

◆ get_frame_timestamp()

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

retrieve the time at which the latest frame on a stream was captured

Parameters
[in]streamthe stream whose latest frame we are interested in
Returns
the timestamp of the frame, in milliseconds since the device was started

◆ get_info()

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

retrieve camera specific information like the versions of the various componnents

Returns
camera info string, in a format specific to the device model

◆ get_motion_extrinsics_from()

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

retrieve extrinsic transformation between the viewpoints of specific stream and the motion module

Parameters
[in]from_streamstream whose coordinate space we will transform from
Returns
the transformation between the specific stream and motion module

◆ get_motion_intrinsics()

motion_intrinsics rs::device::get_motion_intrinsics ( ) const
inline

retrieve intrinsic camera parameters for the motion module

Returns
the intrinsic parameters of the stream

◆ get_name()

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

retrieve a human readable device model string

Returns
the model string, such as "Intel RealSense F200" or "Intel RealSense R200"

◆ get_option()

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

retrieve the current value of a single option

Parameters
[in]optionthe option whose value should be retrieved
Returns
the value of the option

◆ get_option_description()

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

retrieve the device specific option description

Parameters
[in]optionthe option whose description should be retrieved
Returns
the value of the option

◆ get_option_range() [1/2]

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

retrieve the available range of values of a supported option

Parameters
[in]optionthe option whose range should be queried
[out]minthe minimum value which will be accepted for this option
[out]maxthe maximum value which will be accepted for this option
[out]stepthe granularity of options which accept discrete values, or zero if the option accepts continuous values

◆ get_option_range() [2/2]

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

retrieve the available range of values of a supported option

Parameters
[in]optionthe option whose range should be queried
[out]minthe minimum value which will be accepted for this option
[out]maxthe maximum value which will be accepted for this option
[out]stepthe granularity of options which accept discrete values, or zero if the option accepts continuous values
[out]defthe default value of the option

◆ get_options()

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

efficiently retrieve the value of an arbitrary number of options, using minimal hardware IO

Parameters
[in]optionsthe array of options which should be queried
[in]countthe length of the options and values arrays
[out]valuesthe array which will receive the values of the queried options

◆ get_serial()

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

retrieve the unique serial number of the device

Returns
the serial number, in a format specific to the device model

◆ get_stream_format()

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

retrieve the pixel format for a specific stream

Parameters
[in]streamthe stream whose format to retrieve
Returns
the pixel format of the stream

◆ get_stream_framerate()

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

retrieve the framerate for a specific stream

Parameters
[in]streamthe stream whose framerate to retrieve
Returns
the framerate of the stream, in frames per second

◆ get_stream_height()

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

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

Parameters
[in]streamthe stream whose height to retrieve
Returns
the height in pixels of images from this stream

◆ get_stream_intrinsics()

intrinsics rs::device::get_stream_intrinsics ( stream  stream) const
inline

retrieve intrinsic camera parameters for a specific stream

Parameters
[in]streamthe stream whose parameters to retrieve
Returns
the intrinsic parameters of the stream

◆ get_stream_mode()

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

determine the properties of a specific streaming mode

Parameters
[in]streamthe stream whose mode will be queried
[in]indexthe zero based index of the streaming mode
[out]widththe width of a frame image in pixels
[out]heightthe height of a frame image in pixels
[out]formatthe pixel format of a frame image
[out]frameratethe number of frames which will be streamed per second

◆ get_stream_mode_count()

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

determine the number of streaming modes available for a given stream

Parameters
[in]streamthe stream whose modes will be enumerated
Returns
the count of available modes

◆ get_stream_width()

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

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

Parameters
[in]streamthe stream whose width to retrieve
Returns
the width in pixels of images from this stream

◆ get_usb_port_id()

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

retrieve the USB port number of the device

Returns
the USB port number, in a format specific to the device model

◆ is_motion_tracking_active()

int rs::device::is_motion_tracking_active ( )
inline

check if data acquisition is active

◆ is_stream_enabled()

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

determine if a specific stream is enabled

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

◆ is_streaming()

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

determine if the device is currently streaming

Returns
true if the device is currently streaming

◆ poll_for_frames()

bool rs::device::poll_for_frames ( )
inline

check if new frames are available, without blocking

Returns
true if new frames are available, false if no new frames have arrived

◆ send_blob_to_device()

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

send device specific data to the device

Parameters
[in]typedescribes the content of the memory buffer, how it will be interpreted by the device
[in]dataraw data buffer to be sent to the device
[in]sizesize in bytes of the buffer

◆ set_frame_callback()

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

sets the callback for frame arrival event. 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]streamthe stream
[in]on_frameframe callback to be invoke on every new frame
Returns
the framerate of the stream, in frames per second

◆ set_option()

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

set the current value of a single option

Parameters
[in]optionthe option whose value should be set
[in]valuethe value of the option

◆ set_options()

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

efficiently set the value of an arbitrary number of options, using minimal hardware IO

Parameters
[in]optionsthe array of options which should be set
[in]countthe length of the options and values arrays
[in]valuesthe array of values to which the options should be set

◆ start()

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

begin streaming on all enabled streams for this device

◆ stop()

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

end streaming on all streams for this device

◆ supports() [1/2]

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

determine device capabilities

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

◆ supports() [2/2]

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

determine device capabilities

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

◆ supports_option()

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

determine if the device allows a specific option to be queried and set

Parameters
[in]optionthe option to check for support
Returns
true if the option can be queried and set

◆ wait_for_frames()

void rs::device::wait_for_frames ( )
inline

block until new frames are available


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