1.安装驱动
首先找到官方文档
https://inivation.gitlab.io/dv/dv-docs/docs/getting-started.html
PPA仓库安装
适用于x86_64 x86 arm64 armhf架构的ubuntu18.04
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
额外选项(我安装的时候终端提示我要remove一些东西,我就没有安装额外选项)
sudo apt-get install dv-runtime-dev
连接好事件相机
dv-gui
我打开的时候报了一个错,大意是找不到libfmt.so.8,就安装了一下
sudo apt-get install libfmt-dev
此外报failed to open usb deveice这样的错,就在dv-gui前加上sudo,我这里有时候需要加,有时不需要加,目前不知道为什么。
我动了动手,效果如下图所示
2.ROS驱动安装
从北京智科特公司借了14天的DAVIS346,简单玩几天,参考一下他们的知乎
https://zhuanlan.zhihu.com/p/115420826
安装依赖
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install ros-melodic-camera-info-manager
sudo apt-get install ros-melodic-image-view
安装编译工具
sudo apt-get install python-catkin-tools
创建一个工作区
mkdir -p ~/davis/src
cd davis
catkin config --init --mkdirs --extend /opt/ros/melodic --merge-devel --cmake-args -DCMAKE_BUILD_TYPE=Release
clone仓库
cd src
git clone https://github.com/catkin/catkin_simple.git
git clone https://github.com/uzh-rpg/rpg_dvs_ros.git
编译
cd ..
catkin build dvs_ros_driver #如果使用的是DVS,
catkin build davis_ros_driver #如果使用的是DAVIS
catkin build dvs_renderer #编译渲染器
catkin build dvs_calibration dvs_calibration_gui #编译校准工具
当然 可以全部编译
catkin build
报错找不到libcaer,那就安装一下
sudo apt-get install libcaer-dev
编译完成
source ./devel/setup.zsh
或者
source ./devel/setup.bash
运行launch文件
roslaunch dvs_renderer davis_mono.launch
但是一直报错找不到相机
智科特的使用教程知乎里提到了在运行前要添加串口udev规则,但是rpg的官网已经没有libcaer_catkin包了,最终在github上某个人fork的旧版本驱动里https://github.com/duguyue100/rpg_dvs_ros
找到了这个包,从里面粘贴出来到我们的rpg_dvs_ros目录下,重新编译整个工程,
但是加了之后全部编译不过,终端里一直诡异的让我输入我的github账号和密码,我不太清楚怎么解决,因此可以只编译部分工具,或者在libcaer_catkin包下touch 一个空文件CATKIN_IGNORE,这样catkin build就不会编译这个包了。
然后按照智科特的教程添加串口udev规则
cd ./src/rpg_dvs_ros/libcaer_catkin
sudo ./install.sh
重新launch启动文件,完美运行
3.原理学习
4.基于事件的角点检测
mkdir -p ~/event-feature/src
cd ~/event-feature/src
git clone https://github.com/uzh-rpg/rpg_corner_events.git
由于使用的是DAVIS346,修改代码里所有的sensor_width_为346和sensor_height_为260。
cd ..
catkin build
source ./devel/setup.zsh
编译的时候报错找不到eigen,在CMakeLists.txt里加上
find_package(Eigen3)
和
include_directories(
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)
按照官网教程,跑他们数据集,效果如下
roslaunch corner_event_detector bag.launch
rosbag play 名字_6dof.bag
shapes_6dof
不过动的快了,显示出来就有很大的“滞后”
开launch文件
roslaunch corner_event_detector davis_live.launch
不过效果非常“炸裂”,不知道为什么会是这样,也没有查出来问题在哪里。
正常来说可能是这样的(下图来自智科特知乎)
由于借用时间比较短,就没有很多时间去研究这个了。
5. rpg_ultimate_slam_open里程计
官网上有安装的教程,不过libcaer_catkin包可能要想上面那样拷贝一下,如果要catkin build所有包的话,编译的时候可能会缺失一些包,这里面有一些包是rpg自己的,可以到直接他们的github里git clone下来到src文件夹下。
校准的话rpg这个里程计的官网也有校准教程,不过用的是ethz的kalibr开源方法校准的普通相机和IMU的,我看rpg实验室的github里面有专门校准事件相机的开源代码,后面有时间的话就试试。
除此之外,davis346的那个官方软件dv-gui也是有校准方法的,不过只能单独校准普通相机和事件相机内参,方法可以参考这篇博客,很简单,不过输出的畸变模型我不太清楚是什么,官网上也没有明确说明,我就按照radtan畸变模型用的(五个参数分别为k1 k2 k3 p1 p2这样)。
Calibration [Tutorial] · DV ROS实验笔记之——基于dv-gui的camera与IMU校正(DAVIS346与DVXplorer)_gwpscut的博客-CSDN博客
最后转化成他们指定的配置文件的那个命令我怎么也找不到(就是那个kalibr_swe_config命令,也许是kalibr代码最近更新了?不过我就懒得再重新弄kalibr了,直接在他们的yaml文件改了一个出来),下面是我的yaml文件,普通图像内参和普通相机到imu外参我是通过kalibr校准的(官网也给教程了),事件相机到IMU的外参我直接用的普通相机到imu的外参,事件相机的内参通过官网dv-gui标定得到的。
label: "davis346"
id: 44a065371c2167572a3d78e91a0bdd4fc3e0ab6b
cameras:
- camera:
label: dvs
id: 0
line-delay-nanoseconds: 0
image_height: 260
image_width: 346
type: pinhole
intrinsics:
cols: 1
rows: 4
data: [257.58960681932058, 258.12347796081457, 181.46733413693283, 119.69857986917636]
distortion:
type: radial-tangential
parameters:
cols: 1
rows: 4
data: [-0.37415866011705118, 0.16938630263999321, 0.0014430303701894415, -0.028466447083632558]
T_B_C:
cols: 4
rows: 4
data: [0.9999894430374379, 0.0044976021757303485, 0.0009409507653195729, 0.0011158279637303347,
-0.004490581023380513, 0.9999630129535921, -0.007335353218868782, 0.0034709482773699336,
-0.0009739074629268838, 0.0073310503641687945, 0.9999726532284824, -0.05393635037431214,
0.0, 0.0, 0.0, 1.0]
- camera:
label: standard
id: 1
line-delay-nanoseconds: 0
image_height: 260
image_width: 346
type: pinhole
intrinsics:
cols: 1
rows: 4
data: [280.50339118956435, 280.8346724687862, 190.1330540227773, 122.5817227578842]
distortion:
type: radial-tangential
parameters:
cols: 1
rows: 4
data: [-0.36056255324218756, 0.1353830609649307, 0.0004807173257201723,-0.00036287954199890955]
T_B_C:
cols: 4
rows: 4
data: [0.9999894430374379, 0.0044976021757303485, 0.0009409507653195729, 0.0011158279637303347,
-0.004490581023380513, 0.9999630129535921, -0.007335353218868782, 0.0034709482773699336,
-0.0009739074629268838, 0.0073310503641687945, 0.9999726532284824, -0.05393635037431214,
0.0, 0.0, 0.0, 1.0]
最上面的label和id我乱写的,然后下面的dvs代表事件,standard代表普通相机。
按照官网教程跑他们的数据包,没深入看他们的代码不太清楚怎么调,会一瞬间跑完(就很怪...)
rpg_ultimate_slam_open/Run-Examples.md at main · uzh-rpg/rpg_ultimate_slam_open · GitHub
这个是官方教程如何跑他们的数据集,跑通比较简单,就是不知道怎么调节速度
然后就是自己davis346实战如下:
第一个终端
roscore
第二个终端
rosrun davis_ros_driver davis_ros_driver
第三个终端
roslaunch ze_vio_ceres live_DAVIS240C.launch camera_name:=davis346.yaml
我是在他的原来的launch文件里面改的
<launch>
<arg name="camera_name" />
<arg name="timeshift_cam_imu" default="0" />
<arg name="motion_correction" default="1" />
<arg name="frame_size" default="15000" />
<node name="ze_vio_ceres" pkg="ze_vio_ceres" type="ze_vio_ceres_node"
output="screen" required="true"
args="
--data_source=2 # rostopic
--vio_use_events=1
--vio_use_events_and_images=0
--vio_rescale_intrinsics_for_distortion=true
--timeshift_cam_imu=$(arg timeshift_cam_imu)
--calib_filename=$(find ze_vio_ceres)/../../calibration/davis346.yaml
--flagfile=$(find ze_vio_ceres)/cfg/vio_base.conf
--flagfile=$(find ze_vio_ceres)/cfg/vio_davis.conf
--data_size_augmented_event_packet=40000 # max number of events per event frame (should be >= vio_frame_size)
--vio_frame_size=$(arg frame_size) # each event frame will be drawn with that number of events.
--vio_do_motion_correction=$(arg motion_correction)
--noise_event_rate=20000
--vio_frame_norm_factor=4.0
--vio_trace_pose=1
--log_dir=/tmp
--vmodule=feature_tracker=0
--colorlogtostderr=1
--logtostderr=1
--alsologtostderr=1
--vio_viz_feature_tracks=true
--vio_viz_feature_tracks_length=0
">
</node>
<node name="visualisation" pkg="rviz" type="rviz" output="screen" args="-d $(find ze_visualization)/rviz/ze.rviz" />
</launch>
主要是改calib_filename改成我的标定文件
1.事件图像+普通图像+IMU()
launch文件里面
--vio_use_events=0
--vio_use_events_and_images=1
这个没跑通,一有数据到来就报错,不知道怎么解决
甩
2.事件图像+IMU
这个我跑出来了,不过效果略差,可能是由于内外参标定的原因。
launch文件里面
--vio_use_events=1
--vio_use_events_and_images=0
效果与事件相机内参有很大影响,除此之外我没找到代码里面哪里需要我写入imu参数(也就是加速度计/陀螺仪偏置和噪声)
我第一组内参比较差,事件图像就被压成了一坨,所以要好好校准内参。
效果如下,小范围内移动飘移也是很明显的(也许是我内参不行),感觉小范围内移动还不如我用realsenseD455跑vins。
这一张我就简单向前动了一下,做个示例
这一张我就测试的是前后几十厘米快速移动,最后回原点垂直方向有些飘移
周围移动,录了个视频
ultimate_slam_davis346_1
乱甩的视频(毕竟是借的,不敢甩太快),可以看到完全不能像rpg官网demo一样炫酷 : (
my2
除此之外,我发现当我像rpg官网那样甩我的相机的时候,程序可能会死掉(炫酷都是人家的。。。。。。)不知道为什么会出现这种问题,毕竟没什么时间仔细研究代码。
W0712 21:33:22.305409 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 0 features, < 20)
W0712 21:33:22.305912 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 4 features, < 20)
W0712 21:33:22.309612 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 3 features, < 20)
W0712 21:33:22.310464 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 3 features, < 20)
W0712 21:33:22.313412 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 5 features, < 20)
W0712 21:33:22.314321 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 5 features, < 20)
W0712 21:33:22.317778 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 9 features, < 20)
W0712 21:33:22.319177 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 4 features, < 20)
W0712 21:33:22.330327 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 8 features, < 20)
W0712 21:33:22.331858 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 5 features, < 20)
W0712 21:33:22.334154 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 17 features, < 20)
W0712 21:33:22.338300 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 14 features, < 20)
W0712 21:33:22.554064 19234 frontend_base.cpp:1147] Motion Type: INVALID (inlier ratio = 57.1429%)
W0712 21:33:22.955899 19234 frontend_base.cpp:1147] Motion Type: INVALID (inlier ratio = 57.4468%)
W0712 21:33:23.123414 19234 frontend_base.cpp:1147] Motion Type: INVALID (inlier ratio = 59.5745%)
W0712 21:33:23.350950 19234 frontend_base.cpp:1137] Motion Type: INVALID (tracking 17 features, < 20)
E0712 21:33:23.479789 19234 frontend_base.cpp:1005] Less than 3 IMU measurements in vector.
E0712 21:33:23.479810 19234 frontend_base.cpp:398] No IMU messages provided.
E0712 21:33:23.481513 19234 frontend_base.cpp:1005] Less than 3 IMU measurements in vector.
E0712 21:33:23.481534 19234 frontend_base.cpp:398] No IMU messages provided.
E0712 21:33:23.481545 19234 frontend_base.cpp:1005] Less than 3 IMU measurements in vector.
E0712 21:33:23.481559 19234 frontend_base.cpp:398] No IMU messages provided.
E0712 21:33:23.481573 19234 frontend_base.cpp:1005] Less than 3 IMU measurements in vector.
E0712 21:33:23.481588 19234 frontend_base.cpp:398] No IMU messages provided.
E0712 21:33:23.489029 19234 frontend_base.cpp:1005] Less than 3 IMU measurements in vector.
E0712 21:33:23.489151 19234 frontend_base.cpp:398] No IMU messages provided.
F0712 21:33:23.489224 19234 frontend_base.cpp:1020] Check failed: imu_stamps_since_lkf_[imu_stamps_since_lkf_.size() - 1] == imu_stamps[0] (1657632800542428226 vs. 1657632800551788226)
*** Check failure stack trace: ***
@ 0x7fb09f0da0cd google::LogMessage::Fail()
@ 0x7fb09f0dbf33 google::LogMessage::SendToLog()
@ 0x7fb09f0d9c28 google::LogMessage::Flush()
@ 0x7fb09f0dc999 google::LogMessageFatal::~LogMessageFatal()
@ 0x7fb09f344c8a ze::FrontendBase::addImuMeasurementsBetweenKeyframes()
@ 0x7fb09f344cf2 ze::FrontendBase::addImuMeasurementsBetweenKeyframes()
@ 0x7fb09f348865 ze::FrontendBase::processData()
@ 0x7fb09dca9fe3 ze::CameraImuSynchronizer::checkImuDataAndEventsCallback()
@ 0x7fb09dcbe9a2 ze::CameraImuSynchronizerBase::addEventsData()
@ 0x7fb09dc944c4 ze::DataProviderRostopic::eventsCallback()
@ 0x7fb09dc9fede boost::detail::function::void_function_obj_invoker1<>::invoke()
@ 0x7fb09dca27f8 ros::SubscriptionCallbackHelperT<>::call()
@ 0x7fb09ec52e92 ros::SubscriptionQueue::call()
@ 0x7fb09ebfd559 ros::CallbackQueue::callOneCB()
@ 0x7fb09ebff2fb ros::CallbackQueue::callAvailable()
@ 0x7fb09dc93726 ze::DataProviderRostopic::spinOnce()
@ 0x7fb09dc6bcb9 ze::DataProviderBase::spin()
@ 0x7fb09f33dc54 ze::VisualOdometry::startBlocking()
@ 0x55d90b3357ac main
@ 0x7fb09df02c87 __libc_start_main
@ 0x55d90b335d2a _start
================================================================================REQUIRED process [ze_vio_ceres-1] has died!
process has died [pid 19234, exit code -6, cmd /home/mwy/rpg_ultimate_slam_open/devel/lib/ze_vio_ceres/ze_vio_ceres_node --data_source=2 # rostopic --vio_use_events=1 --vio_use_events_and_images=0 --vio_rescale_intrinsics_for_distortion=true --timeshift_cam_imu=0 --calib_filename=/home/mwy/rpg_ultimate_slam_open/src/rpg_ultimate_slam_open/applications/ze_vio_ceres/../../calibration/davis346.yaml --flagfile=/home/mwy/rpg_ultimate_slam_open/src/rpg_ultimate_slam_open/applications/ze_vio_ceres/cfg/vio_base.conf --flagfile=/home/mwy/rpg_ultimate_slam_open/src/rpg_ultimate_slam_open/applications/ze_vio_ceres/cfg/vio_davis.conf --data_size_augmented_event_packet=50000 # max number of events per event frame (should be >= vio_frame_size) --vio_frame_size=5000 # each event frame will be drawn with that number of events. --vio_do_motion_correction=1 --noise_event_rate=20000 --vio_frame_norm_factor=4.0 --vio_trace_pose=1 --log_dir=/tmp --vmodule=feature_tracker=1 --colorlogtostderr=1 --logtostderr=1 --alsologtostderr=1 --vio_viz_feature_tracks=true --vio_viz_feature_tracks_length=0 __name:=ze_vio_ceres __log:=/home/mwy/.ros/log/cee597de-01e4-11ed-95af-cc153158c4f6/ze_vio_ceres-1.log].
log file: /home/mwy/.ros/log/cee597de-01e4-11ed-95af-cc153158c4f6/ze_vio_ceres-1*.log
Initiating shutdown!
================================================================================
[visualisation-2] killing on exit
[ze_vio_ceres-1] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done