Main MRPT website > C++ reference
MRPT logo
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes
mrpt::slam::CObservationRGBD360 Class Reference

Detailed Description

Declares a class derived from "CObservation" that encapsules an omnidirectional RGBD measurement from a set of RGBD sensors.

This kind of observations can carry one or more of these data fields:

The coordinates of the 3D point cloud are in millimeters with respect to the RGB camera origin of coordinates

The 2D images and matrices are stored as common images, with an up->down rows order and left->right, as usual. Optionally, the intensity and confidence channels can be set to delayed-load images for off-rawlog storage so it saves memory by having loaded in memory just the needed images. See the methods load() and unload(). Due to the intensive storage requirements of this kind of observations, this observation is the only one in MRPT for which it's recommended to always call "load()" and "unload()" before and after using the observation, ONLY when the observation was read from a rawlog dataset, in order to make sure that all the externally stored data fields are loaded and ready in memory.

Classes that grab observations of this type are:

3D point clouds can be generated at any moment after grabbing with CObservationRGBD360::project3DPointsFromDepthImage() and CObservationRGBD360::project3DPointsFromDepthImageInto(), provided the correct calibration parameters.

Note
Starting at serialization version 3 (MRPT 0.9.1+), the 3D point cloud and the rangeImage can both be stored externally to save rawlog space.
Starting at serialization version 5 (MRPT 0.9.5+), the new field range_is_depth
Starting at serialization version 6 (MRPT 0.9.5+), the new field intensityImageChannel
See Also
mrpt::hwdrivers::CSwissRanger3DCamera, mrpt::hwdrivers::COpenNI2_RGBD360, CObservation

Definition at line 66 of file CObservationRGBD360.h.

#include <mrpt/slam/CObservationRGBD360.h>

Inheritance diagram for mrpt::slam::CObservationRGBD360:
Inheritance graph
[legend]

Public Member Functions

void * operator new (size_t size)
 
void * operator new[] (size_t size)
 
void operator delete (void *ptr) throw ()
 
void operator delete[] (void *ptr) throw ()
 
void operator delete (void *memory, void *ptr) throw ()
 
void * operator new (size_t size, const std::nothrow_t &) throw ()
 
void operator delete (void *ptr, const std::nothrow_t &) throw ()
 
 CObservationRGBD360 ()
 Default constructor. More...
 
virtual ~CObservationRGBD360 ()
 Destructor. More...
 
void rangeImage_setSize (const int HEIGHT, const int WIDTH, const unsigned sensor_id)
 Similar to calling "rangeImage.setSize(H,W)" but this method provides memory pooling to speed-up the memory allocation. More...
 
void getSensorPose (CPose3D &out_sensorPose) const
 A general method to retrieve the sensor pose on the robot. More...
 
void setSensorPose (const CPose3D &newSensorPose)
 A general method to change the sensor pose on the robot. More...
 
template<class METRICMAP >
bool insertObservationInto (METRICMAP *theMap, const CPose3D *robotPose=NULL) const
 This method is equivalent to: More...
 
void getSensorPose (mrpt::math::TPose3D &out_sensorPose) const
 A general method to retrieve the sensor pose on the robot. More...
 
void setSensorPose (const mrpt::math::TPose3D &newSensorPose)
 A general method to change the sensor pose on the robot. More...
 
mrpt::utils::CObjectPtr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer). More...
 
CObjectclone () const
 Cloning interface for smart pointers. More...
 
Delayed-load manual control methods.
virtual void load () const
 Makes sure all images and other fields which may be externally stored are loaded in memory. More...
 
virtual void unload ()
 Unload all images, for the case they being delayed-load images stored in external files (othewise, has no effect). More...
 

Static Public Member Functions

static void * operator new (size_t size, void *ptr)
 

Public Attributes

mrpt::system::TTimeStamp timestamps [NUM_SENSORS]
 
bool hasRangeImage
 true means the field rangeImage contains valid data More...
 
mrpt::math::CMatrix rangeImages [NUM_SENSORS]
 If hasRangeImage=true, a matrix of floats with the range data as captured by the camera (in meters) More...
 
bool hasIntensityImage
 Forces marking this observation as non-externally stored - it doesn't anything else apart from reseting the corresponding flag (Users won't normally want to call this, it's only used from internal MRPT programs) More...
 
mrpt::utils::CImage intensityImages [NUM_SENSORS]
 If hasIntensityImage=true, a color or gray-level intensity image of the same size than "rangeImage". More...
 
mrpt::utils::TCamera sensorParamss [NUM_SENSORS]
 Projection parameters of the 8 RGBD sensor. More...
 
float maxRange
 The maximum range allowed by the device, in meters (e.g. 8.0m, 5.0m,...) More...
 
CPose3D sensorPose
 The 6D pose of the sensor on the robot. More...
 
float stdError
 The "sigma" error of the device in meters, used while inserting the scan in an occupancy grid. More...
 
Data common to any observation
mrpt::system::TTimeStamp timestamp
 The associated time-stamp. More...
 
std::string sensorLabel
 An arbitrary label that can be used to identify the sensor. More...
 

Static Public Attributes

static const int NUM_SENSORS = 2
 Project the RGB+D images into a 3D point cloud (with color if the target map supports it) and optionally at a given 3D pose. More...
 
static const
mrpt::utils::TRuntimeClassId 
classCObject
 
RTTI stuff
static const
mrpt::utils::TRuntimeClassId 
classCObservation
 
RTTI stuff
static const
mrpt::utils::TRuntimeClassId 
classCSerializable
 

Protected Member Functions

void swap (CObservation &o)
 Swap with another observation, ONLY the data defined here in the base class CObservation. It's protected since it'll be only called from child classes that should know what else to swap appart from these common data. More...
 
CSerializable virtual methods
void writeToStream (mrpt::utils::CStream &out, int *getVersion) const
 Introduces a pure virtual method responsible for writing to a CStream. More...
 
void readFromStream (mrpt::utils::CStream &in, int version)
 Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori. More...
 

Protected Attributes

bool m_points3D_external_stored
 If set to true, m_points3D_external_file is valid. More...
 
std::string m_points3D_external_file
 3D points are in CImage::IMAGES_PATH_BASE+<this_file_name> More...
 
bool m_rangeImage_external_stored
 If set to true, m_rangeImage_external_file is valid. More...
 
std::string m_rangeImage_external_file
 rangeImage is in CImage::IMAGES_PATH_BASE+<this_file_name> More...
 

RTTI stuff

typedef CObservationRGBD360Ptr SmartPtr
 
static mrpt::utils::CLASSINIT _init_CObservationRGBD360
 
static mrpt::utils::TRuntimeClassId classCObservationRGBD360
 
static const
mrpt::utils::TRuntimeClassId
classinfo
 
static const
mrpt::utils::TRuntimeClassId
_GetBaseClass ()
 
virtual const
mrpt::utils::TRuntimeClassId
GetRuntimeClass () const
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class. More...
 
static mrpt::utils::CObjectCreateObject ()
 
static CObservationRGBD360Ptr Create ()
 

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 69 of file CObservationRGBD360.h.

Constructor & Destructor Documentation

mrpt::slam::CObservationRGBD360::CObservationRGBD360 ( )

Default constructor.

virtual mrpt::slam::CObservationRGBD360::~CObservationRGBD360 ( )
virtual

Destructor.

Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::slam::CObservationRGBD360::_GetBaseClass ( )
staticprotected
CObject* mrpt::utils::CObject::clone ( ) const
inlineinherited

Cloning interface for smart pointers.

Definition at line 139 of file CObject.h.

static CObservationRGBD360Ptr mrpt::slam::CObservationRGBD360::Create ( )
static
static mrpt::utils::CObject* mrpt::slam::CObservationRGBD360::CreateObject ( )
static
virtual mrpt::utils::CObject* mrpt::slam::CObservationRGBD360::duplicate ( ) const
virtual

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

mrpt::utils::CObjectPtr mrpt::utils::CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 136 of file CObject.h.

virtual const mrpt::utils::TRuntimeClassId* mrpt::slam::CObservationRGBD360::GetRuntimeClass ( ) const
virtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::slam::CObservation.

void mrpt::slam::CObservation::getSensorPose ( mrpt::math::TPose3D out_sensorPose) const
inherited

A general method to retrieve the sensor pose on the robot.

Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.

See Also
setSensorPose
void mrpt::slam::CObservationRGBD360::getSensorPose ( CPose3D out_sensorPose) const
inlinevirtual

A general method to retrieve the sensor pose on the robot.

Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.

See Also
setSensorPose

Implements mrpt::slam::CObservation.

Definition at line 254 of file CObservationRGBD360.h.

template<class METRICMAP >
bool mrpt::slam::CObservation::insertObservationInto ( METRICMAP *  theMap,
const CPose3D robotPose = NULL 
) const
inlineinherited

This method is equivalent to:

map->insertObservation(this, robotPose)
Parameters
theMapThe map where this observation is to be inserted: the map will be updated.
robotPoseThe pose of the robot base for this observation, relative to the target metric map. Set to NULL (default) to use (0,0,0deg)
Returns
Returns true if the map has been updated, or false if this observations has nothing to do with a metric map (for example, a sound observation).
See Also
CMetricMap, CMetricMap::insertObservation

Definition at line 93 of file CObservation.h.

virtual void mrpt::slam::CObservation::load ( ) const
inlinevirtualinherited

Makes sure all images and other fields which may be externally stored are loaded in memory.

Note that for all CImages, calling load() is not required since the images will be automatically loaded upon first access, so load() shouldn't be needed to be called in normal cases by the user. If all the data were alredy loaded or this object has no externally stored data fields, calling this method has no effects.

See Also
unload

Reimplemented in mrpt::slam::CObservation3DRangeScan.

Definition at line 130 of file CObservation.h.

void mrpt::slam::CObservationRGBD360::operator delete ( void *  memory,
void *  ptr 
)
throw (
)
inline

Definition at line 69 of file CObservationRGBD360.h.

void mrpt::slam::CObservationRGBD360::operator delete ( void *  ptr)
throw (
)
inline

Definition at line 69 of file CObservationRGBD360.h.

void mrpt::slam::CObservationRGBD360::operator delete ( void *  ptr,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 69 of file CObservationRGBD360.h.

void mrpt::slam::CObservationRGBD360::operator delete[] ( void *  ptr)
throw (
)
inline

Definition at line 69 of file CObservationRGBD360.h.

static void* mrpt::slam::CObservationRGBD360::operator new ( size_t  size,
void *  ptr 
)
inlinestatic

Definition at line 69 of file CObservationRGBD360.h.

void* mrpt::slam::CObservationRGBD360::operator new ( size_t  size,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 69 of file CObservationRGBD360.h.

void* mrpt::slam::CObservationRGBD360::operator new ( size_t  size)
inline

Definition at line 69 of file CObservationRGBD360.h.

void* mrpt::slam::CObservationRGBD360::operator new[] ( size_t  size)
inline

Definition at line 69 of file CObservationRGBD360.h.

void mrpt::slam::CObservationRGBD360::rangeImage_setSize ( const int  HEIGHT,
const int  WIDTH,
const unsigned  sensor_id 
)

Similar to calling "rangeImage.setSize(H,W)" but this method provides memory pooling to speed-up the memory allocation.

void mrpt::slam::CObservationRGBD360::readFromStream ( mrpt::utils::CStream in,
int  version 
)
protectedvirtual

Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Parameters
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions
std::exceptionOn any error, see CStream::ReadBuffer
See Also
CStream

Implements mrpt::utils::CSerializable.

void mrpt::slam::CObservation::setSensorPose ( const mrpt::math::TPose3D newSensorPose)
inherited

A general method to change the sensor pose on the robot.

Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.

See Also
getSensorPose
void mrpt::slam::CObservationRGBD360::setSensorPose ( const CPose3D newSensorPose)
inlinevirtual

A general method to change the sensor pose on the robot.

Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.

See Also
getSensorPose

Implements mrpt::slam::CObservation.

Definition at line 260 of file CObservationRGBD360.h.

void mrpt::slam::CObservation::swap ( CObservation o)
protectedinherited

Swap with another observation, ONLY the data defined here in the base class CObservation. It's protected since it'll be only called from child classes that should know what else to swap appart from these common data.

virtual void mrpt::slam::CObservation::unload ( )
inlinevirtualinherited

Unload all images, for the case they being delayed-load images stored in external files (othewise, has no effect).

See Also
load

Reimplemented in mrpt::slam::CObservation3DRangeScan.

Definition at line 134 of file CObservation.h.

void mrpt::slam::CObservationRGBD360::writeToStream ( mrpt::utils::CStream out,
int *  getVersion 
) const
protectedvirtual

Introduces a pure virtual method responsible for writing to a CStream.

This can not be used directly be users, instead use "stream << object;" for writing it to a stream.

Parameters
outThe output binary stream where object must be dumped.
getVersionIf NULL, the object must be dumped. If not, only the version of the object dump must be returned in this pointer. This enables the versioning of objects dumping and backward compatibility with previously stored data.
Exceptions
std::exceptionOn any error, see CStream::WriteBuffer
See Also
CStream

Implements mrpt::utils::CSerializable.

Member Data Documentation

mrpt::utils::CLASSINIT mrpt::slam::CObservationRGBD360::_init_CObservationRGBD360
staticprotected

Definition at line 69 of file CObservationRGBD360.h.

const mrpt::utils::TRuntimeClassId mrpt::utils::CObject::classCObject
staticinherited

Definition at line 124 of file CObject.h.

const mrpt::utils::TRuntimeClassId mrpt::slam::CObservation::classCObservation
staticinherited

Definition at line 55 of file CObservation.h.

mrpt::utils::TRuntimeClassId mrpt::slam::CObservationRGBD360::classCObservationRGBD360
static

Definition at line 69 of file CObservationRGBD360.h.

const mrpt::utils::TRuntimeClassId mrpt::utils::CSerializable::classCSerializable
staticinherited

Definition at line 38 of file CSerializable.h.

const mrpt::utils::TRuntimeClassId* mrpt::slam::CObservationRGBD360::classinfo
static

Definition at line 69 of file CObservationRGBD360.h.

bool mrpt::slam::CObservationRGBD360::hasIntensityImage

Forces marking this observation as non-externally stored - it doesn't anything else apart from reseting the corresponding flag (Users won't normally want to call this, it's only used from internal MRPT programs)

Enum type for intensityImageChannel true means the field intensityImage contains valid data

Definition at line 237 of file CObservationRGBD360.h.

bool mrpt::slam::CObservationRGBD360::hasRangeImage

true means the field rangeImage contains valid data

Definition at line 211 of file CObservationRGBD360.h.

mrpt::utils::CImage mrpt::slam::CObservationRGBD360::intensityImages[NUM_SENSORS]

If hasIntensityImage=true, a color or gray-level intensity image of the same size than "rangeImage".

Definition at line 238 of file CObservationRGBD360.h.

std::string mrpt::slam::CObservationRGBD360::m_points3D_external_file
protected

3D points are in CImage::IMAGES_PATH_BASE+<this_file_name>

Definition at line 73 of file CObservationRGBD360.h.

bool mrpt::slam::CObservationRGBD360::m_points3D_external_stored
protected

If set to true, m_points3D_external_file is valid.

Definition at line 72 of file CObservationRGBD360.h.

std::string mrpt::slam::CObservationRGBD360::m_rangeImage_external_file
protected

rangeImage is in CImage::IMAGES_PATH_BASE+<this_file_name>

Definition at line 76 of file CObservationRGBD360.h.

bool mrpt::slam::CObservationRGBD360::m_rangeImage_external_stored
protected

If set to true, m_rangeImage_external_file is valid.

Definition at line 75 of file CObservationRGBD360.h.

float mrpt::slam::CObservationRGBD360::maxRange

The maximum range allowed by the device, in meters (e.g. 8.0m, 5.0m,...)

Definition at line 246 of file CObservationRGBD360.h.

const int mrpt::slam::CObservationRGBD360::NUM_SENSORS = 2
static

Project the RGB+D images into a 3D point cloud (with color if the target map supports it) and optionally at a given 3D pose.

The 3D point coordinates are computed from the depth image (rangeImage) and the depth camera camera parameters (cameraParams). There exist two set of formulas for projecting the i'th point, depending on the value of "range_is_depth". In all formulas below, "rangeImage" is the matrix of ranges and the pixel coordinates are (r,c).

1) [range_is_depth=true] With "range equals depth" or "Kinect-like depth mode": the range values are in fact distances along the "+X" axis, not real 3D ranges (this is the way Kinect reports ranges):

// * x(i) = rangeImage(r,c)
// * y(i) = (r_cx - c) * x(i) / r_fx
// * z(i) = (r_cy - r) * x(i) / r_fy
// *
                 2) [range_is_depth=false] With "normal ranges": range means distance in 3D. This must be set when
                     processing data from the SwissRange 3D camera, among others.
// * Ky = (r_cx - c)/r_fx
// * Kz = (r_cy - r)/r_fy
// *
// * x(i) = rangeImage(r,c) / sqrt( 1 + Ky^2 + Kz^2 )
// * y(i) = Ky * x(i)
// * z(i) = Kz * x(i)
// *
                 The color of each point is determined by projecting the 3D local point into the RGB image using \a cameraParamsIntensity.

                 By default the local coordinates of points are directly stored into the local map, but if indicated so in \a takeIntoAccountSensorPoseOnRobot
                 the points are transformed with \a sensorPose. Furthermore, if provided, those coordinates are transformed with \a robotPoseInTheWorld

                \param[in] PROJ3D_USE_LUT (Only when range_is_depth=true) Whether to use a Look-up-table (LUT) to speed up the conversion. It's thread safe in all situations <b>except</b> when you call this method from different threads <b>and</b> with different camera parameter matrices. In all other cases, it's a good idea to left it enabled.
                \tparam POINTMAP Supported maps are all those covered by mrpt::utils::PointCloudAdapter (mrpt::slam::CPointsMap and derived, mrpt::opengl::CPointCloudColoured, PCL point clouds,...)

                \note In MRPT < 0.9.5, this method always assumes that ranges were in Kinect-like format.

This method is equivalent to project3DPointsFromDepthImageInto() storing the projected 3D points (without color, in local coordinates) in this same class. For new code it's recommended to use instead project3DPointsFromDepthImageInto() which is much more versatile.Convert this 3D observation into an "equivalent 2D fake laser scan", with a configurable vertical FOV.

The result is a 2D laser scan with more "rays" (N) than columns has the 3D observation (W), exactly: N = W * oversampling_ratio. This oversampling is required since laser scans sample the space at evenly-separated angles, while a range camera follows a tangent-like distribution. By oversampling we make sure we don't leave "gaps" unseen by the virtual "2D laser".

All obstacles within a frustum are considered and the minimum distance is kept in each direction. The horizontal FOV of the frustum is automatically computed from the intrinsic parameters, but the vertical FOV must be provided by the user, and can be set to be assymetric which may be useful depending on the zone of interest where to look for obstacles.

All spatial transformations are riguorosly taken into account in this class, using the depth camera intrinsic calibration parameters.

The timestamp of the new object is copied from the 3D object. Obviously, a requisite for calling this method is the 3D observation having range data, i.e. hasRangeImage must be true. It's not needed to have RGB data nor the raw 3D point clouds for this method to work.

Parameters
[out]out_scan2dThe resulting 2D equivalent scan.
[in]sensorLabelThe sensor label that will have the newly created observation.
[in]angle_sup(Default=5deg) The upper half-FOV angle (in radians)
[in]angle_sup(Default=5deg) The lower half-FOV angle (in radians)
[in]oversampling_ratio(Default=1.2=120%) How many more laser scans rays to create (read above).
See Also
The example in http://www.mrpt.org/Example_Kinect_To_2D_laser_scanUse this method instead of resizing all three points3D_x, points3D_y & points3D_z to allow the usage of the internal memory pool.

Definition at line 207 of file CObservationRGBD360.h.

mrpt::math::CMatrix mrpt::slam::CObservationRGBD360::rangeImages[NUM_SENSORS]

If hasRangeImage=true, a matrix of floats with the range data as captured by the camera (in meters)

See Also
range_is_depth

Definition at line 212 of file CObservationRGBD360.h.

std::string mrpt::slam::CObservation::sensorLabel
inherited

An arbitrary label that can be used to identify the sensor.

Definition at line 71 of file CObservation.h.

mrpt::utils::TCamera mrpt::slam::CObservationRGBD360::sensorParamss[NUM_SENSORS]

Projection parameters of the 8 RGBD sensor.

Definition at line 243 of file CObservationRGBD360.h.

CPose3D mrpt::slam::CObservationRGBD360::sensorPose

The 6D pose of the sensor on the robot.

Definition at line 247 of file CObservationRGBD360.h.

float mrpt::slam::CObservationRGBD360::stdError

The "sigma" error of the device in meters, used while inserting the scan in an occupancy grid.

Definition at line 248 of file CObservationRGBD360.h.

mrpt::system::TTimeStamp mrpt::slam::CObservation::timestamp
inherited

The associated time-stamp.

Definition at line 67 of file CObservation.h.

mrpt::system::TTimeStamp mrpt::slam::CObservationRGBD360::timestamps[NUM_SENSORS]

Definition at line 209 of file CObservationRGBD360.h.




Page generated by Doxygen 1.8.6 for MRPT 1.2.0 SVN: at dom ago 20 02:20:21 CEST 2017 Hosted on:
SourceForge.net Logo