文章目录
- 硬件
- 设置相机内参和外参
- 设置IMU内参
- 依赖
- 标定
- 可能遇到的问题
硬件
- x86电脑
- realsense d435i相机
设置相机内参和外参
安装ROS标定工具包
sudo apt install ros-melodic-camera-calibration
启动realsense相机
roslaunch realsense2_camera rs_camera.launch
打开标定窗口
rosrun camera_calibration cameracalibrator.py --size 10x8 --square 0.01 image:=/camera/color/image_raw camera:=/camera/color --no-service-check
PS:size为网格的横向、纵向的数量,square为网格的大小(单位m)
移动标定板会自动采集样本,当达到所需样本最小数量时,calibration按钮会变绿,点击按钮之后会进行标定。
除了realsense的畸变系数需要标定,其他通过下列命令查询
rs-enumerate-devices -c
相机内参和畸变参数
相机和IMU的外参
Rotation_Matrix (Extrinsic from "Gyro" To "Fisheye 1") --> Tbc.data.R
Rotation_Matrix[0][0] --> Tbc.data[0][0]
Rotation_Matrix[0][1] --> Tbc.data[0][1]
Rotation_Matrix[0][2] --> Tbc.data[0][2]
Rotation_Matrix[1][0] --> Tbc.data[1][0]
Rotation_Matrix[1][1] --> Tbc.data[1][1]
Rotation_Matrix[1][2] --> Tbc.data[1][2]
Rotation_Matrix[2][0] --> Tbc.data[2][0]
Rotation_Matrix[2][1] --> Tbc.data[2][1]
Rotation_Matrix[2][2] --> Tbc.data[2][2]
Translation Vector (Extrinsic from "Gyro" To "Fisheye 1") --> Tbc.data.t
Translation_Vector[0] --> Tbc.data[0][3]
Translation_Vector[1] --> Tbc.data[1][3]
Translation_Vector[2] --> Tbc.data[2][3]
设置IMU内参
依赖
Ceres
# CMake
sudo apt-get install cmake
# google-glog + gflags
sudo apt-get install libgoogle-glog-dev libgflags-dev
# BLAS & LAPACK
sudo apt-get install libatlas-base-dev
# Eigen3
sudo apt-get install libeigen3-dev
# SuiteSparse and CXSparse (optional)
sudo apt-get install libsuitesparse-dev
# Ceres
git clone https://github.com/ceres-solver/ceres-solver.git
cd ceres-solver && mkdir build && cd build && cmake .. && make -j32
sudo make install
libdw
sudo apt-get install libdw-dev
标定
录制rosbag包
终端1
mkdir -p imu_utils_ws/src && cd imu_utils_ws/src && git clone https://github.com/IntelRealSense/realsense-ros.git
cd .. && source /opt/ros/noetic/setup.bash && catkin_make && source devel/setup.bash
roslaunch realsense2_camera rs_t265.launch enable_gyro:=true enable_accel:=true unite_imu_method:=copy
终端2
rosbag record -O imu_calibration /camera/imu
生成IMU内参
终端1
mkdir -p imu_utils_ws/src && cd imu_utils_ws/src && git clone https://github.com/shanpenghui/imu_utils.git
cd .. && source /opt/ros/noetic/setup.bash && catkin_make && source devel/setup.bash
roslaunch imu_utils realsense.launch
终端2
rosbag play -r 200 imu_calibration.bag
可能遇到的问题
Q1
The following packages have unmet dependencies:
libdw-dev : Depends: libelf-dev but it is not going to be installed
Depends: libdw1 (= 0.165-3ubuntu1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
A1
sudo apt-get install libelf1= 0.165-3ubuntu1
sudo apt-get install libelf-dev
Q2
error: aggregate 'std::ofstream out_t' has incomplete type and cannot be defined
A2
//添加保护头文件
#include <fstream>