-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add likelihood field 3d model version #440
base: main
Are you sure you want to change the base?
Conversation
Added a ROS point cloud interface for float data type and it respective testcase Signed-off-by: Pablo Vela <[email protected]>
Changed description names to be more natural and specified pointcloud requirements Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Added new testcases to cover all the cases Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
c62ee1c
to
aeb7b94
Compare
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass, nice work Pablo!
beluga/CMakeLists.txt
Outdated
@@ -18,6 +18,8 @@ project(beluga VERSION 1.0) | |||
|
|||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | |||
|
|||
list(APPEND CMAKE_MODULE_PATH "/usr/local/lib/cmake/OpenVDB") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 consider adding this to the find_package
statement, as PATHS. Same elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was delayed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need this for OpenVDB as distributed by Ubuntu (and Debian).
* \tparam OpenVDB grid type. | ||
*/ | ||
template <typename GridT, typename U> | ||
class Likelihood3DFieldModel { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 meta: should this be LikelihoodFieldModel3
? LikelihoodFieldModel
would then become LikelihoodFieldModel2
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 015f1b7
* | ||
* \tparam OpenVDB grid type. | ||
*/ | ||
template <typename GridT, typename U> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 consider using meaningful template parameter names (e.g. PointCloud
instead of U
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 015f1b7
*/ | ||
explicit Likelihood3DFieldModel(const param_type& params, const map_type& grid) | ||
: params_{params}, | ||
looker_{openvdb::tools::ClosestSurfacePoint<map_type>::create(grid)}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 shall we have an update_map()
method that takes care of creating the ClosestSurfacePoint
instance from a given grid
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no needed yet
|
||
// Transform each point to every particle state | ||
std::transform( | ||
points.begin(), points.end(), vdb_points.begin(), [this, pointcloud_size, state](const auto& point) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 why do you need pointcloud_size
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 015f1b7
typename GridT::Ptr grid_levelset = openvdb::tools::topologyToLevelSet(*grid, 1, 0, 0, 0); | ||
|
||
return grid_levelset; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 consider collapsing these lines into one:
typename GridT::Ptr grid_levelset = openvdb::tools::topologyToLevelSet(*grid, 1, 0, 0, 0); | |
return grid_levelset; | |
return openvdb::tools::topologyToLevelSet(*grid, 1, 0, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in ee56b7f
} | ||
|
||
TEST(Likelihood3DFieldModel, Likelihood3DField) { | ||
openvdb::initialize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 hmm, this is implementation specific. Consider initializing openvdb
on likelihood field model construction. It's a no-op after the first call, so we are good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 015f1b7
TEST(Likelihood3DFieldModel, Likelihood3DField) { | ||
openvdb::initialize(); | ||
// Create Grid | ||
const double voxel_size = 0.07; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 nit: use Hungarian notation for constants e.g. constexpr double kVoxelSize = 0.07;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in ee56b7f
const std::vector<openvdb::math::Vec3s> world_points{openvdb::math::Vec3s(1.0F, 1.0F, 1.0F)}; | ||
auto map = make_map<openvdb::FloatGrid, openvdb::math::Vec3s>(voxel_size, world_points); | ||
|
||
const auto params = beluga::Likelihood3DFieldModelParam{voxel_size, 2.0, 20.0, 0.5, 0.5, 0.2}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 nit: consider using named constants for parameter passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in ee56b7f
template <typename GridT, typename T> | ||
auto make_map(const double voxel_size, const std::vector<T>& world_points) { | ||
// Create the grid | ||
typename GridT::Ptr grid = openvdb::FloatGrid::create(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 fyi: this is the kind of situation where auto
comes quite handy.
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
@pvela2017 we have a problem. OpenVDB as released with Ubuntu 22.04 appears to be broken (see https://bugs.launchpad.net/ubuntu/+source/openvdb/+bug/1970108). That makes this an Ubuntu 24.04 feature. We'll have to make it optional. That is, |
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Changed in 3a98181 |
beluga/cmake/Config.cmake.in
Outdated
include(CMakeFindDependencyMacro) | ||
find_dependency(Eigen3 REQUIRED NO_MODULE) | ||
find_dependency(range-v3 REQUIRED) | ||
find_dependency(HDF5 COMPONENTS CXX REQUIRED) | ||
find_dependency(Sophus REQUIRED) | ||
find_dependency(TBB REQUIRED) | ||
find_dependency(OpenVDB REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 this should not be required. It may be missing.
beluga/test/beluga/CMakeLists.txt
Outdated
@@ -52,7 +53,6 @@ add_executable( | |||
sensor/test_beam_model.cpp | |||
sensor/test_bearing_sensor_model.cpp | |||
sensor/test_landmark_sensor_model.cpp | |||
sensor/test_lfm_with_unknown_space.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 why was this removed?
beluga/CMakeLists.txt
Outdated
list(APPEND CMAKE_MODULE_PATH "/usr/lib/aarch64-linux-gnu/cmake/OpenVDB") | ||
find_package(OpenVDB QUIET) | ||
if(OpenVDB_FOUND) | ||
add_definitions(-USE_OPENVDB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 consider using BELUGA_OPENVDB_SUPPORT
for a compile definition. Also, use target_compile_definitions
for the ${PROJECT_NAME}
target instead of a blanket add_definitions
macro.
beluga/CMakeLists.txt
Outdated
list(APPEND CMAKE_MODULE_PATH "/usr/lib/x86_64-linux-gnu/cmake/OpenVDB/") | ||
list(APPEND CMAKE_MODULE_PATH "/usr/lib/aarch64-linux-gnu/cmake/OpenVDB") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 instead of blanket adding these paths, consider:
- adding a
USE_OPENVDB
option that defaults tofalse
- using
find_file
to look for theFindOpenVDB.cmake
path under/usr/lib
(and/usr/local/lib
perhaps) set
ting anOPENVDB_CMAKE_MODULE_PATH
using the parent path of the module path found, allowing the user to override it
You can skip almost everything if USE_OPENVDB
is false.
[[nodiscard]] const auto& origin() const { return origin_; } | ||
|
||
/// Get the 3D points collection. | ||
[[nodiscard]] auto& points() const { return points_; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvela2017 hmm, shouldn't this be
[[nodiscard]] auto& points() const { return points_; } | |
[[nodiscard]] const auto& points() const { return points_; } |
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Signed-off-by: Pablo Vela <[email protected]>
Proposed changes
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
If it fixes a bug or resolves a feature request, be sure to link to that issue.
Type of change
💥 Breaking change! Explain why a non-backwards compatible change is necessary or remove this line entirely if not applicable.
Checklist
Put an
x
in the boxes that apply. This is simply a reminder of what we will require before merging your code.Additional comments
Anything worth mentioning to the reviewers.