PointCloudLibrary / PointCloudLibrary/pcl

[octree] OctreePointCloudSearch<>::getNeightborsWithinRadiusRecursive() requires member that is not apart of OctreeContainerBase

Open
#6,466 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: bug module: octree
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

Describe the bug

pcl::octree::OctreePointCloudSearch<>::getNeightborsWithinRadiusRecursive() was changed in this commit to directly reference the internal vector provided by pcl::octree::OctreeContainerPointIndices using pcl::octree::OctreeContainerPointIndices::getPointIndicesVector(). However, this method is specific to pcl::octree::OctreeContainerPointIndices and not apart of the pcl::octree::OctreeContainerBase interface, therefore other pcl-provided and user-implemented leaf container classes that only implement the pcl::octree::OctreeContainerBase interface are no longer guaranteed to work here.

Context

Using pcl::octree::OctreeContainerPointIndex as leaf container for pcl::octree::OctreePointCloudSearch<>, updating codebase from PCL 1.14 to PCL 1.15.1.

Expected behavior

All pcl::octree::OctreeContainerBase-compliant classes should work with all octree methods, or edge cases should be asserted at compile time.

Current Behavior

Compile error when any octree container that doesn't have const pcl::Indices& getPointIndicesVector() member is used with pcl::octree::OctreePointCloudSearch<> and calling pcl::octree::OctreePointCloudSearch<>::getNeighborsWithinRadiusRecursive() (used in radiusSearch()).

To Reproduce

Instantiate pcl::octree::OctreePointCloudSearch<> with pcl::octree::OctreeContainerPointIndex as LeafContainerT template parameter and call pcl::octree::OctreePointCloudSearch<>::radiusSearch().

Screenshots/Code snippets

In file included from /usr/include/pcl-1.15/pcl/octree/octree_search.h:657,
                 from /mnt/data2/code/lance-ws/src/cardinal-perception/include/modules/map_octree.hpp:53,
                 from /mnt/data2/code/lance-ws/src/cardinal-perception/include/modules/kfc_map.hpp:52,
                 from /mnt/data2/code/lance-ws/src/cardinal-perception/src/core/modules/kfc_map.cpp:9:
/usr/include/pcl-1.15/pcl/octree/impl/octree_search.hpp: In instantiation of ‘void pcl::octree::OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::getNeighborsWithinRadiusRecursive(const PointT&, double, const BranchNode*, const pcl::octree::OctreeKey&, pcl::uindex_t, pcl::Indices&, std::vector<float>&, pcl::uindex_t) const [with PointT = pcl::PointXYZ; LeafContainerT = pcl::octree::OctreeContainerPointIndex; BranchContainerT = pcl::octree::OctreeContainerEmpty; BranchNode = pcl::octree::OctreeBranchNode<pcl::octree::OctreeContainerEmpty>; pcl::uindex_t = unsigned int; pcl::Indices = std::vector<int>]’:
/usr/include/pcl-1.15/pcl/octree/impl/octree_search.hpp:178:3:   required from ‘pcl::uindex_t pcl::octree::OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::radiusSearch(const PointT&, double, pcl::Indices&, std::vector<float>&, pcl::uindex_t) const [with PointT = pcl::PointXYZ; LeafContainerT = pcl::octree::OctreeContainerPointIndex; BranchContainerT = pcl::octree::OctreeContainerEmpty; pcl::uindex_t = unsigned int; pcl::Indices = std::vector<int>]’
  178 |   getNeighborsWithinRadiusRecursive(p_q,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/data2/code/lance-ws/src/cardinal-perception/include/modules/impl/kfc_map_impl.hpp:119:60:   required from ‘csm::perception::KFCMap<Point_T, Map_T>::UpdateResult csm::perception::KFCMap<Point_T, Map_T>::updateMap(const Vec3f&, const PointCloudT&, const std::vector<RayDirT>*, const pcl::Indices*) [with int CollisionModel = 5; RayDirT = pcl::Axis; Point_T = pcl::PointXYZ; Map_T = csm::perception::MapOctree<pcl::PointXYZ, 2>; Vec3f = Eigen::Matrix<float, 3, 1>; PointCloudT = pcl::PointCloud<pcl::PointXYZ>; pcl::Indices = std::vector<int>]’
  119 |     results.points_searched = this->map_octree.radiusSearch(
      |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  120 |         lp,
      |         ~~~                                                 
  121 |         this->delete_max_range,
      |         ~~~~~~~~~~~~~~~~~~~~~~~                             
  122 |         tmp_indices,
      |         ~~~~~~~~~~~~                                        
  123 |         tmp_dists);
      |         ~~~~~~~~~~                                          
/mnt/data2/code/lance-ws/src/cardinal-perception/src/core/modules/kfc_map.cpp:26:1:   required from here
  255 |                 const pcl::Indices*);
      |                                    ^
/usr/include/pcl-1.15/pcl/octree/impl/octree_search.hpp:403:49: error: ‘const class pcl::octree::OctreeContainerPointIndex’ has no member named ‘getPointIndicesVector’; did you mean ‘getPointIndices’?
  403 |         for (const auto& index : (*child_leaf)->getPointIndicesVector()) {
      |                                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                                  getPointIndices

Environment:

  • OS: Ubuntu 26.04
  • Compiler: GCC 15.2.0
  • PCL Version 1.15.1

Possible Solution

Change should be reverted or OctreeContainerBase interface should be updated to require/support this access method.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in impl/octree_search.hpp around getNeighborsWithinRadiusRecursive() and compare the OctreeContainerBase interface with OctreeContainerPointIndices and OctreeContainerPointIndex. Reproduce the radiusSearch() compilation failure with OctreeContainerPointIndex, then verify that containers implementing only OctreeContainerBase work without the missing member error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-vision
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.