luigifreda / plvs

PLVS is a real-time SLAM system with points, lines, volumetric mapping and 3D unsupervised incremental segmentation.
GNU General Public License v3.0
453 stars 67 forks source link

PLVS has some code and link errors #6

Closed zhangzscn closed 9 months ago

zhangzscn commented 10 months ago

Thanks for sharing this great work, I encountered some problems while trying to compile the code, please help to look at it.

System environment

ubuntu 20.04 cuda 12.3 opencv 4.7 system install pcl local install gcc 9.4 ROS not install

Installation process

  1. Change the Opencv version in Thirdparty from 3 to 4
  2. Added the missing Eigen namespace in the types_six_dof_expmap2.h file
  3. Comment out #include <pcl_conversions/pcl_conversions.h> in world_base.cc
  4. Set export USE_LOCAL_OPENCV=0,export USE_CUDA=1 in config.sh
  5. Install basic dependencies: ./install_dependencies.sh
  6. ./build.sh

    Link error

/usr/bin/ld: ../lib/libplvs.so: undefined reference to volumetric_mapping::OctomapWorld::insertPointcloudIntoMapImpl(kindr::minimal::QuatTransformationTemplate<double> const&, boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ> > const&)' /usr/bin/ld: ../lib/libplvs.so: undefined reference tovolumetric_mapping::OctomapWorld::insertPointcloudIntoMapImpl(kindr::minimal::QuatTransformationTemplate const&, boost::shared_ptr<pcl::PointCloud > const&)' collect2: error: ld returned 1 exit status collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/stereo_inertial_tum_vi_old.dir/build.make:235:../Examples_old/Stereo-Inertial/stereo_inertial_tum_vi_old] 错误 1 make[2]: [CMakeFiles/mono_inertial_tum_vi_old.dir/build.make:235:../Examples_old/Monocular-Inertial/mono_inertial_tum_vi_old] 错误 1 make[1]: [CMakeFiles/Makefile2:228:CMakeFiles/mono_inertial_tum_vi_old.dir/all] 错误 2 make[1]: 正在等待未完成的任务.... make[1]: [CMakeFiles/Makefile2:255:CMakeFiles/stereo_inertial_tum_vi_old.dir/all] 错误 2 /usr/bin/ld: ../lib/libplvs.so: undefined reference to volumetric_mapping::OctomapWorld::in sertPointcloudIntoMapImpl(kindr::minimal::QuatTransformationTemplate<double> const&, boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ> > const&)' collect2: error: ld returned 1 exit status /usr/bin/ld: ../lib/libplvs.so: undefined reference tovolumetric_mapping::OctomapWorld::insertPointcloudIntoMapImpl(kindr::minimal::QuatTransformationTemplate const&, boost::shared_ptr<pcl::PointCloud > const&)' collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/stereo_inertial_realsense_t265_old.dir/build.make:235:../Examples_old/Stereo-Inertial/stereo_inertial_realsense_t265_old] 错误 1 make[2]: [CMakeFiles/stereo_inertial_realsense_D435i_old.dir/build.make:235:../Examples_old/Stereo-Inertial/stereo_inertial_realsense_D435i_old] 错误 1 make[1]: [CMakeFiles/Makefile2:174:CMakeFiles/stereo_inertial_realsense_D435i_old.dir/all] 错误 2 make[1]: [CMakeFiles/Makefile2:201:CMakeFiles/stereo_inertial_realsense_t265_old.dir/all] 错误 2 make: [Makefile:84:all] 错误 2

Code Change

log.txt

zhangzscn commented 9 months ago

I tried using the noetic container to install PLVS, but CUDA was not installed in the container. In install_local_opencv.sh, CUDA is required. Have you tried using docker to install PLVS?

luigifreda commented 9 months ago

Hi, thanks for your feedback. You can now use the noetic_cuda container in rosdocker. You can pull for the new updates.

Cheers, Luigi

zhangzscn commented 9 months ago

@luigifreda I found out why the compilation failed earlier.When compiling volumetric_mapping, I in the directory CMakeLists.txt added "set (CMAKE_PREFIX_PATH ${PROJECT_SOURCE_DIR} / Thirdparty/photo/install/share/photo - 1.10)", But this line of code doesn't work.volumetric_mapping is still using pcl-1.13 installed on the system.But in plvs, I added the same line of code, plvs found the local installation of pcl-1.10.

Therefore, I changed the pcl version on the system to 1.10, and volumetric_mapping and plvs both used pcl on the system and finally compiled successfully. But there are a few other bugs that need fixing:

  1. In world_base-cc, you need to add #include <pcl_conversions/pcl_conversions.h> to COMPILE_WITHOUT_ROS as follows:
    
    #include "volumetric_map_base/world_base.h"

ifndef COMPILE_WITHOUT_ROS

include <cv_bridge/cv_bridge.h>

include <image_geometry/stereo_camera_model.h>

include <pcl_conversions/pcl_conversions.h>

endif

include <opencv2/calib3d/calib3d.hpp>

include <opencv2/core/eigen.hpp>

include <pcl/conversions.h>



2. In the plvs/Thirdparty/libelas-gpu/CMakeLists.txt file, it is necessary to remove the 35 in CUDA_ARCH_BIN. My graphics card is Nvidia 4090 and the modification is as follows:
`set(CUDA_ARCH_BIN "50 52 53 61 62 75 80" CACHE STRING "Specify 'real' GPU arch to build binaries for,  BIN(PTX) format is supported. Example: 1.3 2.1(1.3) or 13 21(13)")`

3. In the Pangolin library, we need to change the HAVE_CUDA macro to HAVE_CUDA_PANGOLIN, otherwise when compiling plvs, the following error will be displayed:
pangolin/image/memcpy.h:35:12: fatal error: cuda_runtime.h: No such file or directory

Finally, can you upgrade the version supported by pcl to version 1.30? If you use version 1.30 directly now, plvs compilation will still report errors.
zhangzscn commented 9 months ago

haha,I successfully upgraded the PCL version to 1.30, some code changes refer to the git diff output txt file below. log.txt