small_gicp
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
small_gicp::IncrementalVoxelMap< VoxelContents > Struct Template Reference

Incremental voxelmap. This class supports incremental point cloud insertion and LRU-based voxel deletion that removes voxels that are not recently referenced. More...

#include <incremental_voxelmap.hpp>

Public Types

using Ptr = std::shared_ptr< IncrementalVoxelMap >
 
using ConstPtr = std::shared_ptr< const IncrementalVoxelMap >
 

Public Member Functions

 IncrementalVoxelMap (double leaf_size)
 Constructor. More...
 
size_t size () const
 Number of points in the voxelmap. More...
 
template<typename PointCloud >
void insert (const PointCloud &points, const Eigen::Isometry3d &T=Eigen::Isometry3d::Identity())
 Insert points to the voxelmap. More...
 
size_t nearest_neighbor_search (const Eigen::Vector4d &pt, size_t *index, double *sq_dist) const
 Find the nearest neighbor. More...
 
size_t knn_search (const Eigen::Vector4d &pt, size_t k, size_t *k_indices, double *k_sq_dists) const
 Find k nearest neighbors. More...
 
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. More...
 
size_t voxel_id (const size_t i) const
 Extract the point ID from a global index. More...
 
size_t point_id (const size_t i) const
 Extract the voxel ID from a global index. More...
 
void set_search_offsets (int num_offsets)
 Set the pattern of the search offsets. (Must be 1, 7, or 27) More...
 

Public Attributes

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

Static Public Attributes

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

Detailed Description

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

Incremental voxelmap. This class supports incremental point cloud insertion and LRU-based voxel deletion that removes voxels that are not recently referenced.

Note
This class can be used as a point cloud as well as a neighbor search structure.
This class can handle arbitrary number of voxels and arbitrary range of voxel coordinates (in 32-bit int range).

Member Typedef Documentation

◆ ConstPtr

template<typename VoxelContents >
using small_gicp::IncrementalVoxelMap< VoxelContents >::ConstPtr = std::shared_ptr<const IncrementalVoxelMap>

◆ Ptr

template<typename VoxelContents >
using small_gicp::IncrementalVoxelMap< VoxelContents >::Ptr = std::shared_ptr<IncrementalVoxelMap>

Constructor & Destructor Documentation

◆ IncrementalVoxelMap()

template<typename VoxelContents >
small_gicp::IncrementalVoxelMap< VoxelContents >::IncrementalVoxelMap ( double  leaf_size)
inlineexplicit

Constructor.

Parameters
leaf_sizeVoxel size

Member Function Documentation

◆ calc_index()

template<typename VoxelContents >
size_t small_gicp::IncrementalVoxelMap< VoxelContents >::calc_index ( const size_t  voxel_id,
const size_t  point_id 
) const
inline

Calculate the global point index from the voxel index and the point index.

◆ insert()

template<typename VoxelContents >
template<typename PointCloud >
void small_gicp::IncrementalVoxelMap< VoxelContents >::insert ( const PointCloud points,
const Eigen::Isometry3d &  T = Eigen::Isometry3d::Identity() 
)
inline

Insert points to the voxelmap.

Parameters
pointsPoint cloud
TTransformation matrix

◆ knn_search()

template<typename VoxelContents >
size_t small_gicp::IncrementalVoxelMap< VoxelContents >::knn_search ( const Eigen::Vector4d &  pt,
size_t  k,
size_t *  k_indices,
double *  k_sq_dists 
) const
inline

Find k nearest neighbors.

Parameters
ptQuery point
kNumber of neighbors
k_indicesIndices of nearest neighbors
k_sq_distsSquared distances to nearest neighbors (sorted in ascending order)
Returns
Number of found points

◆ nearest_neighbor_search()

template<typename VoxelContents >
size_t small_gicp::IncrementalVoxelMap< VoxelContents >::nearest_neighbor_search ( const Eigen::Vector4d &  pt,
size_t *  index,
double *  sq_dist 
) const
inline

Find the nearest neighbor.

Parameters
ptQuery point
indexIndex of the nearest neighbor
sq_distSquared distance to the nearest neighbor
Returns
Number of found points (0 or 1)

◆ point_id()

template<typename VoxelContents >
size_t small_gicp::IncrementalVoxelMap< VoxelContents >::point_id ( const size_t  i) const
inline

Extract the voxel ID from a global index.

◆ set_search_offsets()

template<typename VoxelContents >
void small_gicp::IncrementalVoxelMap< VoxelContents >::set_search_offsets ( int  num_offsets)
inline

Set the pattern of the search offsets. (Must be 1, 7, or 27)

Note
1: center only, 7: center + 6 adjacent neighbors (+- 1X/1Y/1Z), 27: center + 26 neighbors (3 x 3 x 3 cube)

◆ size()

template<typename VoxelContents >
size_t small_gicp::IncrementalVoxelMap< VoxelContents >::size ( ) const
inline

Number of points in the voxelmap.

◆ voxel_id()

template<typename VoxelContents >
size_t small_gicp::IncrementalVoxelMap< VoxelContents >::voxel_id ( const size_t  i) const
inline

Extract the point ID from a global index.

Member Data Documentation

◆ flat_voxels

template<typename VoxelContents >
std::vector<std::shared_ptr<std::pair<VoxelInfo, VoxelContents> > > small_gicp::IncrementalVoxelMap< VoxelContents >::flat_voxels

Voxel contents.

◆ inv_leaf_size

template<typename VoxelContents >
const double small_gicp::IncrementalVoxelMap< VoxelContents >::inv_leaf_size

Inverse of the voxel size.

◆ lru_clear_cycle

template<typename VoxelContents >
size_t small_gicp::IncrementalVoxelMap< VoxelContents >::lru_clear_cycle

LRU clear cycle. Voxel deletion is performed every lru_clear_cycle steps.

◆ lru_counter

template<typename VoxelContents >
size_t small_gicp::IncrementalVoxelMap< VoxelContents >::lru_counter

LRU counter. Incremented every step.

◆ lru_horizon

template<typename VoxelContents >
size_t small_gicp::IncrementalVoxelMap< VoxelContents >::lru_horizon

LRU horizon size. Voxels that have not been accessed for lru_horizon steps are deleted.

◆ point_id_bits

template<typename VoxelContents >
constexpr int small_gicp::IncrementalVoxelMap< VoxelContents >::point_id_bits = 32
staticconstexpr

Use the first 32 bits for point id.

◆ search_offsets

template<typename VoxelContents >
std::vector<Eigen::Vector3i> small_gicp::IncrementalVoxelMap< VoxelContents >::search_offsets

Voxel search offsets.

◆ voxel_id_bits

template<typename VoxelContents >
constexpr int small_gicp::IncrementalVoxelMap< VoxelContents >::voxel_id_bits = 64 - point_id_bits
staticconstexpr

Use the remaining bits for voxel id.

◆ voxel_setting

template<typename VoxelContents >
VoxelContents::Setting small_gicp::IncrementalVoxelMap< VoxelContents >::voxel_setting

Voxel setting.

◆ voxels

template<typename VoxelContents >
std::unordered_map<Eigen::Vector3i, size_t, XORVector3iHash> small_gicp::IncrementalVoxelMap< VoxelContents >::voxels

Voxel index map.


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