转载自:
    
     https://blog.csdn.net/AnChenliang_1002/article/details/108737351
    
   
    在Intel nuc上配置D435i、运行VINS-Mono及问题记录
   
    标签:
    
     Intel nuc
    
    
     VINS-Mono
    
    
     Intel D435i
    
    
     ubuntu
    
    
     linux
    
   
    参考网址:https://blog.csdn.net/weixin_44580210/article/details/89789416
    
    
     问题1:
    
    
    安装测试librealsense SDK 2.0的过程中,运行到这一步,
    
     sudo apt-get install librealsense2-dkms
    
    ,弹出了一个蓝色窗口,好像是软件安全设置,原因可能跟UEFI引导项有关系,让设置了一个密码,我设置的是18822091613,之后按步骤安装,到最后一步,测试SDK:
    
     realsense-viewer
    
    时,打开的窗口里不显示d435i相机信息,如下图:
   
     
   
    因为整个安装过程只有上述那一步出现了问题,所以我猜可能是安装library时的问题,于是将其卸载
    
     sudo apt-get autoremove librealsense2-dkms
    
    ,卸载完之后再打开SDK,
    
     realsense-viewer
    
    ,发现竟然能显示相机了,之后我又多次试验,反复安装和卸载library,发现真的能影响相机的连接,具体的原因我现在还不清楚。
   
    用d435i运行VINS-mono
   
第一步:
    参考网址:https://blog.csdn.net/jiangchuanhu/article/details/92795791
    
    参考里面的第二部分:二、安装ROS Wrapper for Intel RealSense
   
.
如下
    **#Step 1: Install the latest Intel RealSense SDK
   
    Step 2: Install the ROS Kinetic — http://wiki.ros.org/kinetic/Installation/Ubuntu
   
    Step 3: Install Intel RealSense ROS from Sources**
   
    
     Create a catkin workspace
    
   
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
#Clone the latest Intel RealSense ROS into ‘catkin_ws/src/’
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^\d+\.\d+\.\d+" | tail -1`
cd ../..
Make sure all dependent ros packages are installed. You can check .travis.yml file for reference.
sudo apt install ros-kinetic-cv-bridge ros-kinetic-image-transport ros-kinetic-tf ros-kinetic-diagnostic-updater ros-kinetic-ddynamic-reconfigure
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
echo source $(pwd)/devel/setup.bash >> ~/.bashrc
source ~/.bashrc
    Step 4:检验是否能在ros使用realsense相机:
   
    通过usb连接相机到电脑
   
sudo apt install ros-kinetic-rgbd-launch
roslaunch realsense2_camera rs_rgbd.launch
    查看一下相机发布的topic
   
rostopic list
    查看相机内参信息的两种方式
   
rostopic echo /camera/color/camera_info
rostopic echo /camera/aligned_depth_to_color/camera_info
    再打开一个终端
   
rviz
    此时并不能看到什么结果,左上角 Displays 中 Fixed Frame 选项中,下拉菜单选择 camera_link,这是主要到Global Status变成了绿色
   
    点击该框中的Add -> 上方点击 By topic -> /depth_registered 下的 /points 下的/PointCloud2
   
    点击该框中的Add -> 上方点击 By topic -> /color 下的 /image_raw 下的image
   
    在D435i上运行VINS-Mono
   
    此时,d435i的配置已经完成,剩下的就是在VINS上跑,步骤如下
    
    参考
    
    https://blog.csdn.net/weixin_44580210/article/details/89789416这里面的第四步:
   
1、 修改realsense包里的rs_camera.launch文件
第一处,修改unite_imu_method如下,这里是让IMU的角速度和加速度作为一个topic输出
第二处,修改enable_sync参数为true,这里是开机相机和IMU的同步
2、修改VINS-Mono包里的realsense_color_config.yaml文件
第一处,修改订阅的topic
    imu_topic: “/camera/imu”
    
    image_topic: “/camera/color/image_raw”
   
第二处,修改相机内参,这里先再次打开运行realsesne包,然后可以通过如下命令获取相机内参
rostopic echo /camera/color/camera_info
第三处,IMU到相机的变换矩阵,这里我根据注释的提示修改成2
    Extrinsic parameter between IMU and Camera.
   
    estimate_extrinsic: 2 # 0 Have an accurate extrinsic parameters. We will trust the following imu^R_cam, imu^T_cam, don’t change it.
    
    # 1 Have an initial guess about extrinsic parameters. We will optimize around your initial guess.
    
    # 2 Don’t know anything about extrinsic parameters. You don’t need to give R,T. We will try to calibrate it. Do some rotation movement at beginning.
    
    #If you choose 0 or 1, you should write down the following matrix.
   
第四处,IMU参数,这里我全部修改注释给的参数
    #imu parameters The more accurate parameters you provide, the better performance
    
    acc_n: 0.2 # accelerometer measurement noise standard deviation. #0.2
    
    gyr_n: 0.05 # gyroscope measurement noise standard deviation. #0.05
    
    acc_w: 0.02 # accelerometer bias random work noise standard deviation. #0.02
    
    gyr_w: 4.0e-5 # gyroscope bias random work noise standard deviation. #4.0e-5
    
    g_norm: 9.80 # gravity magnitude
   
第五处,是否需要在线估计同步时差,根据上述博主的建议这里选择不需要
    #unsynchronization parameters
    
    estimate_td: 0 # online estimate time offset between camera and imu
    
    td: 0.000 # initial value of time offset. unit: s. readed image clock + td = real image clock (IMU clock)
   
第六处,相机曝光改成全局曝光
    #rolling shutter parameters
    
    rolling_shutter: 0 # 0: global shutter camera, 1: rolling shutter camera
    
    rolling_shutter_tr: 0 # unit: s. rolling shutter read out time per frame (from data sheet).
   
- 打开摄像头,运行VINS-Mono
roslaunch realsense2_camera rs_camera.launch 
roslaunch vins_estimator realsense_color.launch 
roslaunch vins_estimator vins_rviz.launch
下一项 用d435i跑ORB-SLAM2
 
