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

Detailed Description

A class for grabing "range images", intensity images (either RGB or IR) and other information from an OpenNI2 sensor.

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

Configuration and usage:


Data is returned as observations of type mrpt::obs::CObservation3DRangeScan. See those classes for documentation on their fields.

As with any other CGenericSensor class, the normal sequence of methods to be called is:

Calibration parameters


In this class we employ the OpenNI2 method to return depth images refered to the RGB camera. Otherwise we could specify an accurate transformation of depth images to 3D points, you'll have to calibrate your RGBD sensor for that, and supply the following threee pieces of information (default calibration data will be used otherwise, but they'll be not optimal for all sensors!):

See http://www.mrpt.org/Kinect_calibration for a procedure to calibrate RGBD sensors with an interactive GUI program.

Coordinates convention


The origin of coordinates is the focal point of the depth camera, with the axes oriented as in the diagram shown in mrpt::obs::CObservation3DRangeScan. Notice in that picture that the RGB camera is assumed to have axes as usual in computer vision, which differ from those for the depth camera.

The X,Y,Z axes used to report the data from accelerometers coincide with those of the depth camera (e.g. the camera standing on a table would have an ACC_Z=-9.8m/s2).

Notice however that, for consistency with stereo cameras, when loading the calibration parameters from a configuration file, the left-to-right pose increment is expected as if both RGB & IR cameras had their +Z axes pointing forward, +X to the right, +Y downwards (just like it's the standard in stereo cameras and in computer vision literature). In other words: the pose stored in this class uses a different axes convention for the depth camera than in a stereo camera, so when a pose L2R is loaded from a calibration file it's actually converted like:

L2R(this class convention) = CPose3D(0,0,0,-90deg,0deg,-90deg) (+) L2R(in the config file)

Some general comments


Converting to 3D point cloud


You can convert the 3D observation into a 3D point cloud with this piece of code:

pntsMap.colorScheme.scheme = CColouredPointsMap::cmFromIntensityImage;
pntsMap.loadFromRangeScan(obs3D);
A map of 2D/3D points with individual colours (RGB).
virtual void loadFromRangeScan(const mrpt::obs::CObservation2DRangeScan &rangeScan, const mrpt::poses::CPose3D *robotPose=NULL) MRPT_OVERRIDE
See CPointsMap::loadFromRangeScan()
TColourOptions colorScheme
The options employed when inserting laser scans in the map.
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement,...

Then the point cloud mrpt::maps::CColouredPointsMap can be converted into an OpenGL object for rendering with mrpt::maps::CMetricMap::getAs3DObject() or alternatively with:

gl_points->loadFromPointsMap(&pntsMap);
static CPointCloudColouredPtr Create()
struct OPENGL_IMPEXP CPointCloudColouredPtr

Platform-specific comments


For more details, refer to libfreenect documentation:

Format of parameters for loading from a .ini file


PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
-------------------------------------------------------
[supplied_section_name]
sensorLabel = OPENNI2 // A text description
preview_window = false // Show a window with a preview of the grabbed data in real-time
device_number = 0 // Device index to open (0:first Kinect, 1:second Kinect,...)
grab_image = true // Grab the RGB image channel? (Default=true)
grab_depth = true // Grab the depth channel? (Default=true)
grab_3D_points = true // Grab the 3D point cloud? (Default=true) If disabled, points can be generated later on.
video_channel = VIDEO_CHANNEL_RGB // Optional. Can be: VIDEO_CHANNEL_RGB (default) or VIDEO_CHANNEL_IR
pose_x=0 // Camera position in the robot (meters)
pose_y=0
pose_z=0
pose_yaw=0 // Angles in degrees
pose_pitch=0
pose_roll=0
// Kinect sensor calibration:
// See http://www.mrpt.org/Kinect_and_MRPT
// Left/Depth camera
[supplied_section_name_LEFT]
rawlog-grabber-ignore = true // Instructs rawlog-grabber to ignore this section (it is not a separate device!)
resolution = [640 488]
cx = 314.649173
cy = 240.160459
fx = 572.882768
fy = 542.739980
dist = [-4.747169e-03 -4.357976e-03 0.000000e+00 0.000000e+00 0.000000e+00] // The order is: [K1 K2 T1 T2 K3]
// Right/RGB camera
[supplied_section_name_RIGHT]
rawlog-grabber-ignore = true // Instructs rawlog-grabber to ignore this section (it is not a separate device!)
resolution = [640 480]
cx = 322.515987
cy = 259.055966
fx = 521.179233
fy = 493.033034
dist = [5.858325e-02 3.856792e-02 0.000000e+00 0.000000e+00 0.000000e+00] // The order is: [K1 K2 T1 T2 K3]
// Relative pose of the right camera wrt to the left camera:
// This assumes that both camera frames are such that +Z points
// forwards, and +X and +Y to the right and downwards.
// For the actual coordinates employed in 3D observations, see figure in mrpt::obs::CObservation3DRangeScan
[supplied_section_name_LEFT2RIGHT_POSE]
rawlog-grabber-ignore = true // Instructs rawlog-grabber to ignore this section (it is not a separate device!)
pose_quaternion = [0.025575 -0.000609 -0.001462 0.999987 0.002038 0.004335 -0.001693]

More references to read:IMPEXP mrpt

Definition at line 166 of file COpenNI2Sensor.h.

#include <mrpt/hwdrivers/COpenNI2Sensor.h>

Inheritance diagram for mrpt::hwdrivers::COpenNI2Sensor:
Inheritance graph

Public Types

enum  TSensorState { ssInitializing = 0 , ssWorking , ssError }
 The current state of the sensor. More...
 
typedef std::multimap< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > TListObservations
 
typedef std::pair< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > TListObsPair
 

Public Member Functions

 COpenNI2Sensor ()
 Default ctor.
 
 ~COpenNI2Sensor ()
 Default ctor.
 
void setSerialToOpen (const unsigned serial)
 Set the serial number of the device to open.
 
void setSensorIDToOpen (const unsigned sensor_id)
 Set the sensor_id of the device to open.
 
virtual void initialize ()
 Initializes the 3D camera - should be invoked after calling loadConfig() or setting the different parameters with the set*() methods.
 
virtual void doProcess ()
 To be called at a high rate (>XX Hz), this method populates the internal buffer of received observations.
 
void getNextObservation (mrpt::obs::CObservation3DRangeScan &out_obs, bool &there_is_obs, bool &hardware_error)
 The main data retrieving function, to be called after calling loadConfig() and initialize().
 
virtual void setPathForExternalImages (const std::string &directory)
 Set the path where to save off-rawlog image files (this class DOES take into account this path).
 
virtual const mrpt::hwdrivers::TSensorClassIdGetRuntimeClass () const =0
 
TSensorState getState () const
 The current state of the sensor

 
double getProcessRate () const
 
std::string getSensorLabel () const
 
void setSensorLabel (const std::string &sensorLabel)
 
void enableVerbose (bool enabled=true)
 Enable or disable extra debug info dumped to std::cout during sensor operation.
 
bool isVerboseEnabled () const
 
void loadConfig (const mrpt::utils::CConfigFileBase &configSource, const std::string &section)
 Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensorSpecific".
 
void getObservations (TListObservations &lstObjects)
 Returns a list of enqueued objects, emptying it (thread-safe).
 
void setExternalImageFormat (const std::string &ext)
 Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The default is "jpg".
 
void setExternalImageJPEGQuality (const unsigned int quality)
 The quality of JPEG compression, when external images is enabled and the format is "jpg".
 
unsigned int getExternalImageJPEGQuality () const
 
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
double getMaxRange () const
 Get the maximum range (meters) that can be read in the observation field "rangeImage".
 
size_t getRowCount () const
 Get the row count in the camera images, loaded automatically upon camera open().
 
size_t getColCount () const
 Get the col count in the camera images, loaded automatically upon camera open().
 
const mrpt::utils::TCameragetCameraParamsIntensity () const
 Get a const reference to the depth camera calibration parameters.
 
void setCameraParamsIntensity (const mrpt::utils::TCamera &p)
 
const mrpt::utils::TCameragetCameraParamsDepth () const
 Get a const reference to the depth camera calibration parameters.
 
void setCameraParamsDepth (const mrpt::utils::TCamera &p)
 
void setRelativePoseIntensityWrtDepth (const mrpt::poses::CPose3D &p)
 Set the pose of the intensity camera wrt the depth camera.
 
const mrpt::poses::CPose3DgetRelativePoseIntensityWrtDepth () const
 
void enableGrabRGB (bool enable=true)
 Enable/disable the grabbing of the RGB channel.
 
bool isGrabRGBEnabled () const
 
void enableGrabDepth (bool enable=true)
 Enable/disable the grabbing of the depth channel.
 
bool isGrabDepthEnabled () const
 
void enableGrab3DPoints (bool enable=true)
 Enable/disable the grabbing of the 3D point clouds.
 
bool isGrab3DPointsEnabled () 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.
 

Static Public Member Functions

static void registerClass (const TSensorClassId *pNewClass)
 Register a class into the internal list of "CGenericSensor" descendents.
 
static CGenericSensorcreateSensor (const std::string &className)
 Creates a sensor by a name of the class.
 
static CGenericSensorPtr createSensorPtr (const std::string &className)
 Just like createSensor, but returning a smart pointer to the newly created sensor object.
 

Protected Member Functions

virtual void loadConfig_sensorSpecific (const mrpt::utils::CConfigFileBase &configSource, const std::string &section)
 Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes)
 
void appendObservations (const std::vector< mrpt::utils::CSerializablePtr > &obj)
 This method must be called by derived classes to enqueue a new observation in the list to be returned by getObservations.
 
void appendObservation (const mrpt::utils::CSerializablePtr &obj)
 Like appendObservations() but for just one observation.
 
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

mrpt::poses::CPose3D m_sensorPoseOnRobot
 
bool m_preview_window
 Show preview window while grabbing.
 
size_t m_preview_window_decimation
 If preview is enabled, only show 1 out of N images.
 
size_t m_preview_decim_counter_range
 
size_t m_preview_decim_counter_rgb
 
mrpt::gui::CDisplayWindowPtr m_win_range
 
mrpt::gui::CDisplayWindowPtr m_win_int
 
mrpt::utils::TCamera m_cameraParamsRGB
 Params for the RGB camera.
 
mrpt::utils::TCamera m_cameraParamsDepth
 Params for the Depth camera.
 
mrpt::poses::CPose3D m_relativePoseIntensityWRTDepth
 See mrpt::obs::CObservation3DRangeScan for a diagram of this pose.
 
double m_maxRange
 Sensor max range (meters)
 
int m_user_device_number
 Number of device to open (0:first,...)
 
int m_serial_number
 Serial number of device to open.
 
size_t m_grab_decimation_counter
 Used when "m_grab_decimation" is enabled.
 
TSensorState m_state
 
bool m_verbose
 
std::string m_path_for_external_images
 The path where to save off-rawlog images: empty means save images embedded in the rawlog.
 
std::string m_external_images_format
 The extension ("jpg","gif","png",...) that determines the format of images saved externally.
 
unsigned int m_external_images_jpeg_quality
 For JPEG images, the quality (default=95%).
 
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.
 
Common settings to any sensor, loaded in "loadConfig"
double m_process_rate
 See CGenericSensor.
 
size_t m_max_queue_len
 See CGenericSensor.
 
size_t m_grab_decimation
 If set to N>=2, only 1 out of N observations will be saved to m_objList.
 
std::string m_sensorLabel
 See CGenericSensor.
 

Static Protected Attributes

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

Private Attributes

synch::CCriticalSection m_csObjList
 The critical section for m_objList.
 
TListObservations m_objList
 The queue of objects to be returned by getObservations.
 

Static Private Attributes

static std::map< std::string, const TSensorClassId * > m_knownClasses
 Used in registerClass.
 

Member Typedef Documentation

◆ TListObservations

typedef std::multimap< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > mrpt::hwdrivers::CGenericSensor::TListObservations
inherited

Definition at line 68 of file CGenericSensor.h.

◆ TListObsPair

typedef std::pair< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > mrpt::hwdrivers::CGenericSensor::TListObsPair
inherited

Definition at line 69 of file CGenericSensor.h.

Member Enumeration Documentation

◆ TSensorState

The current state of the sensor.

See also
CGenericSensor::getState
Enumerator
ssInitializing 
ssWorking 
ssError 

Definition at line 74 of file CGenericSensor.h.

Constructor & Destructor Documentation

◆ COpenNI2Sensor()

mrpt::hwdrivers::COpenNI2Sensor::COpenNI2Sensor ( )

Default ctor.

◆ ~COpenNI2Sensor()

mrpt::hwdrivers::COpenNI2Sensor::~COpenNI2Sensor ( )

Default ctor.

Member Function Documentation

◆ appendObservation()

void mrpt::hwdrivers::CGenericSensor::appendObservation ( const mrpt::utils::CSerializablePtr &  obj)
inlineprotectedinherited

Like appendObservations() but for just one observation.

Definition at line 146 of file CGenericSensor.h.

◆ appendObservations()

void mrpt::hwdrivers::CGenericSensor::appendObservations ( const std::vector< mrpt::utils::CSerializablePtr > &  obj)
protectedinherited

This method must be called by derived classes to enqueue a new observation in the list to be returned by getObservations.

Passed objects must be created in dynamic memory and a smart pointer passed. Example of creation:

mrpt::obs::CObservationGPSPtr o = CObservationGPSPtr( new CObservationGPS() );
o-> .... // Set data
void appendObservation(const mrpt::utils::CSerializablePtr &obj)
Like appendObservations() but for just one observation.
struct OBS_IMPEXP CObservationGPSPtr

If several observations are passed at once in the vector, they'll be considered as a block regarding the grabbing decimation factor.

◆ close()

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

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

◆ createSensor()

static CGenericSensor * mrpt::hwdrivers::CGenericSensor::createSensor ( const std::string &  className)
staticinherited

Creates a sensor by a name of the class.

Typically the user may want to create a smart pointer around the returned pointer, whis is made with:

static CGenericSensor * createSensor(const std::string &className)
Creates a sensor by a name of the class.
stlplus::smart_ptr< CGenericSensor > CGenericSensorPtr
Returns
A pointer to a new class, or NULL if class name is unknown.

◆ createSensorPtr()

static CGenericSensorPtr mrpt::hwdrivers::CGenericSensor::createSensorPtr ( const std::string &  className)
inlinestaticinherited

Just like createSensor, but returning a smart pointer to the newly created sensor object.

Definition at line 179 of file CGenericSensor.h.

◆ doProcess()

virtual void mrpt::hwdrivers::COpenNI2Sensor::doProcess ( )
virtual

To be called at a high rate (>XX Hz), this method populates the internal buffer of received observations.

This method is mainly intended for usage within rawlog-grabber or similar programs. For an alternative, see getNextObservation()

Exceptions
Thismethod must throw an exception with a descriptive message if some critical error is found.
See also
getNextObservation

Implements mrpt::hwdrivers::CGenericSensor.

◆ enableGrab3DPoints()

void mrpt::hwdrivers::COpenNI2Sensor::enableGrab3DPoints ( bool  enable = true)
inline

Enable/disable the grabbing of the 3D point clouds.

Definition at line 249 of file COpenNI2Sensor.h.

◆ enableGrabDepth()

void mrpt::hwdrivers::COpenNI2Sensor::enableGrabDepth ( bool  enable = true)
inline

Enable/disable the grabbing of the depth channel.

Definition at line 245 of file COpenNI2Sensor.h.

◆ enableGrabRGB()

void mrpt::hwdrivers::COpenNI2Sensor::enableGrabRGB ( bool  enable = true)
inline

Enable/disable the grabbing of the RGB channel.

Definition at line 241 of file COpenNI2Sensor.h.

◆ enableVerbose()

void mrpt::hwdrivers::CGenericSensor::enableVerbose ( bool  enabled = true)
inlineinherited

Enable or disable extra debug info dumped to std::cout during sensor operation.

Default: disabled unless the environment variable "MRPT_HWDRIVERS_VERBOSE" is set to "1" during object creation.

Definition at line 92 of file CGenericSensor.h.

◆ getCameraParamsDepth()

const mrpt::utils::TCamera & mrpt::hwdrivers::COpenNI2Sensor::getCameraParamsDepth ( ) const
inline

Get a const reference to the depth camera calibration parameters.

Definition at line 233 of file COpenNI2Sensor.h.

◆ getCameraParamsIntensity()

const mrpt::utils::TCamera & mrpt::hwdrivers::COpenNI2Sensor::getCameraParamsIntensity ( ) const
inline

Get a const reference to the depth camera calibration parameters.

Definition at line 229 of file COpenNI2Sensor.h.

◆ getColCount()

size_t mrpt::hwdrivers::COpenNI2Sensor::getColCount ( ) const
inline

Get the col count in the camera images, loaded automatically upon camera open().

Definition at line 226 of file COpenNI2Sensor.h.

◆ getColorSensorParam()

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

◆ getConnectedDevices()

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

Get a list of the connected OpenNI2 sensors.

◆ getDepthSensorParam()

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

◆ getDeviceIDFromSerialNum()

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

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

◆ getExternalImageJPEGQuality()

unsigned int mrpt::hwdrivers::CGenericSensor::getExternalImageJPEGQuality ( ) const
inlineinherited

Definition at line 233 of file CGenericSensor.h.

◆ getMaxRange()

double mrpt::hwdrivers::COpenNI2Sensor::getMaxRange ( ) const
inline

Get the maximum range (meters) that can be read in the observation field "rangeImage".

Definition at line 221 of file COpenNI2Sensor.h.

◆ 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 
)
inherited

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 
)
inherited

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 
)
inherited

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

◆ getNextObservation()

void mrpt::hwdrivers::COpenNI2Sensor::getNextObservation ( mrpt::obs::CObservation3DRangeScan out_obs,
bool &  there_is_obs,
bool &  hardware_error 
)

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.
See also
doProcess

◆ getNumDevices()

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

The amount of available devices at initialization.

◆ getObservations()

void mrpt::hwdrivers::CGenericSensor::getObservations ( TListObservations lstObjects)
inherited

Returns a list of enqueued objects, emptying it (thread-safe).

The objects must be freed by the invoker.

◆ getProcessRate()

double mrpt::hwdrivers::CGenericSensor::getProcessRate ( ) const
inlineinherited

Definition at line 84 of file CGenericSensor.h.

◆ getRelativePoseIntensityWrtDepth()

const mrpt::poses::CPose3D & mrpt::hwdrivers::COpenNI2Sensor::getRelativePoseIntensityWrtDepth ( ) const
inline

Definition at line 238 of file COpenNI2Sensor.h.

◆ getRowCount()

size_t mrpt::hwdrivers::COpenNI2Sensor::getRowCount ( ) const
inline

Get the row count in the camera images, loaded automatically upon camera open().

Definition at line 224 of file COpenNI2Sensor.h.

◆ GetRuntimeClass()

virtual const mrpt::hwdrivers::TSensorClassId * mrpt::hwdrivers::CGenericSensor::GetRuntimeClass ( ) const
pure virtualinherited

◆ getSensorLabel()

std::string mrpt::hwdrivers::CGenericSensor::getSensorLabel ( ) const
inlineinherited

Definition at line 86 of file CGenericSensor.h.

◆ getState()

TSensorState mrpt::hwdrivers::CGenericSensor::getState ( ) const
inlineinherited

The current state of the sensor

Definition at line 82 of file CGenericSensor.h.

◆ initialize()

virtual void mrpt::hwdrivers::COpenNI2Sensor::initialize ( )
virtual

Initializes the 3D camera - should be invoked after calling loadConfig() or setting the different parameters with the set*() methods.

Exceptions
Thismethod must throw an exception with a descriptive message if some critical error is found.

Reimplemented from mrpt::hwdrivers::CGenericSensor.

◆ isGrab3DPointsEnabled()

bool mrpt::hwdrivers::COpenNI2Sensor::isGrab3DPointsEnabled ( ) const
inline

Definition at line 250 of file COpenNI2Sensor.h.

◆ isGrabDepthEnabled()

bool mrpt::hwdrivers::COpenNI2Sensor::isGrabDepthEnabled ( ) const
inline

Definition at line 246 of file COpenNI2Sensor.h.

◆ isGrabRGBEnabled()

bool mrpt::hwdrivers::COpenNI2Sensor::isGrabRGBEnabled ( ) const
inline

Definition at line 242 of file COpenNI2Sensor.h.

◆ isOpen()

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

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
inherited

◆ isVerboseEnabled()

bool mrpt::hwdrivers::CGenericSensor::isVerboseEnabled ( ) const
inlineinherited

Definition at line 93 of file CGenericSensor.h.

◆ kill()

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

Kill the OpenNI2 driver.

◆ loadConfig()

void mrpt::hwdrivers::CGenericSensor::loadConfig ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  section 
)
inherited

Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensorSpecific".

Exceptions
Thismethod throws an exception with a descriptive message if some critical parameter is missing or has an invalid value.

◆ loadConfig_sensorSpecific()

virtual void mrpt::hwdrivers::COpenNI2Sensor::loadConfig_sensorSpecific ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  section 
)
protectedvirtual

Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes)

Exceptions
Thismethod must throw an exception with a descriptive message if some critical parameter is missing or has an invalid value.

Implements mrpt::hwdrivers::CGenericSensor.

◆ open()

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

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)
inherited

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)
inherited

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)

◆ registerClass()

static void mrpt::hwdrivers::CGenericSensor::registerClass ( const TSensorClassId pNewClass)
staticinherited

Register a class into the internal list of "CGenericSensor" descendents.

Used internally in the macros DEFINE_GENERIC_SENSOR, etc...

Can be used as "CGenericSensor::registerClass( SENSOR_CLASS_ID(CMySensor) );" if building custom sensors outside mrpt libraries in user code.

◆ setCameraParamsDepth()

void mrpt::hwdrivers::COpenNI2Sensor::setCameraParamsDepth ( const mrpt::utils::TCamera p)
inline

Definition at line 234 of file COpenNI2Sensor.h.

◆ setCameraParamsIntensity()

void mrpt::hwdrivers::COpenNI2Sensor::setCameraParamsIntensity ( const mrpt::utils::TCamera p)
inline

Definition at line 230 of file COpenNI2Sensor.h.

◆ setExternalImageFormat()

void mrpt::hwdrivers::CGenericSensor::setExternalImageFormat ( const std::string &  ext)
inlineinherited

Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The default is "jpg".

See also
setPathForExternalImages, setExternalImageJPEGQuality

Definition at line 225 of file CGenericSensor.h.

◆ setExternalImageJPEGQuality()

void mrpt::hwdrivers::CGenericSensor::setExternalImageJPEGQuality ( const unsigned int  quality)
inlineinherited

The quality of JPEG compression, when external images is enabled and the format is "jpg".

See also
setExternalImageFormat

Definition at line 230 of file CGenericSensor.h.

◆ setPathForExternalImages()

virtual void mrpt::hwdrivers::COpenNI2Sensor::setPathForExternalImages ( const std::string &  directory)
virtual

Set the path where to save off-rawlog image files (this class DOES take into account this path).

An empty string (the default value at construction) means to save images embedded in the rawlog, instead of on separate files.

Exceptions
std::exceptionIf the directory doesn't exists and cannot be created.

Reimplemented from mrpt::hwdrivers::CGenericSensor.

◆ setRelativePoseIntensityWrtDepth()

void mrpt::hwdrivers::COpenNI2Sensor::setRelativePoseIntensityWrtDepth ( const mrpt::poses::CPose3D p)
inline

Set the pose of the intensity camera wrt the depth camera.

See also
See mrpt::obs::CObservation3DRangeScan for a 3D diagram of this pose

Definition at line 237 of file COpenNI2Sensor.h.

◆ setSensorIDToOpen()

void mrpt::hwdrivers::COpenNI2Sensor::setSensorIDToOpen ( const unsigned  sensor_id)
inline

Set the sensor_id of the device to open.

Exceptions
Thismethod must throw an exception when such serial number is not found among the connected devices.

Definition at line 183 of file COpenNI2Sensor.h.

◆ setSensorLabel()

void mrpt::hwdrivers::CGenericSensor::setSensorLabel ( const std::string &  sensorLabel)
inlineinherited

Definition at line 87 of file CGenericSensor.h.

◆ setSerialToOpen()

void mrpt::hwdrivers::COpenNI2Sensor::setSerialToOpen ( const unsigned  serial)
inline

Set the serial number of the device to open.

Exceptions
Thismethod must throw an exception when such serial number is not found among the connected devices.

Definition at line 178 of file COpenNI2Sensor.h.

◆ setVerbose()

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

◆ showLog()

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

Member Data Documentation

◆ m_cameraParamsDepth

mrpt::utils::TCamera mrpt::hwdrivers::COpenNI2Sensor::m_cameraParamsDepth
protected

Params for the Depth camera.

Definition at line 268 of file COpenNI2Sensor.h.

◆ m_cameraParamsRGB

mrpt::utils::TCamera mrpt::hwdrivers::COpenNI2Sensor::m_cameraParamsRGB
protected

Params for the RGB camera.

Definition at line 267 of file COpenNI2Sensor.h.

◆ m_csObjList

synch::CCriticalSection mrpt::hwdrivers::CGenericSensor::m_csObjList
privateinherited

The critical section for m_objList.

Definition at line 104 of file CGenericSensor.h.

◆ m_depth_format

int mrpt::hwdrivers::COpenNI2Generic::m_depth_format
protectedinherited

Definition at line 141 of file COpenNI2Generic.h.

◆ m_external_images_format

std::string mrpt::hwdrivers::CGenericSensor::m_external_images_format
protectedinherited

The extension ("jpg","gif","png",...) that determines the format of images saved externally.

See also
setPathForExternalImages

Definition at line 130 of file CGenericSensor.h.

◆ m_external_images_jpeg_quality

unsigned int mrpt::hwdrivers::CGenericSensor::m_external_images_jpeg_quality
protectedinherited

For JPEG images, the quality (default=95%).

Definition at line 131 of file CGenericSensor.h.

◆ m_fps

float mrpt::hwdrivers::COpenNI2Generic::m_fps
protectedinherited

Definition at line 140 of file COpenNI2Generic.h.

◆ m_grab_3D_points

bool mrpt::hwdrivers::COpenNI2Generic::m_grab_3D_points
protectedinherited

Default: all true.

Definition at line 148 of file COpenNI2Generic.h.

◆ m_grab_decimation

size_t mrpt::hwdrivers::CGenericSensor::m_grab_decimation
protectedinherited

If set to N>=2, only 1 out of N observations will be saved to m_objList.

Definition at line 117 of file CGenericSensor.h.

◆ m_grab_decimation_counter

size_t mrpt::hwdrivers::CGenericSensor::m_grab_decimation_counter
protectedinherited

Used when "m_grab_decimation" is enabled.

Definition at line 122 of file CGenericSensor.h.

◆ m_grab_depth

bool mrpt::hwdrivers::COpenNI2Generic::m_grab_depth
protectedinherited

Definition at line 148 of file COpenNI2Generic.h.

◆ m_grab_image

bool mrpt::hwdrivers::COpenNI2Generic::m_grab_image
protectedinherited

The data that the RGBD sensors can return.

Definition at line 148 of file COpenNI2Generic.h.

◆ m_height

int mrpt::hwdrivers::COpenNI2Generic::m_height
protectedinherited

Definition at line 139 of file COpenNI2Generic.h.

◆ m_knownClasses

std::map< std::string , const TSensorClassId *> mrpt::hwdrivers::CGenericSensor::m_knownClasses
staticprivateinherited

Used in registerClass.

Definition at line 108 of file CGenericSensor.h.

◆ m_max_queue_len

size_t mrpt::hwdrivers::CGenericSensor::m_max_queue_len
protectedinherited

See CGenericSensor.

Definition at line 116 of file CGenericSensor.h.

◆ m_maxRange

double mrpt::hwdrivers::COpenNI2Sensor::m_maxRange
protected

Sensor max range (meters)

Definition at line 271 of file COpenNI2Sensor.h.

◆ m_objList

TListObservations mrpt::hwdrivers::CGenericSensor::m_objList
privateinherited

The queue of objects to be returned by getObservations.

Definition at line 105 of file CGenericSensor.h.

◆ m_path_for_external_images

std::string mrpt::hwdrivers::CGenericSensor::m_path_for_external_images
protectedinherited

The path where to save off-rawlog images: empty means save images embedded in the rawlog.

Definition at line 129 of file CGenericSensor.h.

◆ m_preview_decim_counter_range

size_t mrpt::hwdrivers::COpenNI2Sensor::m_preview_decim_counter_range
protected

Definition at line 264 of file COpenNI2Sensor.h.

◆ m_preview_decim_counter_rgb

size_t mrpt::hwdrivers::COpenNI2Sensor::m_preview_decim_counter_rgb
protected

Definition at line 264 of file COpenNI2Sensor.h.

◆ m_preview_window

bool mrpt::hwdrivers::COpenNI2Sensor::m_preview_window
protected

Show preview window while grabbing.

Definition at line 262 of file COpenNI2Sensor.h.

◆ m_preview_window_decimation

size_t mrpt::hwdrivers::COpenNI2Sensor::m_preview_window_decimation
protected

If preview is enabled, only show 1 out of N images.

Definition at line 263 of file COpenNI2Sensor.h.

◆ m_process_rate

double mrpt::hwdrivers::CGenericSensor::m_process_rate
protectedinherited

See CGenericSensor.

Definition at line 115 of file CGenericSensor.h.

◆ m_relativePoseIntensityWRTDepth

mrpt::poses::CPose3D mrpt::hwdrivers::COpenNI2Sensor::m_relativePoseIntensityWRTDepth
protected

See mrpt::obs::CObservation3DRangeScan for a diagram of this pose.

Definition at line 269 of file COpenNI2Sensor.h.

◆ m_rgb_format

int mrpt::hwdrivers::COpenNI2Generic::m_rgb_format
protectedinherited

Definition at line 141 of file COpenNI2Generic.h.

◆ m_sensorLabel

std::string mrpt::hwdrivers::CGenericSensor::m_sensorLabel
protectedinherited

See CGenericSensor.

Definition at line 118 of file CGenericSensor.h.

◆ m_sensorPoseOnRobot

mrpt::poses::CPose3D mrpt::hwdrivers::COpenNI2Sensor::m_sensorPoseOnRobot
protected

Definition at line 260 of file COpenNI2Sensor.h.

◆ m_serial_number

int mrpt::hwdrivers::COpenNI2Sensor::m_serial_number
protected

Serial number of device to open.

Definition at line 274 of file COpenNI2Sensor.h.

◆ m_state

TSensorState mrpt::hwdrivers::CGenericSensor::m_state
protectedinherited

Definition at line 124 of file CGenericSensor.h.

◆ m_user_device_number

int mrpt::hwdrivers::COpenNI2Sensor::m_user_device_number
protected

Number of device to open (0:first,...)

Definition at line 273 of file COpenNI2Sensor.h.

◆ m_verbose [1/2]

bool mrpt::hwdrivers::CGenericSensor::m_verbose
protectedinherited

Definition at line 125 of file CGenericSensor.h.

◆ m_verbose [2/2]

bool mrpt::hwdrivers::COpenNI2Generic::m_verbose
protectedinherited

Definition at line 142 of file COpenNI2Generic.h.

◆ m_width

int mrpt::hwdrivers::COpenNI2Generic::m_width
protectedinherited

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.

◆ m_win_int

mrpt::gui::CDisplayWindowPtr mrpt::hwdrivers::COpenNI2Sensor::m_win_int
protected

Definition at line 265 of file COpenNI2Sensor.h.

◆ m_win_range

mrpt::gui::CDisplayWindowPtr mrpt::hwdrivers::COpenNI2Sensor::m_win_range
protected

Definition at line 265 of file COpenNI2Sensor.h.

◆ numInstances

int mrpt::hwdrivers::COpenNI2Generic::numInstances
staticprotectedinherited

Definition at line 133 of file COpenNI2Generic.h.

◆ vDevices

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

Definition at line 132 of file COpenNI2Generic.h.

◆ vSerialNums

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

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 Sat Jan 21 06:46:15 UTC 2023