相機+IMU+雷達環境搭建

cold_moon發表於2024-07-04

1. 相機顏色不正確

cd hik_camera_driver

vim src/mvs_ros_pkg/src/grab_trigger_new.cpp

nRet = MV_CC_GetImageForRGB(handle, pData, nBufSize, &stImageInfo, 1000);

啟動相機:

source devel/setup.bash
roslaunch mvs_ros_pkg mvs_camera_trigger.launch

2. LET-NET VINS-mono 程式碼

copy 到 目錄下:

rm src/CMakeLists.txt

catkin_make

報錯:

CMake Error at xx/camera_model/CMakeLists.txt:19 (find_package):
By not providing "FindCeres.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Ceres", but
CMake did not find one.

Could not find a package configuration file provided by "Ceres" with any of
the following names:

CeresConfig.cmake
ceres-config.cmake

Add the installation prefix of "Ceres" to CMAKE_PREFIX_PATH or set
"Ceres_DIR" to a directory containing one of the above files. If "Ceres"
provides a separate development package or SDK, be sure it has been
installed.

http://ceres-solver.org/installation.html#linux

手動下載:

https://ceres-solver.googlesource.com/ceres-solver/+/refs/tags/2.2.0

下載 tgz

或者:

git clone https://ceres-solver.googlesource.com/ceres-solver
# CMake
sudo apt-get install cmake
# google-glog + gflags
sudo apt-get install libgoogle-glog-dev libgflags-dev
# Use ATLAS for BLAS & LAPACK
sudo apt-get install libatlas-base-dev
# Eigen3
sudo apt-get install libeigen3-dev
# SuiteSparse (optional)
sudo apt-get install libsuitesparse-dev
cd ceres-solver
mkdir ceres-bin
cd ceres-bin
cmake ..
make -j8
make test
# Optionally install Ceres, it can also be exported using CMake which
# allows Ceres to be used without requiring installation, see the documentation
# for the EXPORT_BUILD_DIR option for more information.
sudo make install

附加驅動安裝 nvidia 驅動

重啟

nvidia-smi 檢驗

安裝 ncnn: https://www.cnblogs.com/odesey/p/18237733

報錯:

CMake Error at VINS-Mono-LET-Net/feature_tracker/CMakeLists.txt:20 (find_package):
By not providing "Findncnn.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "ncnn", but
CMake did not find one.

Could not find a package configuration file provided by "ncnn" with any of
the following names:

ncnnConfig.cmake
ncnn-config.cmake

Add the installation prefix of "ncnn" to CMAKE_PREFIX_PATH or set
"ncnn_DIR" to a directory containing one of the above files. If "ncnn"
provides a separate development package or SDK, be sure it has been
installed.

vim src/VINS-Mono-LET-Net/feature_tracker/CMakeLists.txt

set(ncnn_DIR "/home/xx/programs/ncnn/build/install/lib/cmake/ncnn" CACHE PATH "Directory that contains ncnnConfig.cmake")

export ncnn_DIR=/home/xx/programs/ncnn/build/install/lib/cmake/ncnn

需要安裝 opencv3.x
更新 opencv 3.4.20: https://www.cnblogs.com/odesey/p/18237733

CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "cv_bridge" with
any of the following names:

cv_bridgeConfig.cmake
cv_bridge-config.cmake

https://www.cnblogs.com/odesey/p/18237733

報錯:fatal error: ceres/local_parameterization.h: 沒有那個檔案或目錄
4 | #include "ceres/local_parameterization.h"

解決:https://github.com/chichengcn/gici-open/issues/4#issuecomment-1626684365

ceres-solver 2.2 版本不行,降級到1.14.0版本

Ceres解除安裝

Ceres只有一個庫檔案在"/usr/local/lib/“中,並且所有的標頭檔案都在”/usr/local/include/ceres/"中,解除安裝就是很簡單的兩步:

sudo rm -r /usr/local/lib/cmake/Ceres
sudo rm -rf /usr/local/include/ceres /usr/local/lib/libceres.a
git tag
git checkout  1.14.0
cd ceres-bin/
cmake ..
make -j$(nproc)
make test
# Optionally install Ceres, it can also be exported using CMake which
# allows Ceres to be used without requiring installation, see the documentation
# for the EXPORT_BUILD_DIR option for more information.
sudo make install
 vim package.xml # 可以看到版本

ROS noetic 版本中自帶的 OpenCV4 和 VINS-mono 中需要使用的 OpenCV3 衝突 的問題.

安裝 ros noetic 後:

pkg-config opencv4 --modversion
4.2.0

我們自己裝的:

pkg-config opencv --modversion
3.4.20

這會導致衝突。編譯報錯。

pose_graph/src/ThirdParty/DVision/BRIEF.cpp:53:32: error: ‘CV_RGB2GRAY’ was not declared in this scope

#include <opencv2/imgproc/types_c.h>

pose_graph.cpp:312:97: error: ‘CV_FONT_HERSHEY_SIMPLEX’ was not declared in this scope

CV_FONT_HERSHEY_SIMPLEX引數改為cv::FONT_HERSHEY_SIMPLEX

IMU 讀取

cd lidar_color_map
sudo chmod 777 /dev/ttyUSB0
roslaunch livox_ros_driver livox_lidar.launch

因為環境不相容問題,我的 特徵跟蹤模組無法啟動。該方案已經放棄。