Drake
PointCloud Class Referencefinal

Implements a point cloud (with contiguous storage), whose main goal is to offer a convenient, synchronized interface to commonly used fields and data types applicable for basic 3D perception. More...

#include <perception/point_cloud.h>

Collaboration diagram for PointCloud:
[legend]

Public Types

using T = float
 Geometric scalar type. More...
 
using D = T
 Descriptor scalar type. More...
 

Public Member Functions

 PointCloud (int new_size, pc_flags::Fields fields=pc_flags::kXYZs, bool skip_initialize=false)
 Constructs a point cloud of a given new_size, with the prescribed fields. More...
 
 PointCloud (const PointCloud &other)
 Copies another point cloud's fields and data. More...
 
 PointCloud (PointCloud &&other)
 Takes ownership of another point cloud's data. More...
 
 PointCloud (const PointCloud &other, pc_flags::Fields copy_fields)
 Copies another point cloud's fields and data. More...
 
PointCloudoperator= (const PointCloud &other)
 
PointCloudoperator= (PointCloud &&other)
 
 ~PointCloud ()
 
pc_flags::Fields fields () const
 Returns the fields provided by this point cloud. More...
 
int size () const
 Returns the number of points in this point cloud. More...
 
void resize (int new_size, bool skip_initialize=false)
 Conservative resize; will maintain existing data, and initialize new data to their invalid values. More...
 
Geometric Descriptors
bool has_xyzs () const
 Returns if this cloud provides XYZ values. More...
 
Eigen::Ref< const Matrix3X< T > > xyzs () const
 Returns access to XYZ values. More...
 
Eigen::Ref< Matrix3X< T > > mutable_xyzs ()
 Returns mutable access to XYZ values. More...
 
Vector3< Txyz (int i) const
 Returns access to a XYZ values. More...
 
Eigen::Ref< Vector3< T > > mutable_xyz (int i)
 Returns mutable access to a XYZ values. More...
 
Run-Time Descriptors
bool has_descriptors () const
 Returns if this point cloud provides descriptor values. More...
 
bool has_descriptors (const pc_flags::DescriptorType &descriptor_type) const
 Returns if the point cloud provides a specific descriptor. More...
 
const pc_flags::DescriptorTypedescriptor_type () const
 Returns the descriptor type. More...
 
Eigen::Ref< const MatrixX< D > > descriptors () const
 Returns access to descriptor values. More...
 
Eigen::Ref< MatrixX< D > > mutable_descriptors ()
 Returns mutable access to descriptor values. More...
 
VectorX< Tdescriptor (int i) const
 Returns access to a descriptor values. More...
 
Eigen::Ref< VectorX< T > > mutable_descriptor (int i)
 Returns mutable access to a descriptor values. More...
 
Container Manipulation
void SetFrom (const PointCloud &other, pc_flags::Fields fields_in=pc_flags::kInherit, bool allow_resize=true)
 Copies all points from another point cloud. More...
 
void Expand (int add_size, bool skip_initialization=false)
 Adds add_size default-initialized points. More...
 
Fields
bool HasFields (pc_flags::Fields fields_in) const
 Returns if a point cloud has a given set of fields. More...
 
void RequireFields (pc_flags::Fields fields_in) const
 Requires a given set of fields. More...
 
bool HasExactFields (pc_flags::Fields fields_in) const
 Returns if a point cloud has exactly a given set of fields. More...
 
void RequireExactFields (pc_flags::Fields field_set) const
 Requires the exact given set of fields. More...
 

Static Public Member Functions

static bool IsDefaultValue (T value)
 
static bool IsInvalidValue (T value)
 

Static Public Attributes

static constexpr T kDefaultValue = std::numeric_limits<T>::quiet_NaN()
 Represents an invalid or uninitialized value. More...
 

Detailed Description

Implements a point cloud (with contiguous storage), whose main goal is to offer a convenient, synchronized interface to commonly used fields and data types applicable for basic 3D perception.

This is a mix between the philosophy of PCL (templated interface to provide a compile-time open set, run-time closed set) and VTK (non-templated interface to provide a very free form run-time open set). You may construct one PointCloud which will contain different sets of data, but you cannot change the contained data types after construction. However, you can mutate the data contained within the structure and resize the cloud.

Definitions:

  • point - An entry in a point cloud (not exclusively an XYZ point).
  • feature - Abstract representation of local properties (geometric and non-geometric)
  • descriptor - Concrete representation of a feature.
  • field - A feature or descriptor described by the point cloud.

This point cloud class provides the following fields:

  • xyz - Cartesian XYZ coordinates (float[3]).
  • descriptor - An descriptor that is run-time defined (float[X]).
Note
"contiguous" here means contiguous in memory. This was chosen to avoid ambiguity between PCL and Eigen, where in PCL "dense" implies that the point cloud corresponds to a cloud with invalid values, and in Eigen "dense" implies contiguous storage.
The accessors / mutators for the point fields of this class returns references to the original Eigen matrices. This implies that they are invalidated whenever memory is reallocated for the values. Given this, minimize the lifetime of these references to be as short as possible. Additionally, algorithms wanting fast access to values should avoid the single point accessors / mutatotrs (e.g. xyz(i), mutable_descriptor(i)) to avoid overhead when accessing a single element (either copying or creating a reference).
The definitions presented here for "feature" and "descriptor" are loosely based on their definitions within PCL and Radu Rusu's dissertation: Rusu, Radu Bogdan. "Semantic 3d object maps for everyday manipulation in human living environments." KI-Künstliche Intelligenz 24.4 (2010): 345-348. This differs from other definitions, such as having "feature" describe geometric quantities and "descriptor" describe non-geometric quantities which is presented in the following survey paper: Pomerleau, François, Francis Colas, and Roland Siegwart. "A review of point cloud registration algorithms for mobile robotics." Foundations and Trends® in Robotics 4.1 (2015): 1-104.

Member Typedef Documentation

using D = T

Descriptor scalar type.

using T = float

Geometric scalar type.

Constructor & Destructor Documentation

PointCloud ( int  new_size,
pc_flags::Fields  fields = pc_flags::kXYZs,
bool  skip_initialize = false 
)
explicit

Constructs a point cloud of a given new_size, with the prescribed fields.

If kDescriptors is one of the fields, then descriptor should be included and should not be kNone.

Parameters
new_sizeSize of the point cloud after construction.
fieldsFields that the point cloud contains.
skip_initializeDo not default-initialize new values.

Here is the call graph for this function:

Here is the caller graph for this function:

PointCloud ( const PointCloud other)
inline

Copies another point cloud's fields and data.

Here is the call graph for this function:

PointCloud ( PointCloud &&  other)

Takes ownership of another point cloud's data.

Here is the call graph for this function:

PointCloud ( const PointCloud other,
pc_flags::Fields  copy_fields 
)

Copies another point cloud's fields and data.

Parameters
copy_fieldsFields to copy. If this is kInherit, then others fields will be copied. Otherwise, only the specified fields will be copied; the remaining fields in this cloud are left default initialized.

Here is the call graph for this function:

~PointCloud ( )

Here is the caller graph for this function:

Member Function Documentation

VectorX<T> descriptor ( int  i) const
inline

Returns access to a descriptor values.

Precondition
has_descriptors() must be true.

Here is the call graph for this function:

const pc_flags::DescriptorType& descriptor_type ( ) const
inline

Returns the descriptor type.

Here is the call graph for this function:

Here is the caller graph for this function:

Eigen::Ref< const MatrixX< D > > descriptors ( ) const

Returns access to descriptor values.

Precondition
has_descriptors() must be true.

Here is the call graph for this function:

Here is the caller graph for this function:

void Expand ( int  add_size,
bool  skip_initialization = false 
)

Adds add_size default-initialized points.

Parameters
add_sizeNumber of points to add.
skip_initializationDo not require that the new values be initialized.

Here is the call graph for this function:

Here is the caller graph for this function:

pc_flags::Fields fields ( ) const
inline

Returns the fields provided by this point cloud.

Here is the caller graph for this function:

bool has_descriptors ( ) const

Returns if this point cloud provides descriptor values.

Here is the call graph for this function:

Here is the caller graph for this function:

bool has_descriptors ( const pc_flags::DescriptorType descriptor_type) const

Returns if the point cloud provides a specific descriptor.

Here is the call graph for this function:

bool has_xyzs ( ) const

Returns if this cloud provides XYZ values.

Here is the call graph for this function:

Here is the caller graph for this function:

bool HasExactFields ( pc_flags::Fields  fields_in) const

Returns if a point cloud has exactly a given set of fields.

See also
HasFields for preconditions.

Here is the call graph for this function:

Here is the caller graph for this function:

bool HasFields ( pc_flags::Fields  fields_in) const

Returns if a point cloud has a given set of fields.

Here is the call graph for this function:

Here is the caller graph for this function:

static bool IsDefaultValue ( T  value)
inlinestatic

Here is the call graph for this function:

static bool IsInvalidValue ( T  value)
inlinestatic

Here is the call graph for this function:

Eigen::Ref<VectorX<T> > mutable_descriptor ( int  i)
inline

Returns mutable access to a descriptor values.

Precondition
has_descriptors() must be true.

Here is the call graph for this function:

Eigen::Ref< MatrixX< D > > mutable_descriptors ( )

Returns mutable access to descriptor values.

Precondition
has_descriptors() must be true.

Here is the call graph for this function:

Here is the caller graph for this function:

Eigen::Ref<Vector3<T> > mutable_xyz ( int  i)
inline

Returns mutable access to a XYZ values.

Precondition
has_xyzs() must be true.

Here is the call graph for this function:

Eigen::Ref< Matrix3X< T > > mutable_xyzs ( )

Returns mutable access to XYZ values.

Precondition
has_xyzs() must be true.

Here is the call graph for this function:

Here is the caller graph for this function:

PointCloud & operator= ( const PointCloud other)

Here is the call graph for this function:

Here is the caller graph for this function:

PointCloud & operator= ( PointCloud &&  other)

Here is the call graph for this function:

void RequireExactFields ( pc_flags::Fields  field_set) const

Requires the exact given set of fields.

See also
HasFields for preconditions.
Exceptions
std::runtime_errorif this point cloud does not have exactly these fields.

Here is the call graph for this function:

Here is the caller graph for this function:

void RequireFields ( pc_flags::Fields  fields_in) const

Requires a given set of fields.

See also
HasFields for preconditions.
Exceptions
std::runtime_errorif this point cloud does not have these fields.

Here is the call graph for this function:

Here is the caller graph for this function:

void resize ( int  new_size,
bool  skip_initialize = false 
)

Conservative resize; will maintain existing data, and initialize new data to their invalid values.

Parameters
new_sizeThe new size of the value. If less than the present size(), then the values will be truncated. If greater than the present size(), then the new values will be uninitialized if skip_initialize is not true.
skip_initializeDo not default-initialize new values.

Here is the call graph for this function:

Here is the caller graph for this function:

void SetFrom ( const PointCloud other,
pc_flags::Fields  fields_in = pc_flags::kInherit,
bool  allow_resize = true 
)

Copies all points from another point cloud.

Parameters
otherOther point cloud.
fields_inFields to copy. If this is kInherit, then both clouds must have the exact same fields. Otherwise, both clouds must support the fields indicated this parameter.
allow_resizePermit resizing to the other cloud's size.

Here is the call graph for this function:

Here is the caller graph for this function:

int size ( ) const
inline

Returns the number of points in this point cloud.

Here is the call graph for this function:

Here is the caller graph for this function:

Vector3<T> xyz ( int  i) const
inline

Returns access to a XYZ values.

Precondition
has_xyzs() must be true.

Here is the call graph for this function:

Eigen::Ref< const Matrix3X< T > > xyzs ( ) const

Returns access to XYZ values.

Precondition
has_xyzs() must be true.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

constexpr T kDefaultValue = std::numeric_limits<T>::quiet_NaN()
static

Represents an invalid or uninitialized value.


The documentation for this class was generated from the following files: