gtsam_points
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
gtsam_points::IncrementalVoxelMap< VoxelContents > Struct Template Reference

Incremental voxelmap. This class supports incremental point cloud insertion and LRU-based voxel deletion. More...

#include <incremental_voxelmap.hpp>

Inheritance diagram for gtsam_points::IncrementalVoxelMap< VoxelContents >:
Inheritance graph
[legend]
Collaboration diagram for gtsam_points::IncrementalVoxelMap< VoxelContents >:
Collaboration graph
[legend]

Public Types

using Ptr = std::shared_ptr< IncrementalVoxelMap >
 
using ConstPtr = std::shared_ptr< const IncrementalVoxelMap >
 
- Public Types inherited from gtsam_points::NearestNeighborSearch
using Ptr = std::shared_ptr< NearestNeighborSearch >
 
using ConstPtr = std::shared_ptr< const NearestNeighborSearch >
 

Public Member Functions

 IncrementalVoxelMap (double leaf_size)
 Constructor.
 
void set_voxel_resolution (const double leaf_size)
 Voxel resolution.
 
void set_lru_clear_cycle (const int lru_clear_cycle)
 LRU cache clearing cycle.
 
void set_lru_horizon (const int lru_horizon)
 LRU cache horizon.
 
void set_neighbor_voxel_mode (const int mode)
 Neighboring voxel search mode (1, 7, 19, or 27).
 
VoxelContents::Setting & voxel_insertion_setting ()
 Voxel setting.
 
double leaf_size () const
 Voxel size.
 
size_t num_voxels () const
 Number of voxels in the voxelmap.
 
virtual void clear ()
 Clear the voxelmap.
 
virtual void insert (const PointCloud &points)
 Insert points to the voxelmap.
 
virtual size_t knn_search (const double *pt, size_t k, size_t *k_indices, double *k_sq_dists, double max_sq_dist=std::numeric_limits< double >::max()) const override
 Find k nearest neighbors.
 
size_t calc_index (const size_t voxel_id, const size_t point_id) const
 Calculate the global point index from the voxel index and the point index.
 
size_t voxel_id (const size_t i) const
 Extract the point ID from a global index.
 
size_t point_id (const size_t i) const
 Extract the voxel ID from a global index.
 
bool has_points () const
 
bool has_normals () const
 
bool has_covs () const
 
bool has_intensities () const
 
decltype(auto) point (const size_t i) const
 
decltype(auto) normal (const size_t i) const
 
decltype(auto) cov (const size_t i) const
 
decltype(auto) intensity (const size_t i) const
 
virtual std::vector< Eigen::Vector4d > voxel_points () const
 
virtual std::vector< Eigen::Vector4d > voxel_normals () const
 
virtual std::vector< Eigen::Matrix4d > voxel_covs () const
 
virtual std::vector< double > voxel_intensities () const
 
virtual PointCloudCPU::Ptr voxel_data () const
 
- Public Member Functions inherited from gtsam_points::NearestNeighborSearch
virtual size_t radius_search (const double *pt, double radius, std::vector< size_t > &indices, std::vector< double > &sq_dists, int max_num_neighbors=std::numeric_limits< int >::max()) const
 Radius search.
 

Protected Member Functions

std::vector< Eigen::Vector3i > neighbor_offsets (const int neighbor_voxel_mode) const
 
template<typename Func >
void visit_points (const Func &f) const
 

Protected Attributes

double inv_leaf_size
 Inverse of the voxel size.
 
std::vector< Eigen::Vector3i > offsets
 Neighbor voxel offsets.
 
size_t lru_horizon
 LRU horizon size. Voxels that have not been accessed for lru_horizon steps are deleted.
 
size_t lru_clear_cycle
 LRU clear cycle. Voxel deletion is performed every lru_clear_cycle steps.
 
size_t lru_counter
 LRU counter. Incremented every step.
 
VoxelContents::Setting voxel_setting
 Voxel setting.
 
std::vector< std::shared_ptr< std::pair< VoxelInfo, VoxelContents > > > flat_voxels
 Voxel contents.
 
std::unordered_map< Eigen::Vector3i, size_t, XORVector3iHashvoxels
 Voxel index map.
 

Static Protected Attributes

static constexpr int point_id_bits = 32
 Use the first 32 bits for point id.
 
static constexpr int voxel_id_bits = 64 - point_id_bits
 Use the remaining bits for voxel id.
 

Detailed Description

template<typename VoxelContents>
struct gtsam_points::IncrementalVoxelMap< VoxelContents >

Incremental voxelmap. This class supports incremental point cloud insertion and LRU-based voxel deletion.

Note
This class can be used as a point cloud as well as a neighbor search structure.
For the compatibility with other nearest neighbor search methods, this implementation returns indices that encode the voxel and point IDs. The first point_id_bits (e.g., 32) bits of a point index represent the point ID, and the rest voxel_id_bits (e.g., 32) bits represent the voxel ID that contains the point. The specified point can be looked up by voxelmap.point(index);

Constructor & Destructor Documentation

◆ IncrementalVoxelMap()

template<typename VoxelContents >
gtsam_points::IncrementalVoxelMap< VoxelContents >::IncrementalVoxelMap ( double  leaf_size)
explicit

Constructor.

Parameters
leaf_sizeVoxel size

Member Function Documentation

◆ clear()

template<typename VoxelContents >
void gtsam_points::IncrementalVoxelMap< VoxelContents >::clear ( )
virtual

Clear the voxelmap.

Reimplemented in gtsam_points::IncrementalCovarianceVoxelMap.

◆ insert()

template<typename VoxelContents >
void gtsam_points::IncrementalVoxelMap< VoxelContents >::insert ( const PointCloud points)
virtual

Insert points to the voxelmap.

Parameters
pointsPoint cloud
TTransformation matrix

Reimplemented in gtsam_points::GaussianVoxelMapCPU, and gtsam_points::IncrementalCovarianceVoxelMap.

◆ knn_search()

template<typename VoxelContents >
size_t gtsam_points::IncrementalVoxelMap< VoxelContents >::knn_search ( const double *  pt,
size_t  k,
size_t *  k_indices,
double *  k_sq_dists,
double  max_sq_dist = std::numeric_limits<double>::max() 
) const
overridevirtual

Find k nearest neighbors.

Parameters
ptQuery point
kNumber of neighbors to search
k_indicesIndices of the k nearest neighbors
k_sq_distsSquared distances of the k nearest neighbors
Returns
Number of found neighbors

Reimplemented from gtsam_points::NearestNeighborSearch.

Reimplemented in gtsam_points::IncrementalCovarianceVoxelMap.

◆ voxel_covs()

template<typename VoxelContents >
std::vector< Eigen::Matrix4d > gtsam_points::IncrementalVoxelMap< VoxelContents >::voxel_covs ( ) const
virtual

◆ voxel_normals()

template<typename VoxelContents >
std::vector< Eigen::Vector4d > gtsam_points::IncrementalVoxelMap< VoxelContents >::voxel_normals ( ) const
virtual

◆ voxel_points()

template<typename VoxelContents >
std::vector< Eigen::Vector4d > gtsam_points::IncrementalVoxelMap< VoxelContents >::voxel_points ( ) const
virtual

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