0. 本人配置平台为ubuntu22.04,使用ros的版本为humble
1. 搜索Installation - direct_visual_lidar_calibration
2. 按照官网教程装依赖
# Install dependencies
# Install GTSAM
在Install Ceres中开始出现报错:
git clone https://github.com/ceres-solver/ceres-solver
会发现git下来的文件中/home/xxx/ceres-solver/third_party/abseil-cpp为空,因此需要更换clone选项:
git clone --recurse-submodules https://github.com/ceres-solver/ceres-solver
此后根据官网教程继续编译。
3.Build direct_visual_lidar_calibration
3.1)在本人第一次编译中遇到如下报错
CMake Error at CMakeLists.txt:12 (if):
if given arguments:
"EQUAL" "1"
Unknown arguments specified
解决方式:
找到功能包中CMakeLists.txt:12的位置,我直接把对于ros1部分的if判断注释掉,直接执行ros2部分。
3.2)在本人第二次编译中遇到如下报错:
CMake Error at CMakeLists.txt:18 (find_package):
By not providing "Findament_cmake_auto.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"ament_cmake_auto", but CMake did not find one.
Could not find a package configuration file provided by "ament_cmake_auto"
with any of the following names:
ament_cmake_autoConfig.cmake
ament_cmake_auto-config.cmake
Add the installation prefix of "ament_cmake_auto" to CMAKE_PREFIX_PATH or
set "ament_cmake_auto_DIR" to a directory containing one of the above
files. If "ament_cmake_auto" provides a separate development package or
SDK, be sure it has been installed.
解决方式:
当然是忘记source /opt/ros/humble/setup.bash
3.3)在本人第三次编译中遇到如下报错:
CMake Error at CMakeLists.txt:24 (find_package):
Found package configuration file:
/usr/local/lib/cmake/Ceres/CeresConfig.cmake
but it set Ceres_FOUND to FALSE so package "Ceres" is considered to be NOT
FOUND. Reason given by package:
The following imported targets are referenced, but are missing:
absl::log_flags absl::log absl::check absl::fixed_array absl::strings
absl::time
解决方式:
sudo gedit /usr/local/lib/cmake/Ceres/CeresConfig.cmake,打开对应文件:
将set(Ceres_FOUND FALSE)与set(CERES_FOUND FALSE)中的FALSE均改为TRUE
随后在功能包的CMakeLists.txt中加入:
set(ABSEIL_DIR "home/jwb/ThirdParty/ceres-solver/third_party/abseil-cpp" CACHE PATH "Path to Abseil libraries") # (abseil在ceres库中安装位置)
find_package(absl REQUIRED HINITS ${ABSEIL_DIR})
3.4)在本人第四次编译中遇到如下报错:
/usr/bin/ld: 找不到 -lfmt
collect2: error: ld returned 1 exit status
解决方式:
先到https://fmt.dev/8.1.1/index.html下载8.1.1版,注意不要git也不要下最新版,都会报错。
cd fmt-8.1.1
mkdir build
cd build
cmake ..
make
sudo make install
4.上述是本人在编译过程中遇到的所有报错情况。
感谢该篇博客。相机、激光雷达联合标定direct_visual_lidar_calibration教程_雷达相机联合标定-CSDN博客