欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

使用小觅相机标准入门版运行vins

程序员文章站 2022-04-16 13:25:44
...

运行步骤概括

  1. 下载相机驱动并编译
  2. 下载源码并编译
  3. 更新源码中的配置文件
  4. 运行vins

详细步骤

  • 前前提条件:电脑上已经安装了Ubuntu、ROS、OpenCV

第一步:下载相机驱动并编译

mkdir -p ~/ROS_WORKSPACE/mynt_eye_sdk/src
cd ROS_WORKSPACE/mynt_eye_sdk/src
git clone https://github.com/slightech/MYNT-EYE-S-SDK.git
cd MYNT-EYE-S-SDK
make ros
echo "~/ROS_WORKSPACE/mynt_eye_sdk/devel/setup.bashrc:>>~/.bashrc
source ~/.bashrc

第二步:下载源码并编译

mkdir -p ~/ROS_WORKSPACE/vins_mono_mynt_eye/src
cd ROS_WORKSPACE/vins_mono_mynt_eye/src
git clone https://github.com/slightech/MYNT-EYE-VINS-Sample.git
cd ..
catkin_make
echo "~/ROS_WORKSPACE/vins_mono_mynt_eye/devel/setup.bashrc
source ~/.bashrc

第三步:更新源码中的配置文件

3.1 获得相机与IMU参数

  • 获取相机参数

    cd ROS_WORKSPACE/mynt_eye_sdk
    make samples                                     #编译sdk文件的sample
    ./samples/_output/bin/tutorials/get_img_params   #获得相机的参数
    
  • 获得的相机参数为:

    #相机内参
    left: {
    pinhole, 
    width: 752, 
    height: 480, 
    fx: 358.17549797746926288
    fy: 359.24666800723582583
    cx: 388.61747233659593803
    cy: 240.16748092953034188 
    model: 0, 
    coeffs: [-0.25326343297436710, 0.04841619345004276, 0.00059805649233287, -0.00153479593317240, 0.00000000000000000]}
    
    right: {
    pinhole, 
    width: 752, 
    height: 480, 
    fx: 365.57553526747392425, 
    fy: 365.54425241123698243, 
    cx: 369.96980098269671089, 
    cy: 230.17462048185933554, 
    model: 0, 
    coeffs: [-0.30954460737697198, 0.08688922042475018, 0.00020528773279130, 0.00016894963631214, 0.00000000000000000]}
    
    #相机外参
    Extrinsics 
    right to left: 
    {rotation: [
    0.99946790791265716, -0.00301528183741204, -0.03247782517560629,
    0.00305611847196011, 0.99999460066266410, 0.00120780188953115, 
    0.03247400795377153, -0.00130641530915091, 0.99947172650678739], 
    translation: [121.15860396636720964, -0.18695081041847689, -2.23380732606506438]}
    
  • 获取imu的参数

    cd ROS_WORKSPACE/mynt_eye_sdk
    ./samples/_output/bin/tutorials/get_imu_params   #获得imu参数
    
  • 获得IMU参数为:

    camera calib model: pinhole
    Motion intrinsics:
     {accel: 
    {scale: 
    [
    1, 0, 0, 
    0, 1, 0,
    0, 0, 1
    ], 
    drift: [0., 0, 0], 
    noise: [0.01692543239797352, 0.01673531019556103, 0.01745248750459097], 
    bias: [0.00019031356589715, 0.00016996777864587, 0.00054490537096494]}, 
    
    gyro: {
    scale: 
    [
    1, 0, 0, 
    0, 1, 0, 
    0, 0, 1
    ], 
    drift: [0, 0, 0], 
    noise: [0.00108480261588199, 0.00124663678835018, 0.00110032299198064], 
    bias: [0.00002340483413674, 0.00002359677156776, 0.00001497041805633]}}
    
     Motion extrinsics left to imu: {
    rotation: [
    -0.00646620000000000, -0.99994994000000004, -0.00763565000000000, 
    0.99997908999999996, -0.00646566000000000, -0.00009558000000000,
     0.00004620000000000, -0.00763611000000000, 0.99997084000000003
    ], 
    translation: [0.00533646000000000, -0.04302922000000000, 0.02303124000000000]}
    

3.2: 修改源代码的参数文件

需要修改的文件为:~/ROS_WORKSPACE/vins_mono_mynt_eye/src/config/mynteye/mynteye_s_config

  • 相机投影参数
    fx、fy、cx、cy

  • 相机畸变参数
    coeffs[5]=[k1,k2,p1,p2,k3]

  • imu噪声以及随机游走参数
    得到的参数是3维的,但是源码的参数文件的数据只有一维?

第四步:运行vins

  1. 启动相机
source ~/ROS-WORKSPACE/mynt_eye_sdk/src/wrappers/ros/devel/setup.bash
roslaunch mynt_eye_ros_wrapper mynteye.launch
  1. 运行VINS-Mono
cd ~/ROS-WORKSPACE/vins_mono_mynt_eye
source devel/setup.bashrc
roslaunch vins_estimator mynteye_s.launch #注意这一句,有一个小尾巴s
  1. 成功运行,得到结果
    使用小觅相机标准入门版运行vins

注意事项