MRPT
1.9.9
|
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.
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:
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 https://www.mrpt.org/Kinect_calibration for a procedure to calibrate RGBD sensors with an interactive GUI program.
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)
You can convert the 3D observation into a 3D point cloud with this piece of code:
Then the point cloud mrpt::maps::CColouredPointsMap can be converted into an OpenGL object for rendering with mrpt::maps::CMetricMap::getAs3DObject() or alternatively with:
For more details, refer to libfreenect documentation:
MRPT/scripts/51-kinect.rules
in /etc/udev/rules.d/
to allow access to all users.More references to read:IMPEXP mrpt
Definition at line 216 of file COpenNI2Sensor.h.
#include <mrpt/hwdrivers/COpenNI2Sensor.h>
Public Types | |
enum | TSensorState { ssInitializing = 0, ssWorking, ssError } |
The current state of the sensor. More... | |
using | Ptr = std::shared_ptr< CGenericSensor > |
using | TListObservations = std::multimap< mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr > |
using | TListObsPair = std::pair< mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr > |
Public Member Functions | |
COpenNI2Sensor () | |
Default ctor. More... | |
~COpenNI2Sensor () override | |
Default ctor. More... | |
void | setSerialToOpen (const unsigned serial) |
Set the serial number of the device to open. More... | |
void | setSensorIDToOpen (const unsigned sensor_id) |
Set the sensor_id of the device to open. More... | |
void | initialize () override |
Initializes the 3D camera - should be invoked after calling loadConfig() or setting the different parameters with the set*() methods. More... | |
void | doProcess () override |
To be called at a high rate (>XX Hz), this method populates the internal buffer of received observations. More... | |
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(). More... | |
void | setPathForExternalImages (const std::string &directory) override |
Set the path where to save off-rawlog image files (this class DOES take into account this path). More... | |
virtual const mrpt::hwdrivers::TSensorClassId * | GetRuntimeClass () const =0 |
TSensorState | getState () const |
The current state of the sensor. More... | |
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. More... | |
bool | isVerboseEnabled () const |
void | loadConfig (const mrpt::config::CConfigFileBase &configSource, const std::string §ion) |
Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensorSpecific". More... | |
void | getObservations (TListObservations &lstObjects) |
Returns a list of enqueued objects, emptying it (thread-safe). More... | |
void | setExternalImageFormat (const std::string &ext) |
Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The default is "jpg". More... | |
void | setExternalImageJPEGQuality (const unsigned int quality) |
The quality of JPEG compression, when external images is enabled and the format is "jpg". More... | |
unsigned int | getExternalImageJPEGQuality () const |
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(). More... | |
void | getNextFrameD (mrpt::math::CMatrixF &depth_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(). More... | |
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(). More... | |
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 |
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". More... | |
size_t | rows () const |
Get the row count in the camera images, loaded automatically upon camera open(). More... | |
size_t | cols () const |
Get the col count in the camera images, loaded automatically upon camera open(). More... | |
const mrpt::img::TCamera & | getCameraParamsIntensity () const |
Get a const reference to the depth camera calibration parameters. More... | |
void | setCameraParamsIntensity (const mrpt::img::TCamera &p) |
const mrpt::img::TCamera & | getCameraParamsDepth () const |
Get a const reference to the depth camera calibration parameters. More... | |
void | setCameraParamsDepth (const mrpt::img::TCamera &p) |
void | setRelativePoseIntensityWrtDepth (const mrpt::poses::CPose3D &p) |
Set the pose of the intensity camera wrt the depth camera. More... | |
const mrpt::poses::CPose3D & | getRelativePoseIntensityWrtDepth () const |
void | enableGrabRGB (bool enable=true) |
Enable/disable the grabbing of the RGB channel. More... | |
bool | isGrabRGBEnabled () const |
void | enableGrabDepth (bool enable=true) |
Enable/disable the grabbing of the depth channel. More... | |
bool | isGrabDepthEnabled () const |
void | enableGrab3DPoints (bool enable=true) |
Enable/disable the grabbing of the 3D point clouds. More... | |
bool | isGrab3DPointsEnabled () const |
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. More... | |
unsigned int | openDevicesBySerialNum (const std::set< unsigned > &vSerialRequired) |
Open a set of RGBD devices specified by their serial number. More... | |
unsigned int | openDeviceBySerial (const unsigned int SerialRequired) |
Open a RGBD device specified by its serial number. More... | |
bool | getDeviceIDFromSerialNum (const unsigned int SerialRequired, int &sensor_id) const |
Get the ID of the device corresponding to 'SerialRequired'. More... | |
bool | start () |
Open all sensor streams (normally called automatically at constructor, no need to call it manually). More... | |
void | kill () |
Kill the OpenNI2 driver. More... | |
bool | isOpen (const unsigned sensor_id) const |
Whether there is a working connection to the sensor. More... | |
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. More... | |
int | getNumDevices () const |
The number of available devices at initialization. More... | |
int | getConnectedDevices () |
Get a list of the connected OpenNI2 sensors. More... | |
Static Public Member Functions | |
static void | registerClass (const TSensorClassId *pNewClass) |
Register a class into the internal list of "CGenericSensor" descendents. More... | |
static CGenericSensor * | createSensor (const std::string &className) |
Creates a sensor by a name of the class. More... | |
static CGenericSensor::Ptr | createSensorPtr (const std::string &className) |
Just like createSensor, but returning a smart pointer to the newly created sensor object. More... | |
static int | getNumInstances () |
Get the number of OpenNI2 cameras currently open via COpenNI2Generic. More... | |
Protected Member Functions | |
void | loadConfig_sensorSpecific (const mrpt::config::CConfigFileBase &configSource, const std::string §ion) override |
Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see config::CConfigFileBase and derived classes) More... | |
void | appendObservations (const std::vector< mrpt::serialization::CSerializable::Ptr > &obj) |
This method must be called by derived classes to enqueue a new observation in the list to be returned by getObservations. More... | |
void | appendObservation (const mrpt::serialization::CSerializable::Ptr &obj) |
Like appendObservations() but for just one observation. More... | |
void | showLog (const std::string &message) const |
Protected Attributes | |
mrpt::poses::CPose3D | m_sensorPoseOnRobot |
bool | m_preview_window {false} |
Show preview window while grabbing. More... | |
size_t | m_preview_window_decimation {1} |
If preview is enabled, only show 1 out of N images. More... | |
size_t | m_preview_decim_counter_range {0} |
size_t | m_preview_decim_counter_rgb {0} |
mrpt::gui::CDisplayWindow::Ptr | m_win_range |
mrpt::gui::CDisplayWindow::Ptr | m_win_int |
mrpt::img::TCamera | m_cameraParamsRGB |
Params for the RGB camera. More... | |
mrpt::img::TCamera | m_cameraParamsDepth |
Params for the Depth camera. More... | |
mrpt::poses::CPose3D | m_relativePoseIntensityWRTDepth |
See mrpt::obs::CObservation3DRangeScan for a diagram of this pose. More... | |
double | m_maxRange |
Sensor max range (meters) More... | |
int | m_user_device_number {0} |
Number of device to open (0:first,...) More... | |
int | m_serial_number {0} |
Serial number of device to open. More... | |
size_t | m_grab_decimation_counter {0} |
Used when "m_grab_decimation" is enabled. More... | |
TSensorState | m_state {ssInitializing} |
bool | m_verbose {false} |
std::string | m_path_for_external_images |
The path where to save off-rawlog images: empty means save images embedded in the rawlog. More... | |
std::string | m_external_images_format |
The extension ("jpg","gif","png",...) that determines the format of images saved externally. More... | |
unsigned int | m_external_images_jpeg_quality {95} |
For JPEG images, the quality (default=95%). More... | |
std::vector< int > | vSerialNums |
A vector with the serial numbers of the available devices. More... | |
int | m_width {640} |
The same options (width, height and fps) are set for all the sensors. More... | |
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. More... | |
bool | m_grab_depth {true} |
bool | m_grab_3D_points {true} |
Common settings to any sensor, loaded in "loadConfig" | |
double | m_process_rate {0} |
See CGenericSensor. More... | |
size_t | m_max_queue_len {200} |
See CGenericSensor. More... | |
size_t | m_grab_decimation {0} |
If set to N>=2, only 1 out of N observations will be saved to m_objList. More... | |
std::string | m_sensorLabel |
See CGenericSensor. More... | |
|
inherited |
Definition at line 72 of file CGenericSensor.h.
|
inherited |
Definition at line 76 of file CGenericSensor.h.
|
inherited |
Definition at line 78 of file CGenericSensor.h.
|
inherited |
The current state of the sensor.
Enumerator | |
---|---|
ssInitializing | |
ssWorking | |
ssError |
Definition at line 83 of file CGenericSensor.h.
COpenNI2Sensor::COpenNI2Sensor | ( | ) |
Default ctor.
Definition at line 39 of file COpenNI2Sensor.cpp.
|
override |
Default ctor.
Definition at line 76 of file COpenNI2Sensor.cpp.
|
inlineprotectedinherited |
Like appendObservations() but for just one observation.
Definition at line 178 of file CGenericSensor.h.
References mrpt::hwdrivers::CGenericSensor::appendObservations().
Referenced by mrpt::hwdrivers::CIMUXSens_MT4::doProcess(), mrpt::hwdrivers::CIMUXSens::doProcess(), mrpt::hwdrivers::CGyroKVHDSP3000::doProcess(), mrpt::hwdrivers::CSkeletonTracker::doProcess(), mrpt::hwdrivers::CSwissRanger3DCamera::doProcess(), mrpt::hwdrivers::C2DRangeFinderAbstract::doProcess(), mrpt::hwdrivers::CCANBusReader::doProcess(), mrpt::hwdrivers::CVelodyneScanner::doProcess(), and mrpt::hwdrivers::CGPSInterface::flushParsedMessagesNow().
|
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:
If several observations are passed at once in the vector, they'll be considered as a block regarding the grabbing decimation factor.
Definition at line 48 of file CGenericSensor.cpp.
References CLASS_ID, mrpt::hwdrivers::CGenericSensor::m_csObjList, mrpt::hwdrivers::CGenericSensor::m_grab_decimation, mrpt::hwdrivers::CGenericSensor::m_grab_decimation_counter, mrpt::hwdrivers::CGenericSensor::m_objList, and THROW_EXCEPTION.
Referenced by mrpt::hwdrivers::CGenericSensor::appendObservation(), mrpt::hwdrivers::CNationalInstrumentsDAQ::doProcess(), and mrpt::hwdrivers::CKinect::doProcess().
|
inherited |
Close the connection to the sensor (no need to call it manually unless desired for some reason, since it's called at destructor.
Definition at line 394 of file COpenNI2Generic.cpp.
References mrpt::hwdrivers::COpenNI2Generic::getNumDevices(), MRPT_UNUSED_PARAM, THROW_EXCEPTION, vDevices, and vDevices_mx.
|
inline |
Get the col count in the camera images, loaded automatically upon camera open().
Definition at line 299 of file COpenNI2Sensor.h.
References m_cameraParamsRGB, and mrpt::img::TCamera::ncols.
|
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:
Definition at line 97 of file CGenericSensor.cpp.
References mrpt::hwdrivers::CGenericSensor::get_registered_sensor_classes().
Referenced by mrpt::hwdrivers::CGenericSensor::createSensorPtr().
|
inlinestaticinherited |
Just like createSensor, but returning a smart pointer to the newly created sensor object.
Definition at line 218 of file CGenericSensor.h.
References mrpt::hwdrivers::CGenericSensor::createSensor().
|
overridevirtual |
To be called at a high rate (>XX Hz), this method populates the internal buffer of received observations.
This method will be invoked at a minimum rate of "process_rate" (Hz)
This method is mainly intended for usage within rawlog-grabber or similar programs. For an alternative, see getNextObservation()
This | method must throw an exception with a descriptive message if some critical error is found. |
This | method must throw an exception with a descriptive message if some critical error is found. |
Implements mrpt::hwdrivers::CGenericSensor.
Definition at line 150 of file COpenNI2Sensor.cpp.
References THROW_EXCEPTION.
|
inline |
Enable/disable the grabbing of the 3D point clouds.
Definition at line 338 of file COpenNI2Sensor.h.
References mrpt::hwdrivers::COpenNI2Generic::m_grab_3D_points.
|
inline |
Enable/disable the grabbing of the depth channel.
Definition at line 335 of file COpenNI2Sensor.h.
References mrpt::hwdrivers::COpenNI2Generic::m_grab_depth.
|
inline |
Enable/disable the grabbing of the RGB channel.
Definition at line 332 of file COpenNI2Sensor.h.
References mrpt::hwdrivers::COpenNI2Generic::m_grab_image.
|
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 104 of file CGenericSensor.h.
References mrpt::hwdrivers::CGenericSensor::m_verbose.
|
inline |
Get a const reference to the depth camera calibration parameters.
Definition at line 311 of file COpenNI2Sensor.h.
References m_cameraParamsDepth.
|
inline |
Get a const reference to the depth camera calibration parameters.
Definition at line 301 of file COpenNI2Sensor.h.
References m_cameraParamsRGB.
|
inherited |
Definition at line 537 of file COpenNI2Generic.cpp.
References mrpt::hwdrivers::COpenNI2Generic::CDevice::COLOR_STREAM, mrpt::hwdrivers::COpenNI2Generic::isOpen(), MRPT_UNUSED_PARAM, THROW_EXCEPTION, vDevices, and vDevices_mx.
|
inherited |
Get a list of the connected OpenNI2 sensors.
This method can or cannot be implemented in the derived class, depending on the need for it.
This | method must throw an exception with a descriptive message if some critical error is found. |
Definition at line 166 of file COpenNI2Generic.cpp.
References mrpt::format(), mrpt::hwdrivers::COpenNI2Generic::getNumDevices(), mrpt::hwdrivers::COpenNI2Generic::m_depth_format, mrpt::hwdrivers::COpenNI2Generic::m_rgb_format, mrpt::hwdrivers::COpenNI2Generic::m_verbose, mrpt::hwdrivers::COpenNI2Generic::showLog(), THROW_EXCEPTION, vDevices, and vDevices_mx.
|
inherited |
Definition at line 554 of file COpenNI2Generic.cpp.
References mrpt::hwdrivers::COpenNI2Generic::CDevice::DEPTH_STREAM, mrpt::hwdrivers::COpenNI2Generic::isOpen(), MRPT_UNUSED_PARAM, THROW_EXCEPTION, vDevices, and vDevices_mx.
|
inherited |
Get the ID of the device corresponding to 'SerialRequired'.
Definition at line 368 of file COpenNI2Generic.cpp.
References MRPT_UNUSED_PARAM, THROW_EXCEPTION, vDevices, and vDevices_mx.
|
inlineinherited |
Definition at line 288 of file CGenericSensor.h.
References mrpt::hwdrivers::CGenericSensor::m_external_images_jpeg_quality.
|
inline |
Get the maximum range (meters) that can be read in the observation field "rangeImage".
Definition at line 293 of file COpenNI2Sensor.h.
References m_maxRange.
|
inherited |
The main data retrieving function, to be called after calling loadConfig() and initialize().
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. |
Definition at line 466 of file COpenNI2Generic.cpp.
References mrpt::format(), mrpt::hwdrivers::COpenNI2Generic::getNumDevices(), MRPT_UNUSED_PARAM, mrpt::hwdrivers::COpenNI2Generic::showLog(), THROW_EXCEPTION, and vDevices.
|
inherited |
The main data retrieving function, to be called after calling loadConfig() and initialize().
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. |
out_obs | The output retrieved observation (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. |
Definition at line 424 of file COpenNI2Generic.cpp.
References mrpt::format(), mrpt::hwdrivers::COpenNI2Generic::getNumDevices(), MRPT_UNUSED_PARAM, mrpt::hwdrivers::COpenNI2Generic::showLog(), THROW_EXCEPTION, and vDevices.
|
inherited |
The main data retrieving function, to be called after calling loadConfig() and initialize().
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. |
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. |
Definition at line 506 of file COpenNI2Generic.cpp.
References mrpt::format(), mrpt::hwdrivers::COpenNI2Generic::getNumDevices(), MRPT_UNUSED_PARAM, mrpt::hwdrivers::COpenNI2Generic::showLog(), THROW_EXCEPTION, and vDevices.
void 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().
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. |
Definition at line 278 of file COpenNI2Sensor.cpp.
References mrpt::obs::CObservation3DRangeScan::cameraParams, mrpt::obs::CObservation3DRangeScan::cameraParamsIntensity, mrpt::gui::CDisplayWindow::Create(), mrpt::obs::CObservation3DRangeScan::hasIntensityImage, mrpt::obs::CObservation3DRangeScan::hasRangeImage, mrpt::obs::CObservation3DRangeScan::intensityImage, MRPT_UNUSED_PARAM, mrpt::obs::CObservation3DRangeScan::project3DPointsFromDepthImage(), mrpt::obs::CObservation3DRangeScan::rangeImage, mrpt::obs::CObservation3DRangeScan::relativePoseIntensityWRTDepth, mrpt::math::CMatrixDynamic< T >::resize(), mrpt::obs::CObservation::sensorLabel, mrpt::obs::CObservation3DRangeScan::sensorPose, and THROW_EXCEPTION.
|
inherited |
The number of available devices at initialization.
Definition at line 146 of file COpenNI2Generic.cpp.
References vDevices, and vDevices_mx.
Referenced by mrpt::hwdrivers::COpenNI2Generic::close(), mrpt::hwdrivers::COpenNI2Generic::getConnectedDevices(), mrpt::hwdrivers::COpenNI2Generic::getNextFrameD(), mrpt::hwdrivers::COpenNI2Generic::getNextFrameRGB(), mrpt::hwdrivers::COpenNI2Generic::getNextFrameRGBD(), mrpt::hwdrivers::COpenNI2Generic::isOpen(), and mrpt::hwdrivers::COpenNI2Generic::open().
|
staticinherited |
Get the number of OpenNI2 cameras currently open via COpenNI2Generic.
Definition at line 55 of file COpenNI2Generic.cpp.
References numInstances().
|
inherited |
Returns a list of enqueued objects, emptying it (thread-safe).
The objects must be freed by the invoker.
Definition at line 85 of file CGenericSensor.cpp.
References mrpt::hwdrivers::CGenericSensor::m_csObjList, and mrpt::hwdrivers::CGenericSensor::m_objList.
Referenced by TEST().
|
inlineinherited |
Definition at line 92 of file CGenericSensor.h.
References mrpt::hwdrivers::CGenericSensor::m_process_rate.
|
inline |
Definition at line 326 of file COpenNI2Sensor.h.
References m_relativePoseIntensityWRTDepth.
|
pure virtualinherited |
|
inlineinherited |
Definition at line 93 of file CGenericSensor.h.
References mrpt::hwdrivers::CGenericSensor::m_sensorLabel.
|
inlineinherited |
The current state of the sensor.
Definition at line 91 of file CGenericSensor.h.
References mrpt::hwdrivers::CGenericSensor::m_state.
|
overridevirtual |
Initializes the 3D camera - should be invoked after calling loadConfig() or setting the different parameters with the set*() methods.
This method can or cannot be implemented in the derived class, depending on the need for it.
This | method must throw an exception with a descriptive message if some critical error is found. |
Reimplemented from mrpt::hwdrivers::CGenericSensor.
Definition at line 88 of file COpenNI2Sensor.cpp.
References mrpt::format(), isValidParameter(), and THROW_EXCEPTION.
|
inline |
Definition at line 342 of file COpenNI2Sensor.h.
References mrpt::hwdrivers::COpenNI2Generic::m_grab_3D_points.
|
inline |
Definition at line 336 of file COpenNI2Sensor.h.
References mrpt::hwdrivers::COpenNI2Generic::m_grab_depth.
|
inline |
Definition at line 333 of file COpenNI2Sensor.h.
References mrpt::hwdrivers::COpenNI2Generic::m_grab_image.
|
inherited |
Whether there is a working connection to the sensor.
Definition at line 244 of file COpenNI2Generic.cpp.
References mrpt::hwdrivers::COpenNI2Generic::getNumDevices(), MRPT_UNUSED_PARAM, THROW_EXCEPTION, vDevices, and vDevices_mx.
Referenced by mrpt::hwdrivers::COpenNI2Generic::getColorSensorParam(), mrpt::hwdrivers::COpenNI2Generic::getDepthSensorParam(), mrpt::hwdrivers::COpenNI2Generic::open(), and mrpt::hwdrivers::COpenNI2Generic::openDevicesBySerialNum().
|
inherited |
Definition at line 152 of file COpenNI2Generic.cpp.
References mrpt::hwdrivers::COpenNI2Generic::m_verbose.
Referenced by mrpt::hwdrivers::COpenNI2Generic::showLog().
|
inlineinherited |
Definition at line 105 of file CGenericSensor.h.
References mrpt::hwdrivers::CGenericSensor::m_verbose.
|
inherited |
Kill the OpenNI2 driver.
Definition at line 233 of file COpenNI2Generic.cpp.
References THROW_EXCEPTION, vDevices, and vDevices_mx.
Referenced by mrpt::hwdrivers::COpenNI2Generic::~COpenNI2Generic().
|
inherited |
Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensorSpecific".
This | method throws an exception with a descriptive message if some critical parameter is missing or has an invalid value. |
Definition at line 126 of file CGenericSensor.cpp.
References mrpt::hwdrivers::CGenericSensor::loadConfig_sensorSpecific(), mrpt::hwdrivers::CGenericSensor::m_grab_decimation, mrpt::hwdrivers::CGenericSensor::m_grab_decimation_counter, mrpt::hwdrivers::CGenericSensor::m_max_queue_len, mrpt::hwdrivers::CGenericSensor::m_process_rate, mrpt::hwdrivers::CGenericSensor::m_sensorLabel, MRPT_END, MRPT_START, mrpt::config::CConfigFileBase::read_double(), mrpt::config::CConfigFileBase::read_int(), and mrpt::config::CConfigFileBase::read_string().
|
overrideprotectedvirtual |
Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see config::CConfigFileBase and derived classes)
This | method must throw an exception with a descriptive message if some critical parameter is missing or has an invalid value. |
Implements mrpt::hwdrivers::CGenericSensor.
Definition at line 190 of file COpenNI2Sensor.cpp.
References mrpt::DEG2RAD(), mrpt::img::TStereoCamera::leftCamera, mrpt::img::TStereoCamera::loadFromConfigFile(), mrpt::config::CConfigFileBase::read_bool(), mrpt::config::CConfigFileBase::read_float(), mrpt::config::CConfigFileBase::read_int(), mrpt::config::CConfigFileBase::read_string(), mrpt::img::TStereoCamera::rightCamera, mrpt::img::TStereoCamera::rightCameraPose, mrpt::config::CConfigFileBase::sectionExists(), and twist().
|
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.
std::exception | A textual description of the error. |
Definition at line 259 of file COpenNI2Generic.cpp.
References mrpt::format(), mrpt::hwdrivers::COpenNI2Generic::getNumDevices(), mrpt::hwdrivers::COpenNI2Generic::isOpen(), mrpt::hwdrivers::COpenNI2Generic::m_fps, mrpt::hwdrivers::COpenNI2Generic::m_height, mrpt::hwdrivers::COpenNI2Generic::m_verbose, mrpt::hwdrivers::COpenNI2Generic::m_width, MRPT_UNUSED_PARAM, mrpt::hwdrivers::COpenNI2Generic::showLog(), THROW_EXCEPTION, vDevices, and vDevices_mx.
Referenced by mrpt::hwdrivers::COpenNI2Generic::openDevicesBySerialNum().
|
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.
Definition at line 360 of file COpenNI2Generic.cpp.
References mrpt::hwdrivers::COpenNI2Generic::openDevicesBySerialNum().
|
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)
Definition at line 304 of file COpenNI2Generic.cpp.
References mrpt::format(), mrpt::hwdrivers::COpenNI2Generic::isOpen(), mrpt::hwdrivers::COpenNI2Generic::m_fps, mrpt::hwdrivers::COpenNI2Generic::m_height, mrpt::hwdrivers::COpenNI2Generic::m_verbose, mrpt::hwdrivers::COpenNI2Generic::m_width, MRPT_UNUSED_PARAM, mrpt::hwdrivers::COpenNI2Generic::open(), mrpt::hwdrivers::COpenNI2Generic::showLog(), THROW_EXCEPTION, vDevices, and vDevices_mx.
Referenced by mrpt::hwdrivers::COpenNI2Generic::openDeviceBySerial().
|
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.
Definition at line 115 of file CGenericSensor.cpp.
References mrpt::hwdrivers::TSensorClassId::className, and mrpt::hwdrivers::CGenericSensor::get_registered_sensor_classes().
Referenced by mrpt::hwdrivers::CGenericSensor::CLASSINIT_GENERIC_SENSOR::CLASSINIT_GENERIC_SENSOR().
|
inline |
Get the row count in the camera images, loaded automatically upon camera open().
Definition at line 296 of file COpenNI2Sensor.h.
References m_cameraParamsRGB, and mrpt::img::TCamera::nrows.
|
inline |
Definition at line 315 of file COpenNI2Sensor.h.
References m_cameraParamsDepth.
|
inline |
Definition at line 305 of file COpenNI2Sensor.h.
References m_cameraParamsRGB.
|
inlineinherited |
Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The default is "jpg".
Definition at line 277 of file CGenericSensor.h.
References mrpt::hwdrivers::CGenericSensor::m_external_images_format.
|
inlineinherited |
The quality of JPEG compression, when external images is enabled and the format is "jpg".
Definition at line 284 of file CGenericSensor.h.
References mrpt::hwdrivers::CGenericSensor::m_external_images_jpeg_quality.
|
overridevirtual |
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.
std::exception | If the directory doesn't exists and cannot be created. |
Reimplemented from mrpt::hwdrivers::CGenericSensor.
Definition at line 366 of file COpenNI2Sensor.cpp.
References MRPT_UNUSED_PARAM.
|
inline |
Set the pose of the intensity camera wrt the depth camera.
Definition at line 322 of file COpenNI2Sensor.h.
References m_relativePoseIntensityWRTDepth.
|
inline |
Set the sensor_id of the device to open.
This | method must throw an exception when such serial number is not found among the connected devices. |
Definition at line 242 of file COpenNI2Sensor.h.
References m_user_device_number.
|
inlineinherited |
Definition at line 94 of file CGenericSensor.h.
References mrpt::hwdrivers::CGenericSensor::m_sensorLabel.
|
inline |
Set the serial number of the device to open.
This | method must throw an exception when such serial number is not found among the connected devices. |
Definition at line 233 of file COpenNI2Sensor.h.
References m_serial_number.
|
inherited |
Definition at line 151 of file COpenNI2Generic.cpp.
References mrpt::hwdrivers::COpenNI2Generic::m_verbose.
|
protectedinherited |
Definition at line 153 of file COpenNI2Generic.cpp.
References mrpt::hwdrivers::COpenNI2Generic::isVerbose().
Referenced by mrpt::hwdrivers::COpenNI2Generic::getConnectedDevices(), mrpt::hwdrivers::COpenNI2Generic::getNextFrameD(), mrpt::hwdrivers::COpenNI2Generic::getNextFrameRGB(), mrpt::hwdrivers::COpenNI2Generic::getNextFrameRGBD(), mrpt::hwdrivers::COpenNI2Generic::open(), and mrpt::hwdrivers::COpenNI2Generic::openDevicesBySerialNum().
|
inherited |
Open all sensor streams (normally called automatically at constructor, no need to call it manually).
Definition at line 112 of file COpenNI2Generic.cpp.
References numInstances(), and THROW_EXCEPTION.
Referenced by mrpt::hwdrivers::COpenNI2Generic::COpenNI2Generic().
|
protected |
Params for the Depth camera.
Definition at line 366 of file COpenNI2Sensor.h.
Referenced by getCameraParamsDepth(), and setCameraParamsDepth().
|
protected |
Params for the RGB camera.
Definition at line 363 of file COpenNI2Sensor.h.
Referenced by cols(), getCameraParamsIntensity(), rows(), and setCameraParamsIntensity().
|
protectedinherited |
Definition at line 154 of file COpenNI2Generic.h.
Referenced by mrpt::hwdrivers::COpenNI2Generic::getConnectedDevices().
|
protectedinherited |
The extension ("jpg","gif","png",...) that determines the format of images saved externally.
Definition at line 156 of file CGenericSensor.h.
Referenced by mrpt::hwdrivers::CSwissRanger3DCamera::getNextObservation(), mrpt::hwdrivers::CSwissRanger3DCamera::loadConfig_sensorSpecific(), and mrpt::hwdrivers::CGenericSensor::setExternalImageFormat().
|
protectedinherited |
For JPEG images, the quality (default=95%).
Definition at line 158 of file CGenericSensor.h.
Referenced by mrpt::hwdrivers::CGenericSensor::getExternalImageJPEGQuality(), mrpt::hwdrivers::CSwissRanger3DCamera::getNextObservation(), mrpt::hwdrivers::CSwissRanger3DCamera::loadConfig_sensorSpecific(), and mrpt::hwdrivers::CGenericSensor::setExternalImageJPEGQuality().
|
protectedinherited |
Definition at line 153 of file COpenNI2Generic.h.
Referenced by mrpt::hwdrivers::COpenNI2Generic::open(), and mrpt::hwdrivers::COpenNI2Generic::openDevicesBySerialNum().
|
protectedinherited |
Definition at line 160 of file COpenNI2Generic.h.
Referenced by enableGrab3DPoints(), and isGrab3DPointsEnabled().
|
protectedinherited |
If set to N>=2, only 1 out of N observations will be saved to m_objList.
Definition at line 137 of file CGenericSensor.h.
Referenced by mrpt::hwdrivers::CGenericSensor::appendObservations(), and mrpt::hwdrivers::CGenericSensor::loadConfig().
|
protectedinherited |
Used when "m_grab_decimation" is enabled.
Definition at line 144 of file CGenericSensor.h.
Referenced by mrpt::hwdrivers::CGenericSensor::appendObservations(), and mrpt::hwdrivers::CGenericSensor::loadConfig().
|
protectedinherited |
Definition at line 160 of file COpenNI2Generic.h.
Referenced by enableGrabDepth(), and isGrabDepthEnabled().
|
protectedinherited |
The data that the RGBD sensors can return.
Default: all true
Definition at line 160 of file COpenNI2Generic.h.
Referenced by enableGrabRGB(), and isGrabRGBEnabled().
|
protectedinherited |
Definition at line 152 of file COpenNI2Generic.h.
Referenced by mrpt::hwdrivers::COpenNI2Generic::open(), and mrpt::hwdrivers::COpenNI2Generic::openDevicesBySerialNum().
|
protectedinherited |
See CGenericSensor.
Definition at line 134 of file CGenericSensor.h.
Referenced by mrpt::hwdrivers::CGenericSensor::loadConfig().
|
protected |
Sensor max range (meters)
Definition at line 373 of file COpenNI2Sensor.h.
Referenced by getMaxRange().
|
protectedinherited |
The path where to save off-rawlog images: empty means save images embedded in the rawlog.
Definition at line 153 of file CGenericSensor.h.
Referenced by mrpt::hwdrivers::CSwissRanger3DCamera::getNextObservation(), and mrpt::hwdrivers::CSwissRanger3DCamera::setPathForExternalImages().
|
protected |
Definition at line 358 of file COpenNI2Sensor.h.
|
protected |
Definition at line 358 of file COpenNI2Sensor.h.
|
protected |
Show preview window while grabbing.
Definition at line 354 of file COpenNI2Sensor.h.
|
protected |
If preview is enabled, only show 1 out of N images.
Definition at line 357 of file COpenNI2Sensor.h.
|
protectedinherited |
See CGenericSensor.
Definition at line 132 of file CGenericSensor.h.
Referenced by mrpt::hwdrivers::CGenericSensor::getProcessRate(), mrpt::hwdrivers::CGyroKVHDSP3000::initialize(), and mrpt::hwdrivers::CGenericSensor::loadConfig().
|
protected |
See mrpt::obs::CObservation3DRangeScan for a diagram of this pose.
Definition at line 369 of file COpenNI2Sensor.h.
Referenced by getRelativePoseIntensityWrtDepth(), and setRelativePoseIntensityWrtDepth().
|
protectedinherited |
Definition at line 154 of file COpenNI2Generic.h.
Referenced by mrpt::hwdrivers::COpenNI2Generic::getConnectedDevices().
|
protectedinherited |
See CGenericSensor.
Definition at line 139 of file CGenericSensor.h.
Referenced by mrpt::hwdrivers::CCANBusReader::CCANBusReader(), mrpt::hwdrivers::CGPSInterface::CGPSInterface(), mrpt::hwdrivers::CGyroKVHDSP3000::CGyroKVHDSP3000(), mrpt::hwdrivers::CHokuyoURG::CHokuyoURG(), mrpt::hwdrivers::CIMUXSens::CIMUXSens(), mrpt::hwdrivers::CIMUXSens_MT4::CIMUXSens_MT4(), mrpt::hwdrivers::CKinect::CKinect(), mrpt::hwdrivers::CNationalInstrumentsDAQ::CNationalInstrumentsDAQ(), mrpt::hwdrivers::CRoboPeakLidar::CRoboPeakLidar(), mrpt::hwdrivers::CSickLaserSerial::CSickLaserSerial(), mrpt::hwdrivers::CSickLaserUSB::CSickLaserUSB(), mrpt::hwdrivers::CSkeletonTracker::CSkeletonTracker(), mrpt::hwdrivers::CSwissRanger3DCamera::CSwissRanger3DCamera(), mrpt::hwdrivers::CVelodyneScanner::CVelodyneScanner(), mrpt::hwdrivers::CIMUXSens_MT4::doProcess(), mrpt::hwdrivers::CIMUXSens::doProcess(), mrpt::hwdrivers::CGyroKVHDSP3000::doProcess(), mrpt::hwdrivers::CSkeletonTracker::doProcess(), mrpt::hwdrivers::CRoboPeakLidar::doProcessSimple(), mrpt::hwdrivers::CSickLaserUSB::doProcessSimple(), mrpt::hwdrivers::CCANBusReader::doProcessSimple(), mrpt::hwdrivers::CSickLaserSerial::doProcessSimple(), mrpt::hwdrivers::CHokuyoURG::doProcessSimple(), mrpt::hwdrivers::CGPSInterface::flushParsedMessagesNow(), mrpt::hwdrivers::CSwissRanger3DCamera::getNextObservation(), mrpt::hwdrivers::CKinect::getNextObservation(), mrpt::hwdrivers::CVelodyneScanner::getNextObservation(), mrpt::hwdrivers::CGenericSensor::getSensorLabel(), mrpt::hwdrivers::CNationalInstrumentsDAQ::grabbing_thread(), mrpt::hwdrivers::CGenericSensor::loadConfig(), mrpt::hwdrivers::CSkeletonTracker::processPreview(), mrpt::hwdrivers::C2DRangeFinderAbstract::processPreview(), mrpt::hwdrivers::CSkeletonTracker::processPreviewNone(), and mrpt::hwdrivers::CGenericSensor::setSensorLabel().
|
protected |
Definition at line 350 of file COpenNI2Sensor.h.
|
protected |
Serial number of device to open.
Definition at line 380 of file COpenNI2Sensor.h.
Referenced by setSerialToOpen().
|
protectedinherited |
Definition at line 146 of file CGenericSensor.h.
Referenced by mrpt::hwdrivers::CGyroKVHDSP3000::CGyroKVHDSP3000(), mrpt::hwdrivers::CIMUXSens_MT4::doProcess(), mrpt::hwdrivers::CIMUXSens::doProcess(), mrpt::hwdrivers::CGyroKVHDSP3000::doProcess(), mrpt::hwdrivers::CSkeletonTracker::doProcess(), mrpt::hwdrivers::CSwissRanger3DCamera::doProcess(), mrpt::hwdrivers::C2DRangeFinderAbstract::doProcess(), mrpt::hwdrivers::CGPSInterface::doProcess(), mrpt::hwdrivers::CNationalInstrumentsDAQ::doProcess(), mrpt::hwdrivers::CKinect::doProcess(), mrpt::hwdrivers::CVelodyneScanner::doProcess(), mrpt::hwdrivers::CSickLaserUSB::doProcessSimple(), mrpt::hwdrivers::CCANBusReader::doProcessSimple(), mrpt::hwdrivers::CSickLaserSerial::doProcessSimple(), mrpt::hwdrivers::CHokuyoURG::doProcessSimple(), mrpt::hwdrivers::CGPSInterface::flushParsedMessagesNow(), mrpt::hwdrivers::CVelodyneScanner::getNextObservation(), mrpt::hwdrivers::CGenericSensor::getState(), mrpt::hwdrivers::CIMUXSens_MT4::initialize(), mrpt::hwdrivers::CIMUXSens::initialize(), mrpt::hwdrivers::CGyroKVHDSP3000::initialize(), mrpt::hwdrivers::CSkeletonTracker::initialize(), mrpt::hwdrivers::CVelodyneScanner::initialize(), mrpt::hwdrivers::CNationalInstrumentsDAQ::readFromDAQ(), and mrpt::hwdrivers::CIMUXSens::searchPortAndConnect().
|
protected |
Number of device to open (0:first,...)
Definition at line 377 of file COpenNI2Sensor.h.
Referenced by setSensorIDToOpen().
|
protectedinherited |
Definition at line 147 of file CGenericSensor.h.
Referenced by mrpt::hwdrivers::CGenericSensor::CGenericSensor(), mrpt::hwdrivers::CRoboPeakLidar::checkCOMMs(), mrpt::hwdrivers::CNTRIPEmitter::doProcess(), mrpt::hwdrivers::CGPSInterface::doProcess(), mrpt::hwdrivers::CGenericSensor::enableVerbose(), mrpt::hwdrivers::CNationalInstrumentsDAQ::grabbing_thread(), mrpt::hwdrivers::CIMUXSens_MT4::initialize(), mrpt::hwdrivers::CHokuyoURG::initialize(), mrpt::hwdrivers::CVelodyneScanner::internal_read_PCAP_packet(), mrpt::hwdrivers::CGenericSensor::isVerboseEnabled(), mrpt::hwdrivers::CGPSInterface::JAVAD_sendMessage(), mrpt::hwdrivers::CGPSInterface::legacy_topcon_setup_commands(), mrpt::hwdrivers::CSickLaserSerial::LMS_setupBaudrate(), mrpt::hwdrivers::CSickLaserSerial::LMS_setupSerialComms(), mrpt::hwdrivers::CSickLaserSerial::LMS_waitIncomingFrame(), mrpt::hwdrivers::CGPSInterface::OnConnectionEstablished(), mrpt::hwdrivers::CGPSInterface::OnConnectionShutdown(), mrpt::hwdrivers::CSickLaserSerial::SendCommandToSICK(), mrpt::hwdrivers::CNationalInstrumentsDAQ::stop(), and mrpt::hwdrivers::CGPSInterface::tryToOpenTheCOM().
|
protectedinherited |
Definition at line 155 of file COpenNI2Generic.h.
Referenced by mrpt::hwdrivers::COpenNI2Generic::COpenNI2Generic(), mrpt::hwdrivers::COpenNI2Generic::getConnectedDevices(), mrpt::hwdrivers::COpenNI2Generic::isVerbose(), mrpt::hwdrivers::COpenNI2Generic::open(), mrpt::hwdrivers::COpenNI2Generic::openDevicesBySerialNum(), and mrpt::hwdrivers::COpenNI2Generic::setVerbose().
|
protectedinherited |
The same options (width, height and fps) are set for all the sensors.
(This could be changed if necessary)
Definition at line 152 of file COpenNI2Generic.h.
Referenced by mrpt::hwdrivers::COpenNI2Generic::open(), and mrpt::hwdrivers::COpenNI2Generic::openDevicesBySerialNum().
|
protected |
Definition at line 359 of file COpenNI2Sensor.h.
|
protected |
Definition at line 359 of file COpenNI2Sensor.h.
|
protectedinherited |
A vector with the serial numbers of the available devices.
Definition at line 144 of file COpenNI2Generic.h.
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019 |