-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trying to use with pcl::PointXYZI #33
Comments
You can definitely use pico_tree with PCL. At first glance your custom PointTraits are fine, except that I don't see a namespace: namespace pico_tree {
template <>
struct PointTraits<pcl::PointXYZI> {
...
};
} // namespace pico_tree However, your custom SpaceTraits needs a few changes: namespace pico_tree {
// pcl::PointXYZI doesn't require template arguments, so we leave the template
// parameters for SpaceTraits empty. This results in a full template
// specialization for std::deque<pcl::PointXYZI>.
template <>
struct SpaceTraits<std::deque<pcl::PointXYZI>> {
...
using ScalarType = float;
static std::size_t constexpr Dim = 3;
...
};
} // namespace pico_tree |
Note that I would recommend using an If you really want to work with namespace pico_tree {
// Provides an interface for an std::deque<Point_>.
template <typename Point_>
struct SpaceTraits<std::deque<Point_>> {
using SpaceType = std::deque<Point_>;
using PointType = Point_;
using ScalarType = typename PointTraits<Point_>::ScalarType;
static std::size_t constexpr Dim = PointTraits<Point_>::Dim;
// It is not reliably possible to get the spatial dimension of an std::deque.
// I.e., when the point set is empty.
static_assert(
Dim != kDynamicSize, "DEQUE_OF_POINT_DOES_NOT_SUPPORT_DYNAMIC_DIM");
// Returns a point from the input space at the specified index.
template <typename Index_>
inline static PointType const& PointAt(
SpaceType const& space, Index_ const index) {
return space[static_cast<std::size_t>(index)];
}
// Returns number of points contained by the space.
inline static std::size_t size(SpaceType const& space) {
return space.size();
}
// Returns the number of coordinates or spatial dimension of each point.
inline static constexpr std::size_t sdim(SpaceType const&) { return Dim; }
};
} // namespace pico_tree |
Thanks a lot. That solved my problem. I copied code from example files "kd_tree_custom_space_type.cpp", that is why it is std::deque. Initially I want to use std::vector. Thanks again. |
Hi, I am trying to use pico_tree with pcl::pointXYZI
looks like I should use both custom spacetraits and custom point. My custom SpaceTraits are as follows:
But it reports
Is it possible to use pico_tree this way? How can I use it with pcl library?
The text was updated successfully, but these errors were encountered: