Class COpenNI2Generic
Defined in File COpenNI2Generic.h
Nested Relationships
Nested Types
Inheritance Relationships
Derived Types
public mrpt::hwdrivers::COpenNI2Sensor(Class COpenNI2Sensor)public mrpt::hwdrivers::COpenNI2_RGBD360(Class COpenNI2_RGBD360)
Class Documentation
-
class COpenNI2Generic
An abstract class for accessing OpenNI2 compatible sensors. This class permits one to access several sensors simultaneously. The same options (resolution, fps, etc.) are used for every sensor.
More references to read:
Subclassed by mrpt::hwdrivers::COpenNI2Sensor, mrpt::hwdrivers::COpenNI2_RGBD360
Open/Close device methods
-
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. Raises an exception upon error.
- Throws:
std::exception – A textual description of the error.
-
unsigned int 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)
-
unsigned int 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.
-
bool getDeviceIDFromSerialNum(const unsigned int SerialRequired, int &sensor_id) const
Get the ID of the device corresponding to ‘SerialRequired’.
-
bool start()
Open all sensor streams (normally called automatically at constructor, no need to call it manually).
- Returns:
false on error
-
bool isOpen(const unsigned sensor_id) const
Whether there is a working connection to the sensor
-
void close(unsigned sensor_id = 0)
Close the connection to the sensor (no need to call it manually unless desired for some reason, since it’s called at destructor
-
int getNumDevices() const
The number of available devices at initialization
-
int getConnectedDevices()
Get a list of the connected OpenNI2 sensors.
Public Functions
-
COpenNI2Generic()
Default ctor (width=640, height=480, fps=30)
-
COpenNI2Generic(int width, int height, float fps = 30.0f, bool open_streams_now = true)
Ctor.
See also
-
~COpenNI2Generic()
Default ctor
-
void getNextFrameRGB(mrpt::img::CImage &rgb_img, mrpt::system::TTimeStamp ×tamp, 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_img – The output retrieved RGB image (only if there_is_obs=true).
timestamp – The timestamp of the capture (only if there_is_obs=true).
there_is_obs – If set to false, there was no new observation.
hardware_error – True on hardware/comms error.
sensor_id – The index of the sensor accessed.
-
void getNextFrameD(mrpt::math::CMatrix_u16 &depth_img_mm, mrpt::system::TTimeStamp ×tamp, 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_img – The output retrieved depth image (only if there_is_obs=true).
timestamp – The timestamp of the capture (only if there_is_obs=true).
there_is_obs – If set to false, there was no new observation.
hardware_error – True on hardware/comms error.
sensor_id – The index of the sensor accessed.
-
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().
See also
doProcess
- Parameters:
out_obs – The output retrieved observation (only if there_is_obs=true).
there_is_obs – If set to false, there was no new observation.
hardware_error – True on hardware/comms error.
sensor_id – The index of the sensor accessed.
-
void setVerbose(bool verbose)
-
bool isVerbose() const
-
bool getColorSensorParam(mrpt::img::TCamera ¶m, unsigned sensor_id = 0) const
-
bool getDepthSensorParam(mrpt::img::TCamera ¶m, unsigned sensor_id = 0) const
Public Static Functions
-
static int getNumInstances()
Get the number of OpenNI2 cameras currently open via COpenNI2Generic
Protected Functions
-
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 = {640}
The same options (width, height and fps) are set for all the sensors. (This could be changed if necessary)
-
int m_height = {480}
-
float m_fps = {30.0f}
-
int m_rgb_format
-
int m_depth_format
-
bool m_verbose = {false}
-
bool m_grab_image = {true}
The data that the RGBD sensors can return Default: all true
-
bool m_grab_depth = {true}
-
bool m_grab_3D_points = {true}
-
class CDevice
-
void open(unsigned sensor_id = 0)