ROS实验笔记之——基于dv-gui的camera与IMU校正(DAVIS346与DVXplorer)

18 篇文章 10 订阅

之前博客《ROS学习笔记之——DAVIS346 calibration》已经试过用dv-gui来对事件相机做校正。博客《ROS实验笔记之——基于kalibr来标定DAVIS346》也尝试用了kalibr做校正。本博文再次才用dv-gui来对事件相机的camera与imu做校正

 

目录

配置及校正过程

记录参数

DAVIS346

DVXplorer

其他

参考资料



配置及校正过程

由于eth想尽了办法阻碍event camera的学术发展(也许是想以此掩盖他们学术造假吧),所以一般情况下,linux安装了dv-gui会影响其正常开发,故此此处就用windows来安装dv-gui(linux用户如果不惧怕重装系统也可以试试用linux哈)

但是windows版本好像也有问题。。。。只能改为mac版本了(说实话,经过最近开发event camera,真心觉得eth这个组,真的是。。。。。)

然后类似前面博客那样做即可。

而在dv-gui中,有基于kalibr的矫正camera与imu的参数。由于其只支持ubuntu,所以还是决定用ubuntu进行开发吧哎。

Calculate camera visual-inertial calibration parameters. Calibrate camera intrinsics, spatial and temporal calibration of an IMU with respect to the camera.

标定板下载:docs/april_6x6_2x2cm.pdf · master · iniVation AG / dv-core / dv-imu-cam-calibration · GitLabIMU camera calibrationhttps://gitlab.com/inivation/dv/dv-imu-cam-calibration/-/blob/master/docs/april_6x6_2x2cm.pdf

首先安装dv-gui

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo add-apt-repository ppa:inivation-ppa/inivation-bionic
sudo apt-get update
sudo apt-get install dv-gui
sudo apt-get install dv-runtime-dev

然后下载源码(Files · master · iniVation AG / dv-core / dv-imu-cam-calibration · GitLab),构建

mkdir build
cd build
cmake -DUSE_CUDA_STEREO=ON ..
make
sudo make install

好像编译不成功,试试下面这个

cd dv-example-cpp
cmake .
make -j2 -s
sudo make install

编译显示fpic报错。可参考

在cmakelist中加入

add_compile_options(-fPIC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")

但好像不太可以。。。。

决定换台电脑编译然后拉过来(换台电脑成功了。。。。)

 设置structure跟作者给出的类似如下:

然后设置如下参数

 (对于accumulator):

  • decay function = linear
  • decay param = 1e-8
  • event contribution = 0.35
  • min potential = 0.0
  • max potential = 1.0

对于dv-imu-cam-calibration

  • calibration pattern (recommended aprilgrid)
  • size of the calibration pattern (eg. 6x6)
  • board square size
  • tag spacing ratio (apriltag only)

  开始校正,得到的信息还是比较丰富的

 

有几点需要注意的,首先,里面需要提前输入imu的bias。作者给定的参数如下图

但毕竟这都是给定的。像之前博客就有DAVIS346的测试结果:

#Accelerometers
accelerometer_noise_density: 4.0577448874376872e-02   #Noise density (continuous-time)
accelerometer_random_walk:   8.7349218314222493e-04   #Bias random walk
 
#Gyroscopes
gyroscope_noise_density:     3.4207443164969696e-03   #Noise density (continuous-time)
gyroscope_random_walk:       5.0328372766535944e-05   #Bias random walk

若不加速播放rosbag得到的结果如下(实际用下面的):
      gyr_n: 3.4869979619824697e-03
      gyr_w: 4.4740603706140853e-05

      acc_n: 4.2153479580575477e-02
      acc_w: 8.5654389798364998e-04

那么就先将DVXplorer静止两个小时看看吧hhh~

编写IMU的录取launch(10.34开始录取)

source ~/imu_catkin_ws/devel/setup.bash
roslaunch imu_utils dvxplorer_imu.launch
rosbag play /home/kwanwaipang/dataset/gwphku/hku_dvsplorer_imu_2021-12-02-10-34-28.bag

IMU校正采用的包是(https://github.com/gaowenliang/imu_utils

在imu_utils文件下的launch文件目录下添加一个launch文件,我这里添加的是dvxplorer_imu.launch,并把以下代码复制进文件,代码中的/IMU_data改成自己imu的topic。

<launch>
    <node pkg="imu_utils" type="imu_an" name="imu_an" output="screen">
        <!--TOPIC名称-->
        <param name="imu_topic" type="string" value= "/dvs/imu"/>
        <!--imu_name 无所谓-->
        <param name="imu_name" type="string" value= "imu_dvxplorer"/>
         <!--标定结果存放路径-->s
        <param name="data_save_path" type="string" value= "$(find imu_utils)/dvxplorer/"/>
        <!--数据录制时间-min-->
        <param name="max_time_min" type="int" value= "120"/>
         <!--采样频率,即是IMU频率,采样频率可以使用rostopic hz /dvs/imu查看,设置为1000-->
        <param name="max_cluster" type="int" value= "1000"/>
    </node>
</launch>

记录参数

DAVIS346

先试试用默认的参数的校正效果

accelerometer noise density0.002

acceletometer random walk4.0e-5

gyroscope noise density0.00018

gyroscope random walk0.001

 

校正结果如下:

(尝试了n次,经常会报错。。。。)

projection: 270.106 270.198 176.598 138.835

 distortion: -0.370937 0.153463 -1.39532e-05 0.000646588

Calibrating using 4061 target observations and 136955 IMU measurements

Transformation T_cam_imu:

imu-cam-calibration   0.974702  -0.223137  0.0128985 0.00398415

imu-cam-calibration  -0.222717  -0.974482  -0.027965 -0.0127033

imu-cam-calibration  0.0188094  0.0243849  -0.999526   0.799613

imu-cam-calibration          0          0          0          1

 Camera to imu time: [s] (t_imu = t_cam + shift):

 -0.000246622

若采用之前标定的值

      gyr_n: 3.4869979619824697e-03
      gyr_w: 4.4740603706140853e-05

      acc_n: 4.2153479580575477e-02
      acc_w: 8.5654389798364998e-04

 Intrinsic calibration results:

  projection: 268.029 268.2 178.259 139.028

 distortion: -0.36741 0.150866 0.0005692 -0.00010249

Calibrating using 4148 target observations and 145429 IMU measurements

 Transformation T_cam_imu:

imu-cam-calibration  -0.876169   0.481339  -0.025299  0.0327882

imu-cam-calibration   0.481812   0.876094 -0.0177976 -0.0505648

imu-cam-calibration  0.0135976 -0.0277831  -0.999521 -0.0713653

imu-cam-calibration          0          0          0          1

 Camera to imu time: [s] (t_imu = t_cam + shift):

  -0.00119093

(这次的结果跟前面两次相差得很大啊。。。。)

再做一次看看吧。。。。。

projection: 269.636 269.875 177.639 138.42 

distortion: -0.369127 0.151308 0.000927198 9.5582e-05

Calibrating using 4232 target observations and 148353 IMU measurements

Transformation T_cam_imu:

imu-cam-calibration    0.920119   -0.366281     0.13863 0.000831942

imu-cam-calibration   -0.386983   -0.904731     0.17806   -0.159823

imu-cam-calibration   0.0602033   -0.217484   -0.974205     1.13248

imu-cam-calibration           0           0           0           1

imu-cam-calibration Camera to imu time: [s] (t_imu = t_cam + shift):

0.00777437

这还是差别有点大啊。。。。。

DVXplorer

默认imu的bias为:

accelerometer noise density1.49e-3

acceletometer random walk8.69e-5

gyroscope noise density8.09e-5

gyroscope random walk2.29e-6

 

 projection: 562.079 561.889 338.749 261.682

 distortion: -0.367853 0.152626 0.000617949 -0.000634148

Calibrating using 4448 target observations and 118296 IMU measurements

Transformation T_cam_imu:

imu-cam-calibration   -0.999643   0.0262715 -0.00489719  0.00251847

imu-cam-calibration   0.0259001     0.99757   0.0646767   0.0214841

imu-cam-calibration  0.00658444   0.0645267   -0.997894  -0.0302793

imu-cam-calibration           0           0           0           1

imu-cam-calibration Camera to imu time: [s] (t_imu = t_cam + shift):

imu-cam-calibration   0.00535007

第二次试的时候非常的卡。。。。

根据上面标定得到的imu的bias为:

acc_n: 3.7863819264639269e-02
acc_w: 6.8693717455312715e-04

gyr_n: 3.1745424413195111e-03

gyr_w: 3.3271308846999896e-05

 projection: 564.188 564.059 339.514 261.761

distortion: -0.372301 0.16491 0.000287552 -0.00100905

Calibrating using 5488 target observations and 148722 IMU measurements

Transformation T_cam_imu:

imu-cam-calibration  -0.966082   0.257502 -0.0194572  0.0406333

imu-cam-calibration   0.254106   0.961349   0.106015 0.00540429

imu-cam-calibration  0.0460042  0.0974746  -0.994174 -0.0376089

imu-cam-calibration          0          0          0          1

 Camera to imu time: [s] (t_imu = t_cam + shift):

imu-cam-calibration   -0.00399087

其他

注意此处得到的T_cam_imu就是imu到camera的。但是有时候我们需要用到camera到imu的;

可以通过下面代码转换

        bool temp_T;
        fsSettings["T_camera_imu"]>>temp_T;//是否输入的为imu到camera
        if (temp_T){//如果是,则执行变换
            RIC[0]=RIC[0].inverse();
            TIC[0]=-RIC[0]*TIC[0];
        }

要是自己新增的module打开dv-gui你会发现还是没有imu-camera这个模块。通过下面步骤进行添加

  • Launch DV (打开软件)
  • Disable Connect to -> Manage local runtime instances. This tells DV to not start its own runtime, and just wait for someone else to start a runtime in its behalf.
  • Select Shutdown if DV asks to shut down the current instance.
  • DV is now waiting for a runtime to be started externally, and will connect as soon as one is started
  • Start your runtime by clicking the play button in your IDE. Make sure to have set up your IDE run configuration as described above.
  • As soon as DV connects to the runtime, select the Structure tab, click on Add module and select Modify module search path.
  • Click on Add path and add the path where you compiled your modules project directory. Click on Done.
  • Click on Add module again. If your module compiled succesfully, it should show up in the list of available modules to add. Click on your module name.
  • Connect the input and outputs of your module. Drag the connections from outputs into your modules inputs, and drag connections from your modules outputs to other inputs.
  • Click the Play Button on your module to start it.
  • If your module is working, you should see your expected outputs.

参考资料

Tutorials | iniVation

DAVIS双目使用说明 - QuartzYan`s Blog

docs/tutorial.md · master · iniVation AG / dv-core / dv-imu-cam-calibration · GitLabhttps://gitlab.com/inivation/dv/dv-imu-cam-calibration/-/blob/master/docs/tutorial.md

Files · master · iniVation AG / dv-core / dv-imu-cam-calibration · GitLabhttps://gitlab.com/inivation/dv/dv-imu-cam-calibration/-/tree/master

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值