在Ubuntu20.04上安装kalibr的时候一直报错,大部分错误跟着网上的解决方法都能解决,到最后剩下一个错误怎么都解决不了。CMake Error at /home/alex/work/Camera/kalibr_ws/src/kalibr/Schweizer-Messer/python_module/cmake/add_python_export_library.cmake:135 (get_property):
The LOCATION property may not be read from target "numpy_eigen". Use the
target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate. ...,完整报错如下:
Errors << numpy_eigen:cmake /home/alex/work/Camera/kalibr_ws/logs/numpy_eigen/build.cmake.001.log
CMake Error at /home/alex/work/Camera/kalibr_ws/src/kalibr/Schweizer-Messer/python_module/cmake/add_python_export_library.cmake:135 (get_property):
The LOCATION property may not be read from target "numpy_eigen". Use the
target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate.
Call Stack (most recent call first):
CMakeLists.txt:54 (add_python_export_library)
CMake Error at /home/alex/work/Camera/kalibr_ws/src/kalibr/Schweizer-Messer/python_module/cmake/add_python_export_library.cmake:136 (get_filename_component):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
CMakeLists.txt:54 (add_python_export_library)
CMake Error at /home/alex/work/Camera/kalibr_ws/src/kalibr/Schweizer-Messer/python_module/cmake/add_python_export_library.cmake:135 (get_property):
The LOCATION property may not be read from target "numpy_eigen". Use the
target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate.
Call Stack (most recent call first):
CMakeLists.txt:62 (add_python_export_library)
CMake Error at /home/alex/work/Camera/kalibr_ws/src/kalibr/Schweizer-Messer/python_module/cmake/add_python_export_library.cmake:136 (get_filename_component):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
CMakeLists.txt:62 (add_python_export_library)
最后发现是python版本的问题,kalibr是在Ubuntu18.04上开发的,依赖的也是python2.7,所以在Ubuntu20.04上安装Installation · ethz-asl/kalibr Wiki · GitHub这个链接下kalibr就会疯狂出错。在Pull requests中的issue515可以找到支持python3的kalibr。也可以自己安装python2.7,但是我没有安装,所以也不知道行不行。
1.安装依赖
sudo apt-get install -y python3-dev python3-pip python3-scipy python3-matplotlib ipython3 python3-wxgtk4.0 python3-tk python3-igraph
sudo apt-get install python3-setuptools python3-rosinstall ipython3 libeigen3-dev libboost-all-dev doxygen libopencv-dev ros-noetic-vision-opencv ros-noetic-image-transport-plugins ros-noetic-cmake-modules python3-software-properties software-properties-common libpoco-dev python3-matplotlib python3-scipy python3-git python3-pip ipython3 libtbb-dev libblas-dev liblapack-dev python3-catkin-tools libv4l-dev
sudo apt-get install python3-catkin-tools python3-osrf-pycommon
pip3 install wxPython
2.下载编译
source /opt/ros/noetic/setup.bash
catkin init
catkin config --extend /opt/ros/noetic
catkin config --merge-devel # Necessary for catkin_tools >= 0.4.
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
catkin build -DCMAKE_BUILD_TYPE=Release -j4
报错:找不到Eigen库
Could not find a package configuration file provided by "Eigen3" with any
of the following names:
Eigen3Config.cmake
eigen3-config.cmake
解决方法:将 FindEigen3.cmake的位置链接过去,即在CmakeLists.txt里添加
set(CMAKE_MODULE_PATH "FindEigen3.cmake的位置")
//例如:set(CMAKE_MODULE_PATH "/opt/ros/noetic/share/cmake_modules/cmake/Modules")
然后再build(终端输入:catkin build -DCMAKE_BUILD_TYPE=Release -j4),顺利编译。
3.使用Kalibr
source ~/kalibr_workspace/devel/setup.bash
rosrun kalibr kalibr_calibrate_cameras \
--target ./april_6x6_80x80cm.yaml \
--bag ./res.bag \
--models pinhole-radtan pinhole-radtan pinhole-radtan \
--topics /color /infra_left /infra_right \
--bag-from-to 3 202 \
--show-extraction \
--approx-sync 0.04
参数解释:
-
--target ./april_6x6_80x80cm.yaml 是标定板的配置文件,注意如果选择棋格盘,注意targetCols和targetRows表示的是内侧角点的数量,不是格子数量。https://github.com/ori-drs/kalibr
-
--bag ./res.bag 是录制的数据包
-
--models pinhole-radtan pinhole-radtan pinhole-radtan 表示三个摄像头的相机模型和畸变模型(解释参考https://github.com/ethz-asl/kalibr/wiki/supported-models,根据需要选取)
-
--topics /color /infra_left /infra_right 表示三个摄像头对应的拍摄的数据话题
-
--bag-from-to 3 202表示处理bag中3-202秒的数据。(控制时长)
-
--show-extraction表示显示检测特征点的过程,这些参数可以相应的调整。
可以使用rosbag info 来参看录制的包的信息。eg:rosbag info res.bag
notice:
--topics /color /infra_left /infra_right 表示三个摄像头对应的拍摄的数据话题,他们的顺序对标定结果是有影响的。yaml文件里生成的是以第一个话题为主体,其他两个话题相对于它的变换矩阵。