norlab-ulaval / libpointmatcher

An Iterative Closest Point (ICP) library for 2D and 3D mapping in Robotics
BSD 3-Clause "New" or "Revised" License
1.58k stars 542 forks source link

refactor: Drop support for yaml-cpp old API #450

Closed aguenette closed 7 months ago

aguenette commented 3 years ago

fix #42

So, here's my attempt to upgrade libpointmatcher's yaml-cpp dependency to its new API.

As discuss in #42, libpointmatcher will no longer provides yaml-cpp sources in the contrib directory, which mean that Windows users will have to build and install yaml-cpp from sources.

I've followed this tutorial to upgrade the API.

Changes:

Tested on:

However, these changes need to be tested on Windows, so if a Windows user feels generous and is willing to test them, it would be greatly appreciated. 😄

Any suggestions are welcomed. Thanks!

ethzasl-jenkins commented 3 years ago

Can one of the admins verify this patch?

pomerlef commented 3 years ago

add to white list

pomerlef commented 3 years ago

ok to test

pomerlef commented 3 years ago

Tests are failing on OSX

[ 72%] Linking CXX executable icp_customized
Undefined symbols for architecture x86_64:
  "YAML::Load(std::__1::basic_istream<char, std::__1::char_traits<char> >&)", referenced from:
      PointMatcher<float>::ICPChainBase::loadFromYaml(std::__1::basic_istream<char, std::__1::char_traits<char> >&) in libpointmatcher.a(ICP.cpp.o)
      PointMatcher<double>::ICPChainBase::loadFromYaml(std::__1::basic_istream<char, std::__1::char_traits<char> >&) in libpointmatcher.a(ICP.cpp.o)
      PointMatcher<float>::DataPointsFilters::DataPointsFilters(std::__1::basic_istream<char, std::__1::char_traits<char> >&) in libpointmatcher.a(DataPointsFilter.cpp.o)
      PointMatcher<double>::DataPointsFilters::DataPointsFilters(std::__1::basic_istream<char, std::__1::char_traits<char> >&) in libpointmatcher.a(DataPointsFilter.cpp.o)
  "YAML::detail::memory::create_node()", referenced from:
      YAML::Node::EnsureNodeExists() const in libpointmatcher.a(ICP.cpp.o)
  "YAML::detail::node_data::empty_scalar", referenced from:
      bool YAML::detail::node::equals<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::shared_ptr<YAML::detail::memory_holder>) in libpointmatcher.a(ICP.cpp.o)
  "YAML::detail::node_data::mark_defined()", referenced from:
      YAML::detail::node::mark_defined() in libpointmatcher.a(ICP.cpp.o)
  "YAML::detail::node_data::end()", referenced from:
      PointMatcher<float>::ICPChainBase::loadFromYaml(std::__1::basic_istream<char, std::__1::char_traits<char> >&) in libpointmatcher.a(ICP.cpp.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& PointMatcher<float>::ICPChainBase::createModulesFromRegistrar<PointMatcherSupport::Registrar<PointMatcher<float>::DataPointsFilter> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, YAML::Node const&, PointMatcherSupport::Registrar<PointMatcher<float>::DataPointsFilter> const&, std::__1::vector<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::DataPointsFilter>::TargetType>, std::__1::allocator<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::DataPointsFilter>::TargetType> > >&) in libpointmatcher.a(ICP.cpp.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& PointMatcher<float>::ICPChainBase::createModulesFromRegistrar<PointMatcherSupport::Registrar<PointMatcher<float>::OutlierFilter> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, YAML::Node const&, PointMatcherSupport::Registrar<PointMatcher<float>::OutlierFilter> const&, std::__1::vector<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::OutlierFilter>::TargetType>, std::__1::allocator<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::OutlierFilter>::TargetType> > >&) in libpointmatcher.a(ICP.cpp.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& PointMatcher<float>::ICPChainBase::createModulesFromRegistrar<PointMatcherSupport::Registrar<PointMatcher<float>::TransformationChecker> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, YAML::Node const&, PointMatcherSupport::Registrar<PointMatcher<float>::TransformationChecker> const&, std::__1::vector<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::TransformationChecker>::TargetType>, std::__1::allocator<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::TransformationChecker>::TargetType> > >&) in libpointmatcher.a(ICP.cpp.o)
      PointMatcher<double>::ICPChainBase::loadFromYaml(std::__1::basic_istream<char, std::__1::char_traits<char> >&) in libpointmatcher.a(ICP.cpp.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& PointMatcher<double>::ICPChainBase::createModulesFromRegistrar<PointMatcherSupport::Registrar<PointMatcher<double>::DataPointsFilter> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, YAML::Node const&, PointMatcherSupport::Registrar<PointMatcher<double>::DataPointsFilter> const&, std::__1::vector<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<double>::DataPointsFilter>::TargetType>, std::__1::allocator<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<double>::DataPointsFilter>::TargetType> > >&) in libpointmatcher.a(ICP.cpp.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& PointMatcher<double>::ICPChainBase::createModulesFromRegistrar<PointMatcherSupport::Registrar<PointMatcher<double>::OutlierFilter> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, YAML::Node const&, PointMatcherSupport::Registrar<PointMatcher<double>::OutlierFilter> const&, std::__1::vector<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<double>::OutlierFilter>::TargetType>, std::__1::allocator<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<double>::OutlierFilter>::TargetType> > >&) in libpointmatcher.a(ICP.cpp.o)
      ...
  "YAML::detail::node_data::begin()", referenced from:
      PointMatcher<float>::ICPChainBase::loadFromYaml(std::__1::basic_istream<char, std::__1::char_traits<char> >&) in libpointmatcher.a(ICP.cpp.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& PointMatcher<float>::ICPChainBase::createModulesFromRegistrar<PointMatcherSupport::Registrar<PointMatcher<float>::DataPointsFilter> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, YAML::Node const&, PointMatcherSupport::Registrar<PointMatcher<float>::DataPointsFilter> const&, std::__1::vector<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::DataPointsFilter>::TargetType>, std::__1::allocator<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::DataPointsFilter>::TargetType> > >&) in libpointmatcher.a(ICP.cpp.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& PointMatcher<float>::ICPChainBase::createModulesFromRegistrar<PointMatcherSupport::Registrar<PointMatcher<float>::OutlierFilter> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, YAML::Node const&, PointMatcherSupport::Registrar<PointMatcher<float>::OutlierFilter> const&, std::__1::vector<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::OutlierFilter>::TargetType>, std::__1::allocator<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::OutlierFilter>::TargetType> > >&) in libpointmatcher.a(ICP.cpp.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& PointMatcher<float>::ICPChainBase::createModulesFromRegistrar<PointMatcherSupport::Registrar<PointMatcher<float>::TransformationChecker> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, YAML::Node const&, PointMatcherSupport::Registrar<PointMatcher<float>::TransformationChecker> const&, std::__1::vector<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::TransformationChecker>::TargetType>, std::__1::allocator<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<float>::TransformationChecker>::TargetType> > >&) in libpointmatcher.a(ICP.cpp.o)
      PointMatcher<double>::ICPChainBase::loadFromYaml(std::__1::basic_istream<char, std::__1::char_traits<char> >&) in libpointmatcher.a(ICP.cpp.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& PointMatcher<double>::ICPChainBase::createModulesFromRegistrar<PointMatcherSupport::Registrar<PointMatcher<double>::DataPointsFilter> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, YAML::Node const&, PointMatcherSupport::Registrar<PointMatcher<double>::DataPointsFilter> const&, std::__1::vector<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<double>::DataPointsFilter>::TargetType>, std::__1::allocator<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<double>::DataPointsFilter>::TargetType> > >&) in libpointmatcher.a(ICP.cpp.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& PointMatcher<double>::ICPChainBase::createModulesFromRegistrar<PointMatcherSupport::Registrar<PointMatcher<double>::OutlierFilter> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, YAML::Node const&, PointMatcherSupport::Registrar<PointMatcher<double>::OutlierFilter> const&, std::__1::vector<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<double>::OutlierFilter>::TargetType>, std::__1::allocator<std::__1::shared_ptr<PointMatcherSupport::Registrar<PointMatcher<double>::OutlierFilter>::TargetType> > >&) in libpointmatcher.a(ICP.cpp.o)
      ...
  "YAML::detail::node_data::set_null()", referenced from:
      YAML::Node::EnsureNodeExists() const in libpointmatcher.a(ICP.cpp.o)
  "YAML::detail::node_data::size() const", referenced from:
      PointMatcherSupport::getNameParamsFromYAML(YAML::Node const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&) in libpointmatcher.a(Registrar.cpp.o)
ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make[2]: *** [examples/icp_customized] Error 1

make[1]: *** [examples/CMakeFiles/icp_customized.dir/all] Error 2

make: *** [all] Error 2
xlla commented 2 years ago

I have built it on jetson nano with yaml-cpp 0.5, but failure with some tests.

[ RUN      ] Transformation.ComputeRigidTransformDataPoints3D
/mnt/c/nano/git/libpointmatcher/utest/ui/Transformations.cpp:39: Failure
Value of: transformedFeature.isApprox(transformedCloud.features.col(i), kEpsilonNumericalError)
  Actual: false
Expected: true
[  FAILED  ] Transformation.ComputeRigidTransformDataPoints3D (17 ms)
[ RUN      ] Transformation.ComputeSimilarityTransformDataPoints2D
[       OK ] Transformation.ComputeSimilarityTransformDataPoints2D (40 ms)
[ RUN      ] Transformation.ComputeSimilarityTransformDataPoints3D
/mnt/c/nano/git/libpointmatcher/utest/ui/Transformations.cpp:39: Failure
Value of: transformedFeature.isApprox(transformedCloud.features.col(i), kEpsilonNumericalError)
  Actual: false
Expected: true
[  FAILED  ] Transformation.ComputeSimilarityTransformDataPoints3D (27 ms)
[----------] 7 tests from Transformation (135 ms total)

[----------] Global test environment tear-down
[==========] 80 tests from 13 test cases ran. (87892 ms total)
[  PASSED  ] 78 tests.
[  FAILED  ] 2 tests, listed below:
[  FAILED  ] Transformation.ComputeRigidTransformDataPoints3D
[  FAILED  ] Transformation.ComputeSimilarityTransformDataPoints3D
aguenette commented 2 years ago

Hi @xlla! On Ubuntu 18.04, all the tests pass. So, I'm not sure that the problem comes from the refactor of the yaml-cpp API. Have you tried to run the tests on the master branch (i.e. using the old yaml-cpp API)? If not, can you please try it and tell me if you get the same tests failure? It's just to be sure that it's not related with the changed from this branch. Thanks!