Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
mrpt::hwdrivers::COpenNI2Generic Class Reference

Detailed Description

An abstract class for accessing OpenNI2 compatible sensors.

This class permits to access several sensors simultaneously. The same options (resolution, fps, etc.) are used for every sensor.

More references to read:

Definition at line 28 of file COpenNI2Generic.h.

#include <mrpt/hwdrivers/COpenNI2Generic.h>

Inheritance diagram for mrpt::hwdrivers::COpenNI2Generic:
Inheritance graph

Public Member Functions

 COpenNI2Generic ()
 Default ctor.
 
 ~COpenNI2Generic ()
 Default ctor.
 
int getConnectedDevices ()
 Get a list of the connected OpenNI2 sensors.
 
void kill ()
 Kill the OpenNI2 driver.
 
void getNextFrameRGB (mrpt::utils::CImage &rgb_img, uint64_t &timestamp, bool &there_is_obs, bool &hardware_error, unsigned sensor_id=0)
 The main data retrieving function, to be called after calling loadConfig() and initialize().
 
void getNextFrameD (mrpt::math::CMatrix &depth_img, uint64_t &timestamp, bool &there_is_obs, bool &hardware_error, unsigned sensor_id=0)
 The main data retrieving function, to be called after calling loadConfig() and initialize().
 
void getNextFrameRGBD (mrpt::obs::CObservation3DRangeScan &out_obs, bool &there_is_obs, bool &hardware_error, unsigned sensor_id=0)
 The main data retrieving function, to be called after calling loadConfig() and initialize().
 
void setVerbose (bool verbose)
 
bool isVerbose () const
 
Sensor parameters (alternative to \a loadConfig ) and manual control
void open (unsigned sensor_id=0)
 Try to open the camera (all the parameters [resolution,fps,...] must be set before calling this) - users may also call initialize(), which in turn calls this method.
 
unsigned int openDevicesBySerialNum (const std::set< unsigned > &vSerialRequired)
 Open a set of RGBD devices specified by their serial number.
 
unsigned int openDeviceBySerial (const unsigned int SerialRequired)
 Open a RGBD device specified by its serial number.
 
bool getDeviceIDFromSerialNum (const unsigned int SerialRequired, int &sensor_id) const
 Get the ID of the device corresponding to 'SerialRequired'.
 
bool isOpen (const unsigned sensor_id) const
 Check if the given 'sensor_id' has been open.
 
void close (unsigned sensor_id=0)
 Close the conection to the sensor (not need to call it manually unless desired for some reason, since it's called at destructor)
 
int getNumDevices () const
 The amount of available devices at initialization.
 

Protected Member Functions

bool getColorSensorParam (mrpt::utils::TCamera &param, unsigned sensor_id=0) const
 
bool getDepthSensorParam (mrpt::utils::TCamera &param, unsigned sensor_id=0) const
 
void showLog (const std::string &message) const
 

Protected Attributes

std::vector< int > vSerialNums
 A vector with the serial numbers of the available devices.
 
int m_width
 The same options (width, height and fps) are set for all the sensors.
 
int m_height
 
float m_fps
 
int m_rgb_format
 
int m_depth_format
 
bool m_verbose
 
bool m_grab_image
 The data that the RGBD sensors can return.
 
bool m_grab_depth
 
bool m_grab_3D_points
 Default: all true.
 

Static Protected Attributes

static std::vector< stlplus::smart_ptr< CDevice > > vDevices
 
static int numInstances
 

Constructor & Destructor Documentation

◆ COpenNI2Generic()

mrpt::hwdrivers::COpenNI2Generic::COpenNI2Generic ( )

Default ctor.

◆ ~COpenNI2Generic()

mrpt::hwdrivers::COpenNI2Generic::~COpenNI2Generic ( )

Default ctor.

Member Function Documentation

◆ close()

void mrpt::hwdrivers::COpenNI2Generic::close ( unsigned  sensor_id = 0)

Close the conection to the sensor (not need to call it manually unless desired for some reason, since it's called at destructor)

◆ getColorSensorParam()

bool mrpt::hwdrivers::COpenNI2Generic::getColorSensorParam ( mrpt::utils::TCamera param,
unsigned  sensor_id = 0 
) const
protected

◆ getConnectedDevices()

int mrpt::hwdrivers::COpenNI2Generic::getConnectedDevices ( )

Get a list of the connected OpenNI2 sensors.

◆ getDepthSensorParam()

bool mrpt::hwdrivers::COpenNI2Generic::getDepthSensorParam ( mrpt::utils::TCamera param,
unsigned  sensor_id = 0 
) const
protected

◆ getDeviceIDFromSerialNum()

bool mrpt::hwdrivers::COpenNI2Generic::getDeviceIDFromSerialNum ( const unsigned int  SerialRequired,
int &  sensor_id 
) const

Get the ID of the device corresponding to 'SerialRequired'.

◆ getNextFrameD()

void mrpt::hwdrivers::COpenNI2Generic::getNextFrameD ( mrpt::math::CMatrix depth_img,
uint64_t &  timestamp,
bool &  there_is_obs,
bool &  hardware_error,
unsigned  sensor_id = 0 
)

The main data retrieving function, to be called after calling loadConfig() and initialize().

Parameters
depth_imgThe output retrieved depth image (only if there_is_obs=true).
timestampThe timestamp of the capture (only if there_is_obs=true).
there_is_obsIf set to false, there was no new observation.
hardware_errorTrue on hardware/comms error.
sensor_idThe index of the sensor accessed.

◆ getNextFrameRGB()

void mrpt::hwdrivers::COpenNI2Generic::getNextFrameRGB ( mrpt::utils::CImage rgb_img,
uint64_t &  timestamp,
bool &  there_is_obs,
bool &  hardware_error,
unsigned  sensor_id = 0 
)

The main data retrieving function, to be called after calling loadConfig() and initialize().

Parameters
out_imgThe output retrieved RGB image (only if there_is_obs=true).
timestampThe timestamp of the capture (only if there_is_obs=true).
there_is_obsIf set to false, there was no new observation.
hardware_errorTrue on hardware/comms error.
sensor_idThe index of the sensor accessed.

◆ getNextFrameRGBD()

void mrpt::hwdrivers::COpenNI2Generic::getNextFrameRGBD ( mrpt::obs::CObservation3DRangeScan out_obs,
bool &  there_is_obs,
bool &  hardware_error,
unsigned  sensor_id = 0 
)

The main data retrieving function, to be called after calling loadConfig() and initialize().

Parameters
out_obsThe output retrieved observation (only if there_is_obs=true).
there_is_obsIf set to false, there was no new observation.
hardware_errorTrue on hardware/comms error.
sensor_idThe index of the sensor accessed.
See also
doProcess

◆ getNumDevices()

int mrpt::hwdrivers::COpenNI2Generic::getNumDevices ( ) const

The amount of available devices at initialization.

◆ isOpen()

bool mrpt::hwdrivers::COpenNI2Generic::isOpen ( const unsigned  sensor_id) const

Check if the given 'sensor_id' has been open.

Whether there is a working connection to the sensor

◆ isVerbose()

bool mrpt::hwdrivers::COpenNI2Generic::isVerbose ( ) const

◆ kill()

void mrpt::hwdrivers::COpenNI2Generic::kill ( )

Kill the OpenNI2 driver.

◆ open()

void mrpt::hwdrivers::COpenNI2Generic::open ( unsigned  sensor_id = 0)

Try to open the camera (all the parameters [resolution,fps,...] must be set before calling this) - users may also call initialize(), which in turn calls this method.

Raises an exception upon error.

Exceptions
std::exceptionA textual description of the error.

◆ openDeviceBySerial()

unsigned int mrpt::hwdrivers::COpenNI2Generic::openDeviceBySerial ( const unsigned int  SerialRequired)

Open a RGBD device specified by its serial number.

This method is a wrapper for openDevicesBySerialNum(const std::set<unsigned>& vSerialRequired) This method requires to open the sensors which are still closed to read their serial.

◆ openDevicesBySerialNum()

unsigned int mrpt::hwdrivers::COpenNI2Generic::openDevicesBySerialNum ( const std::set< unsigned > &  vSerialRequired)

Open a set of RGBD devices specified by their serial number.

Raises an exception when the demanded serial numbers are not among the connected devices. This function also fills a vector with the serial numbers of the connected OpenNI2 sensors (this requires openning the sensors which are still closed to read their serial)

◆ setVerbose()

void mrpt::hwdrivers::COpenNI2Generic::setVerbose ( bool  verbose)

◆ showLog()

void mrpt::hwdrivers::COpenNI2Generic::showLog ( const std::string &  message) const
protected

Member Data Documentation

◆ m_depth_format

int mrpt::hwdrivers::COpenNI2Generic::m_depth_format
protected

Definition at line 141 of file COpenNI2Generic.h.

◆ m_fps

float mrpt::hwdrivers::COpenNI2Generic::m_fps
protected

Definition at line 140 of file COpenNI2Generic.h.

◆ m_grab_3D_points

bool mrpt::hwdrivers::COpenNI2Generic::m_grab_3D_points
protected

Default: all true.

Definition at line 148 of file COpenNI2Generic.h.

◆ m_grab_depth

bool mrpt::hwdrivers::COpenNI2Generic::m_grab_depth
protected

Definition at line 148 of file COpenNI2Generic.h.

◆ m_grab_image

bool mrpt::hwdrivers::COpenNI2Generic::m_grab_image
protected

The data that the RGBD sensors can return.

Definition at line 148 of file COpenNI2Generic.h.

◆ m_height

int mrpt::hwdrivers::COpenNI2Generic::m_height
protected

Definition at line 139 of file COpenNI2Generic.h.

◆ m_rgb_format

int mrpt::hwdrivers::COpenNI2Generic::m_rgb_format
protected

Definition at line 141 of file COpenNI2Generic.h.

◆ m_verbose

bool mrpt::hwdrivers::COpenNI2Generic::m_verbose
protected

Definition at line 142 of file COpenNI2Generic.h.

◆ m_width

int mrpt::hwdrivers::COpenNI2Generic::m_width
protected

The same options (width, height and fps) are set for all the sensors.

(This could be changed if necessary)

Definition at line 139 of file COpenNI2Generic.h.

◆ numInstances

int mrpt::hwdrivers::COpenNI2Generic::numInstances
staticprotected

Definition at line 133 of file COpenNI2Generic.h.

◆ vDevices

std::vector<stlplus::smart_ptr<CDevice> > mrpt::hwdrivers::COpenNI2Generic::vDevices
staticprotected

Definition at line 132 of file COpenNI2Generic.h.

◆ vSerialNums

std::vector<int> mrpt::hwdrivers::COpenNI2Generic::vSerialNums
protected

A vector with the serial numbers of the available devices.

Definition at line 136 of file COpenNI2Generic.h.




Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Wed Mar 22 08:20:48 UTC 2023