【无人机自主导航4 视觉传感器】通过ROS发布、订阅话题连接Realsense视觉相机

发布于 2021-03-21  1252 次阅读


一、视觉传感器概况

视觉传感器是整个机器视觉系统信息的直接来源,主要由一个或者两个图形传感器组成,有时还要配以光投射器及其他辅助设备。视觉传感器的主要功能是获取足够的机器视觉系统要处理的最原始图像。

视觉传感是应用在生产装置上的一种电子图像技术,通过视觉传感器把图像抓到,然后将图像传送至处理单元,通过数字化处理,根据像素分布和亮度、颜色等信息,来进行尺寸、形状和颜色的判别,并根据判别结果进而控制生产设备的工作。 视觉传感器的工作过程可以分为四个步骤:图像的检测、图像的分析、图像的绘制和图像识别。视觉传感器具有从一幅图像中捕获数以千计像素的能力。 视觉信息一般通过光电检测转换为电信号,通过图像信息的变化可以对物体的形状位置等特征信息进行判定。

在SLAM领域,视觉传感器也被广泛应用,衍生出了ORB-SLAM、Vins-Mono等视觉SLAM,用于四足机器人、无人机等的导航与规划等。

file

二、安装驱动

本机的参数如下:

项目 版本
系统 Ubuntu18.04
ROS Medolic

执行如下命令安装驱动:

sudo apt-get install ros-melodic-usb-cam

如果为其他版本,将版本名称替换即可,比如sudo apt-get install ros-melodic-usb-cam

检查usb端口连接信息命令如下:

lsusb

lsusb -t

三、开启本地相机并显示

执行如下命令打开本地自带相机:

roslaunch usb_cam usb_cam-test.launch

也可以下载uvc驱动包:roslaunch usb_cam uvc_cam-test.launch
执行过程的信息如下:

ganahe@ganahe-Nitro-AN515-51:~$ roslaunch usb_cam usb_cam-test.launch
... logging to /home/ganahe/.ros/log/29a04252-8651-11eb-98ad-f82819b4f653/roslaunch-ganahe-Nitro-AN515-51-8994.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ganahe-Nitro-AN515-51:44467/

SUMMARY
========

PARAMETERS
 * /image_view/autosize: True
 * /rosdistro: melodic
 * /rosversion: 1.14.10
 * /usb_cam/camera_frame_id: usb_cam
 * /usb_cam/image_height: 480
 * /usb_cam/image_width: 640
 * /usb_cam/io_method: mmap
 * /usb_cam/pixel_format: yuyv
 * /usb_cam/video_device: /dev/video0

NODES
  /
    image_view (image_view/image_view)
    usb_cam (usb_cam/usb_cam_node)

auto-starting new master
process[master]: started with pid [9007]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 29a04252-8651-11eb-98ad-f82819b4f653
process[rosout-1]: started with pid [9018]
started core service [/rosout]
process[usb_cam-2]: started with pid [9021]
ERROR: cannot launch node of type [image_view/image_view]: image_view
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/home/ganahe/catkin_ws/src
ROS path [2]=/opt/ros/melodic/share
ROS path [3]=/home/ganahe/PX4_Firmware
ROS path [4]=/home/ganahe/PX4_Firmware/Tools/sitl_gazebo
[ INFO] [1615896877.578934705]: using default calibration URL
[ INFO] [1615896877.581331953]: camera calibration URL: file:///home/ganahe/.ros/camera_info/head_camera.yaml
[ INFO] [1615896877.581504365]: Unable to open camera calibration file [/home/ganahe/.ros/camera_info/head_camera.yaml]
[ WARN] [1615896877.581570650]: Camera calibration file /home/ganahe/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1615896877.581638602]: Starting 'head_camera' (/dev/video0) at 640x480 via mmap (yuyv) at 30 FPS
[ WARN] [1615896877.806605562]: unknown control 'focus_auto'

打开rqt工具包:

rqt

选择Plugins - visualization - Image View,在出现的界面中的左上角选择对应的已发布话题,即可看到相机打开后的效果:

file

四、深度相机 - Intel系列

4.1 安装驱动SDK

(1)添加Keys

apt-key adv --keyserver keys.gnupg.net --recv-key C8B3A55A6F3EFCDE || apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C8B3A55A6F3EFCDE

(2)添加Repositories

  • Ubuntu 16.04:
add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main" -u
  • Ubuntu 18.04:
add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main" -u

(3)安装Libraries

apt-get install librealsense2-dkms
apt-get install librealsense2-utils

(4)安装Dev和Debug工具

apt-get install librealsense2-dev
apt-get install librealsense2-dbg

(3)(4)步骤也可以一步完成:

sudo apt-get update
sudo apt-get install librealsense2-dkms librealsense2-utils librealsense2-dev librealsense2-dbg

以上驱动安装完成后,可以连接传感器,执行realsense-viewer查看相机成像效果、坐标系等情况。

4.2 安装ROS功能包

cd ~/catkin_ws/src

sudo apt-get install ros-melodic-ddynamic-reconfigure # Ubuntu其他版本自行替换掉melodic
git clone https://github.com/IntelRealSense/realsense-ros.git

cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`

cd ..
catkin_make
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

4.3 Intel realsense 相机ROS话题发布

连接相机后,首先打开一个terminal,执行roscore,再打开新的terminal:

cd ~/catkin_ws
roslaunch realsense2_camera rs_camera.launch

执行以上命令后,通过rostopic list查看话题列表,随后通过rviz等订阅相应话题查看。

file

realsense-ros 预定义的launch如下:

ganahe@ganahe-Nitro-AN515-51:~/catkin_ws/src/realsense-ros/realsense2_camera/launchpwd
/home/ganahe/catkin_ws/src/realsense-ros/realsense2_camera/launch
ganahe@ganahe-Nitro-AN515-51:~/catkin_ws/src/realsense-ros/realsense2_camera/launch tree
.
├── demo_pointcloud.launch
├── demo_t265.launch
├── includes
│   └── nodelet.launch.xml
├── opensource_tracking.launch
├── rs_aligned_depth.launch
├── rs_camera.launch
├── rs_d400_and_t265.launch
├── rs_d435_camera_with_model.launch
├── rs_from_file.launch
├── rs_multiple_devices.launch
├── rs_rgbd.launch
├── rs_rtabmap.launch
└── rs_t265.launch

(1)Intel realsense T265C 双目相机

T265 包含两个鱼眼镜头传感器、一个 IMU 和一个英特尔® Movidius™ Myriad™ 2 VPU。所有的 V‑SLAM 算法都直接在 VPU 上运行,能够实现非常低的延迟和非常高效的功耗。
T265 经过广泛的性能测试和验证,在预期使用条件下,闭环偏移小于 1%。姿态动作与动作反射之间的延迟不到 6 毫秒。——Intel

file

相机的参数信息可以通过如下方式读取:

rs-enumerate-devices # 相机机内参和外参
rs-enumerate-devices -c # 相机机内参和外参 ,以及IMU的参数

如果需要通过OpenCV驱动获取数据:

#include <librealsense2/rs.hpp>
#include <opencv2/opencv.hpp>

int main(){

    rs2::config cfg;
    cfg.enable_stream(RS2_STREAM_FISHEYE,1, RS2_FORMAT_Y8);
    cfg.enable_stream(RS2_STREAM_FISHEYE,2, RS2_FORMAT_Y8);
    rs2::pipeline pipe;
    pipe.start(cfg);

    rs2::frameset data;

    while (1){
        data = pipe.wait_for_frames();
        rs2::frame image_left = data.get_fisheye_frame(1);
        rs2::frame image_right = data.get_fisheye_frame(2);

        if (!image_left || !image_right)
            break;

        cv::Mat cv_image_left(cv::Size(848, 800), CV_8U, (void*)image_left.get_data(), cv::Mat::AUTO_STEP);
        cv::Mat cv_image_right(cv::Size(848, 800), CV_8U, (void*)image_right.get_data(), cv::Mat::AUTO_STEP);

        cv::imshow("left", cv_image_left);
        cv::imshow("right", cv_image_right);
        cv::waitKey(1);
    }

    return 0;
}

修改CmakeLists.txt:

cmake_minimum_required(VERSION 3.1.0)
project(ganhe)
set(CMAKE_BUILD_TYPE "release")

find_package(OpenCV)

include_directories({OpenCV_INCLUDE_DIRS})

add_executable(ganhe real.cpp)
target_link_libraries(ganhe
        realsense2{OpenCV_LIBS}
)

通过Cmake编译后打开生成的可执行文件即可。

file

dji@manifold2:~/catkin_ws/src/experiment_fast_planner$ rs-enumerate-devices -c
Device info: 
    Name                          :     Intel RealSense T265
    Serial Number                 :     947122110624
    Firmware Version              :     0.2.0.951
    Physical Port                 :     2-3-13
    Product Id                    :     0B37
    Usb Type Descriptor           :     3.1
    Product Line                  :     T200

Stream Profiles supported by Tracking Module
 Supported modes:
    stream       resolution      fps       format   
    Fisheye 1     848x800   @ 30Hz     Y8
    Fisheye 2     848x800   @ 30Hz     Y8
    Gyro     N/A        @ 200Hz    MOTION_XYZ32F
    Accel    N/A        @ 62Hz     MOTION_XYZ32F
    Pose     N/A        @ 200Hz    6DOF

Intrinsic Parameters:

 Intrinsic of "Fisheye 1" / 848x800 / {Y8}
  Width:        848
  Height:       800
  PPX:          422.355010986328
  PPY:          401.183197021484
  Fx:           286.419189453125
  Fy:           286.384307861328
  Distortion:   Kannala Brandt4
  Coeffs:       -0.00842355936765671    0.0438300296664238      -0.0417080596089363     0.00763566605746746     0  
  FOV (deg):    111.9 x 108.8

 Intrinsic of "Fisheye 2" / 848x800 / {Y8}
  Width:        848
  Height:       800
  PPX:          425.490112304688
  PPY:          400.023406982422
  Fx:           285.90771484375
  Fy:           285.838012695312
  Distortion:   Kannala Brandt4
  Coeffs:       -0.00901120528578758    0.0463116206228733      -0.0436602495610714     0.00809726025909185     0  
  FOV (deg):    112 x 108.9

Motion Intrinsic Parameters:

Motion Intrinsic of "Gyro"      MOTION_XYZ32F
Bias Variances:     0.000000499999999  0.000000499999999  0.000000499999999  
Noise Variances:    0.000005148030141  0.000005148030141  0.000005148030141  
Sensitivity : 
     0.998604       0.000000       0.000000      -0.001043  
     0.000000       1.003421       0.000000      -0.007766  
     0.000000       0.000000       0.999840      -0.000505  

Motion Intrinsic of "Accel"     MOTION_XYZ32F
Bias Variances:     0.000099999997474  0.000099999997474  0.000099999997474  
Noise Variances:    0.000066952452471  0.000066952452471  0.000066952452471  
Sensitivity : 
     1.002646       0.000000       0.000000      -0.119967  
     0.000000       1.027077       0.000000       0.065438  
     0.000000       0.000000       1.020518       0.021381  

Extrinsic Parameters:
Extrinsic from "Fisheye 1"      To      "Fisheye 1" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Fisheye 1"      To      "Fisheye 2" :
 Rotation Matrix:
   0.999977        -0.000860069     -0.0067087     
   0.000889296      0.99999          0.00435477    
   0.00670489      -0.00436064       0.999968      

 Translation Vector: -0.064382404088974  -0.000208481418667361  -0.000129977037431672  

Extrinsic from "Fisheye 1"      To      "Gyro" :
 Rotation Matrix:
  -0.99996         -0.00301489       0.0084079     
   0.0030054       -0.999995        -0.00114063    
   0.0084113       -0.00111532       0.999964      

 Translation Vector: 0.0106995701789856  -3.21578190778382e-05  -9.0000918135047e-05  

Extrinsic from "Fisheye 1"      To      "Accel" :
 Rotation Matrix:
  -0.99996         -0.00301489       0.0084079     
   0.0030054       -0.999995        -0.00114063    
   0.0084113       -0.00111532       0.999964      

 Translation Vector: 0.0106995701789856  -3.21578190778382e-05  -9.0000918135047e-05  

Extrinsic from "Fisheye 1"      To      "Pose" :
 Rotation Matrix:
   0.99996          0.00301489      -0.0084079     
   0.0030054       -0.999995        -0.00114063    
  -0.0084113        0.00111532      -0.999964      

 Translation Vector: -0.0321912094950676  -2.06494059966644e-05  0.000120167809654959  

Extrinsic from "Fisheye 2"      To      "Fisheye 1" :
 Rotation Matrix:
   0.999977         0.000889296      0.00670489    
  -0.000860069      0.99999         -0.00436064    
  -0.0067087        0.00435477       0.999968      

 Translation Vector: 0.0643819943070412  0.000152539272676222  -0.000301041349302977  

Extrinsic from "Fisheye 2"      To      "Fisheye 2" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Fisheye 2"      To      "Gyro" :
 Rotation Matrix:
  -0.999991        -0.00386751       0.00171616    
   0.00387305      -0.999987         0.00324017    
   0.00170361       0.00324679       0.999993      

 Translation Vector: -0.0536828488111496  9.14099109650124e-06  0.00015033470117487  

Extrinsic from "Fisheye 2"      To      "Accel" :
 Rotation Matrix:
  -0.999991        -0.00386751       0.00171616    
   0.00387305      -0.999987         0.00324017    
   0.00170361       0.00324679       0.999993      

 Translation Vector: -0.0536828488111496  9.14099109650124e-06  0.00015033470117487  

Extrinsic from "Fisheye 2"      To      "Pose" :
 Rotation Matrix:
   0.999991         0.00386751      -0.00171616    
   0.00387305      -0.999987         0.00324017    
  -0.00170361      -0.00324679      -0.999993      

 Translation Vector: 0.0321912094950676  2.0649404177675e-05  -0.000120167809654959  

Extrinsic from "Gyro"   To      "Fisheye 1" :
 Rotation Matrix:
  -0.99996          0.0030054        0.0084113     
  -0.00301489      -0.999995        -0.00111532    
   0.0084079       -0.00114063       0.999964      

 Translation Vector: 0.0106999967247248  0  4.36557456851006e-11  

Extrinsic from "Gyro"   To      "Fisheye 2" :
 Rotation Matrix:
  -0.999991         0.00387305       0.00170361    
  -0.00386751      -0.999987         0.00324679    
   0.00171616       0.00324017       0.999993      

 Translation Vector: -0.0536826550960541  -0.000198965979507193  -5.82347420277074e-05  

Extrinsic from "Gyro"   To      "Gyro" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Gyro"   To      "Accel" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: -0  -0  -0  

Extrinsic from "Gyro"   To      "Pose" :
 Rotation Matrix:
  -1  -0  -0
   0   1   0
  -0  -0  -1

 Translation Vector: -0.021491639316082  1.15084130811738e-05  3.01668951578904e-05  

Extrinsic from "Accel"      To      "Fisheye 1" :
 Rotation Matrix:
  -0.99996          0.0030054        0.0084113     
  -0.00301489      -0.999995        -0.00111532    
   0.0084079       -0.00114063       0.999964      

 Translation Vector: 0.0106999967247248  0  4.36557456851006e-11  

Extrinsic from "Accel"      To      "Fisheye 2" :
 Rotation Matrix:
  -0.999991         0.00387305       0.00170361    
  -0.00386751      -0.999987         0.00324679    
   0.00171616       0.00324017       0.999993      

 Translation Vector: -0.0536826550960541  -0.000198965979507193  -5.82347420277074e-05  

Extrinsic from "Accel"      To      "Gyro" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Accel"      To      "Accel" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Accel"      To      "Pose" :
 Rotation Matrix:
  -1  -0  -0
   0   1   0
  -0  -0  -1

 Translation Vector: -0.021491639316082  1.15084130811738e-05  3.01668951578904e-05  

Extrinsic from "Pose"   To      "Fisheye 1" :
 Rotation Matrix:
   0.99996          0.0030054       -0.0084113     
   0.00301489      -0.999995         0.00111532    
  -0.0084079       -0.00114063      -0.999964      

 Translation Vector: 0.0321909971535206  7.6269636338111e-05  -0.000150520674651489  

Extrinsic from "Pose"   To      "Fisheye 2" :
 Rotation Matrix:
   0.999991         0.00387305      -0.00170361    
   0.00386751      -0.999987        -0.00324679    
  -0.00171616       0.00324017      -0.999993      

 Translation Vector: -0.032191202044487  -0.000104240716609638  -6.49885187158361e-05  

Extrinsic from "Pose"   To      "Gyro" :
 Rotation Matrix:
  -1   0  -0
  -0   1  -0
  -0   0  -1

 Translation Vector: -0.021491639316082  -1.15084130811738e-05  3.01668951578904e-05  

Extrinsic from "Pose"   To      "Accel" :
 Rotation Matrix:
  -1   0  -0
  -0   1  -0
  -0   0  -1

 Translation Vector: -0.021491639316082  -1.15084130811738e-05  3.01668951578904e-05  

Extrinsic from "Pose"   To      "Pose" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0 

(2) Intel realsense D435i RGB-D 相机

Intel RealSense D435i是英特尔公司推出的一款消费级深度相机,构成单元有RGB相机(1)、红外相机(2)以及红外发射器(1),相比于D435,D435i还有一个IMU单元。

其深度成像原理是主动立体红外成像,不是传统意义上理解的双目RGB相机成像。

file

通过ROS功能包的launch文件配置,可以启用D435i不同的镜头,比如可做一个RGB-D传感器相机,可以搭配ORB-SLAM中RGB-D的模式进行使用;也可以只用单目RGB影像,以单目SLAM模式运行,或者单目结合IMU,以Mono-Initial模式运行;可以获取双目的红外影像,以此作为输入,进行双目SLAM。

D435i是一个比较“全能”的传感器,可以进行单目、单目+IMU、双目、双目+IMU、RGB-D的相关应用。但由于两个红外相机是单通道的,不能运行的是双目RGB模式。

Intrinsic Parameters:

 Intrinsic of "Depth" / 256x144 / {Z16}
  Width:        256
  Height:       144
  PPX:          125.079650878906
  PPY:          70.8781127929688
  Fx:           639.974304199219
  Fy:           639.974304199219
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    22.62 x 12.84

 Intrinsic of "Depth" / 424x240 / {Z16}
  Width:        424
  Height:       240
  PPX:          211.032638549805
  PPY:          119.628372192383
  Fx:           211.991485595703
  Fy:           211.991485595703
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 59.02

 Intrinsic of "Depth" / 480x270 / {Z16}
  Width:        480
  Height:       270
  PPX:          238.904876708984
  PPY:          134.579284667969
  Fx:           239.990356445312
  Fy:           239.990356445312
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 58.72

 Intrinsic of "Depth" / 640x360 / {Z16}
  Width:        640
  Height:       360
  PPX:          318.539825439453
  PPY:          179.439056396484
  Fx:           319.987152099609
  Fy:           319.987152099609
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 58.72

 Intrinsic of "Depth" / 640x480 / {Z16}
  Width:        640
  Height:       480
  PPX:          318.247802734375
  PPY:          239.326873779297
  Fx:           383.984588623047
  Fy:           383.984588623047
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    79.61 x 64.01

 Intrinsic of "Depth" / 848x100 / {Z16}
  Width:        848
  Height:       100
  PPX:          422.065277099609
  PPY:          49.2567443847656
  Fx:           423.982971191406
  Fy:           423.982971191406
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 13.45

 Intrinsic of "Depth" / 848x480 / {Z16}
  Width:        848
  Height:       480
  PPX:          422.065277099609
  PPY:          239.256744384766
  Fx:           423.982971191406
  Fy:           423.982971191406
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 59.02

 Intrinsic of "Depth" / 1280x720 / {Z16}
  Width:        1280
  Height:       720
  PPX:          637.079650878906
  PPY:          358.878112792969
  Fx:           639.974304199219
  Fy:           639.974304199219
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 58.72

 Intrinsic of "Color" / 320x180 / {YUYV/RGB8/BGR8/RGBA8/BGRA8/Y16}
  Width:        320
  Height:       180
  PPX:          168.642852783203
  PPY:          87.4565658569336
  Fx:           231.624588012695
  Fy:           231.835433959961
  Distortion:   Inverse Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    69.21 x 42.43

 Intrinsic of "Color" / 320x240 / {YUYV/RGB8/BGR8/RGBA8/BGRA8/Y16}
  Width:        320
  Height:       240
  PPX:          171.523803710938
  PPY:          116.608749389648
  Fx:           308.832763671875
  Fy:           309.113891601562
  Distortion:   Inverse Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    54.72 x 42.43

 Intrinsic of "Color" / 424x240 / {YUYV/RGB8/BGR8/RGBA8/BGRA8/Y16}
  Width:        424
  Height:       240
  PPX:          223.523803710938
  PPY:          116.608749389648
  Fx:           308.832763671875
  Fy:           309.113891601562
  Distortion:   Inverse Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    68.88 x 42.43

 Intrinsic of "Color" / 640x360 / {YUYV/RGB8/BGR8/RGBA8/BGRA8/Y16}
  Width:        640
  Height:       360
  PPX:          337.285705566406
  PPY:          174.913131713867
  Fx:           463.249176025391
  Fy:           463.670867919922
  Distortion:   Inverse Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    69.22 x 42.43

 Intrinsic of "Color" / 640x480 / {YUYV/RGB8/BGR8/RGBA8/BGRA8/Y16}
  Width:        640
  Height:       480
  PPX:          343.047607421875
  PPY:          233.217498779297
  Fx:           617.66552734375
  Fy:           618.227783203125
  Distortion:   Inverse Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    54.72 x 42.43

 Intrinsic of "Color" / 848x480 / {YUYV/RGB8/BGR8/RGBA8/BGRA8/Y16}
  Width:        848
  Height:       480
  PPX:          447.047607421875
  PPY:          233.217498779297
  Fx:           617.66552734375
  Fy:           618.227783203125
  Distortion:   Inverse Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    68.88 x 42.43

 Intrinsic of "Color" / 960x540 / {YUYV/RGB8/BGR8/RGBA8/BGRA8/Y16}
  Width:        960
  Height:       540
  PPX:          505.928527832031
  PPY:          262.369689941406
  Fx:           694.873779296875
  Fy:           695.506286621094
  Distortion:   Inverse Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    69.22 x 42.43

 Intrinsic of "Color" / 1280x720 / {YUYV/RGB8/BGR8/RGBA8/BGRA8/Y16}
  Width:        1280
  Height:       720
  PPX:          674.571411132812
  PPY:          349.826263427734
  Fx:           926.498352050781
  Fy:           927.341735839844
  Distortion:   Inverse Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    69.22 x 42.43

 Intrinsic of "Color" / 1920x1080 / {YUYV/RGB8/BGR8/RGBA8/BGRA8/Y16/RAW16}
  Width:        1920
  Height:       1080
  PPX:          1011.85705566406
  PPY:          524.739379882812
  Fx:           1389.74755859375
  Fy:           1391.01257324219
  Distortion:   Inverse Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    69.22 x 42.43

 Intrinsic of "Infrared 1" / 256x144 / {Y8}
  Width:        256
  Height:       144
  PPX:          125.079650878906
  PPY:          70.8781127929688
  Fx:           639.974304199219
  Fy:           639.974304199219
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    22.62 x 12.84

 Intrinsic of "Infrared 1" / 424x240 / {Y8}
  Width:        424
  Height:       240
  PPX:          211.032638549805
  PPY:          119.628372192383
  Fx:           211.991485595703
  Fy:           211.991485595703
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 59.02

 Intrinsic of "Infrared 1" / 480x270 / {Y8}
  Width:        480
  Height:       270
  PPX:          238.904876708984
  PPY:          134.579284667969
  Fx:           239.990356445312
  Fy:           239.990356445312
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 58.72

 Intrinsic of "Infrared 1" / 640x360 / {Y8}
  Width:        640
  Height:       360
  PPX:          318.539825439453
  PPY:          179.439056396484
  Fx:           319.987152099609
  Fy:           319.987152099609
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 58.72

 Intrinsic of "Infrared 1" / 640x480 / {Y8}
  Width:        640
  Height:       480
  PPX:          318.247802734375
  PPY:          239.326873779297
  Fx:           383.984588623047
  Fy:           383.984588623047
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    79.61 x 64.01

 Intrinsic of "Infrared 1" / 848x100 / {Y8}
  Width:        848
  Height:       100
  PPX:          422.065277099609
  PPY:          49.2567443847656
  Fx:           423.982971191406
  Fy:           423.982971191406
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 13.45

 Intrinsic of "Infrared 1" / 848x480 / {Y8}
  Width:        848
  Height:       480
  PPX:          422.065277099609
  PPY:          239.256744384766
  Fx:           423.982971191406
  Fy:           423.982971191406
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 59.02

 Intrinsic of "Infrared 1" / 1280x720 / {Y8}
  Width:        1280
  Height:       720
  PPX:          637.079650878906
  PPY:          358.878112792969
  Fx:           639.974304199219
  Fy:           639.974304199219
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 58.72

 Intrinsic of "Infrared 1" / 1280x800 / {Y8}
  Width:        1280
  Height:       800
  PPX:          637.079650878906
  PPY:          398.878112792969
  Fx:           639.974304199219
  Fy:           639.974304199219
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 64.01

 Intrinsic of "Infrared 2" / 256x144 / {Y8}
  Width:        256
  Height:       144
  PPX:          125.079650878906
  PPY:          70.8781127929688
  Fx:           639.974304199219
  Fy:           639.974304199219
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    22.62 x 12.84

 Intrinsic of "Infrared 2" / 424x240 / {Y8}
  Width:        424
  Height:       240
  PPX:          211.032638549805
  PPY:          119.628372192383
  Fx:           211.991485595703
  Fy:           211.991485595703
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 59.02

 Intrinsic of "Infrared 2" / 480x270 / {Y8}
  Width:        480
  Height:       270
  PPX:          238.904876708984
  PPY:          134.579284667969
  Fx:           239.990356445312
  Fy:           239.990356445312
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 58.72

 Intrinsic of "Infrared 2" / 640x360 / {Y8}
  Width:        640
  Height:       360
  PPX:          318.539825439453
  PPY:          179.439056396484
  Fx:           319.987152099609
  Fy:           319.987152099609
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 58.72

 Intrinsic of "Infrared 2" / 640x480 / {Y8}
  Width:        640
  Height:       480
  PPX:          318.247802734375
  PPY:          239.326873779297
  Fx:           383.984588623047
  Fy:           383.984588623047
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    79.61 x 64.01

 Intrinsic of "Infrared 2" / 848x100 / {Y8}
  Width:        848
  Height:       100
  PPX:          422.065277099609
  PPY:          49.2567443847656
  Fx:           423.982971191406
  Fy:           423.982971191406
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 13.45

 Intrinsic of "Infrared 2" / 848x480 / {Y8}
  Width:        848
  Height:       480
  PPX:          422.065277099609
  PPY:          239.256744384766
  Fx:           423.982971191406
  Fy:           423.982971191406
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 59.02

 Intrinsic of "Infrared 2" / 1280x720 / {Y8}
  Width:        1280
  Height:       720
  PPX:          637.079650878906
  PPY:          358.878112792969
  Fx:           639.974304199219
  Fy:           639.974304199219
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 58.72

 Intrinsic of "Infrared 2" / 1280x800 / {Y8}
  Width:        1280
  Height:       800
  PPX:          637.079650878906
  PPY:          398.878112792969
  Fx:           639.974304199219
  Fy:           639.974304199219
  Distortion:   Brown Conrady
  Coeffs:       0   0   0   0   0  
  FOV (deg):    90 x 64.01

Motion Intrinsic Parameters:

Motion Intrinsic of "Gyro"      MOTION_XYZ32F
Bias Variances:     0.000000000000000  0.000000000000000  0.000000000000000  
Noise Variances:    0.000000000000000  0.000000000000000  0.000000000000000  
Sensitivity : 
     1.000000       0.000000       0.000000       0.000000  
     0.000000       1.000000       0.000000       0.000000  
     0.000000       0.000000       1.000000       0.000000  

Motion Intrinsic of "Accel"     MOTION_XYZ32F
Bias Variances:     0.000000000000000  0.000000000000000  0.000000000000000  
Noise Variances:    0.000000000000000  0.000000000000000  0.000000000000000  
Sensitivity : 
     1.000000       0.000000       0.000000       0.000000  
     0.000000       1.000000       0.000000       0.000000  
     0.000000       0.000000       1.000000       0.000000  

Extrinsic Parameters:
Extrinsic from "Depth"      To      "Depth" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Depth"      To      "Color" :
 Rotation Matrix:
   0.99996         -0.00875044      -0.00162848    
   0.00875017       0.999962        -0.000173136   
   0.00162993       0.000158879      0.999999      

 Translation Vector: 0.0149527732282877  0.000543894828297198  0.000474434433272108  

Extrinsic from "Depth"      To      "Infrared 1" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Depth"      To      "Infrared 2" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Depth"      To      "Gyro" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: -0.00552000012248755  0.00510000018402934  0.011739999987185  

Extrinsic from "Depth"      To      "Accel" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: -0.00552000012248755  0.00510000018402934  0.011739999987185  

Extrinsic from "Color"      To      "Depth" :
 Rotation Matrix:
   0.99996          0.00875017       0.00162993    
  -0.00875044       0.999962         0.000158879   
  -0.00162848      -0.000173136      0.999999      

 Translation Vector: -0.014957713894546  -0.000413105968618765  -0.000449989282060415  

Extrinsic from "Color"      To      "Color" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Color"      To      "Infrared 1" :
 Rotation Matrix:
   0.99996          0.00875017       0.00162993    
  -0.00875044       0.999962         0.000158879   
  -0.00162848      -0.000173136      0.999999      

 Translation Vector: -0.014957713894546  -0.000413105968618765  -0.000449989282060415  

Extrinsic from "Color"      To      "Infrared 2" :
 Rotation Matrix:
   0.99996          0.00875017       0.00162993    
  -0.00875044       0.999962         0.000158879   
  -0.00162848      -0.000173136      0.999999      

 Translation Vector: -0.014957713894546  -0.000413105968618765  -0.000449989282060415  

Extrinsic from "Color"      To      "Gyro" :
 Rotation Matrix:
   0.99996          0.00875017       0.00162993    
  -0.00875044       0.999962         0.000158879   
  -0.00162848      -0.000173136      0.999999      

 Translation Vector: -0.0204777140170336  0.00468689436092973  0.0112900109961629  

Extrinsic from "Color"      To      "Accel" :
 Rotation Matrix:
   0.99996          0.00875017       0.00162993    
  -0.00875044       0.999962         0.000158879   
  -0.00162848      -0.000173136      0.999999      

 Translation Vector: -0.0204777140170336  0.00468689436092973  0.0112900109961629  

Extrinsic from "Infrared 1"     To      "Depth" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Infrared 1"     To      "Color" :
 Rotation Matrix:
   0.99996         -0.00875044      -0.00162848    
   0.00875017       0.999962        -0.000173136   
   0.00162993       0.000158879      0.999999      

 Translation Vector: 0.0149527732282877  0.000543894828297198  0.000474434433272108  

Extrinsic from "Infrared 1"     To      "Infrared 1" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Infrared 1"     To      "Infrared 2" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: -0.0500373877584934  0  0  

Extrinsic from "Infrared 1"     To      "Gyro" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: -0.00552000012248755  0.00510000018402934  0.011739999987185  

Extrinsic from "Infrared 1"     To      "Accel" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: -0.00552000012248755  0.00510000018402934  0.011739999987185  

Extrinsic from "Infrared 2"     To      "Depth" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0.0500373877584934  0  0  

Extrinsic from "Infrared 2"     To      "Color" :
 Rotation Matrix:
   0.99996         -0.00875044      -0.00162848    
   0.00875017       0.999962        -0.000173136   
   0.00162993       0.000158879      0.999999      

 Translation Vector: 0.0649881809949875  0.000981730525381863  0.000555992126464844  

Extrinsic from "Infrared 2"     To      "Infrared 1" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0.0500373877584934  0  0  

Extrinsic from "Infrared 2"     To      "Infrared 2" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Infrared 2"     To      "Gyro" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0.0445173867046833  0.00510000018402934  0.011739999987185  

Extrinsic from "Infrared 2"     To      "Accel" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0.0445173867046833  0.00510000018402934  0.011739999987185  

Extrinsic from "Gyro"   To      "Depth" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0.00552000012248755  -0.00510000018402934  -0.011739999987185  

Extrinsic from "Gyro"   To      "Color" :
 Rotation Matrix:
   0.99996         -0.00875044      -0.00162848    
   0.00875017       0.999962        -0.000173136   
   0.00162993       0.000158879      0.999999      

 Translation Vector: 0.0205362997949123  -0.0045055765658617  -0.0112573625519872  

Extrinsic from "Gyro"   To      "Infrared 1" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0.00552000012248755  -0.00510000018402934  -0.011739999987185  

Extrinsic from "Gyro"   To      "Infrared 2" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0.00552000012248755  -0.00510000018402934  -0.011739999987185  

Extrinsic from "Gyro"   To      "Gyro" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Gyro"   To      "Accel" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Accel"      To      "Depth" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0.00552000012248755  -0.00510000018402934  -0.011739999987185  

Extrinsic from "Accel"      To      "Color" :
 Rotation Matrix:
   0.99996         -0.00875044      -0.00162848    
   0.00875017       0.999962        -0.000173136   
   0.00162993       0.000158879      0.999999      

 Translation Vector: 0.0205362997949123  -0.0045055765658617  -0.0112573625519872  

Extrinsic from "Accel"      To      "Infrared 1" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0.00552000012248755  -0.00510000018402934  -0.011739999987185  

Extrinsic from "Accel"      To      "Infrared 2" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0.00552000012248755  -0.00510000018402934  -0.011739999987185  

Extrinsic from "Accel"      To      "Gyro" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

Extrinsic from "Accel"      To      "Accel" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1

 Translation Vector: 0  0  0  

五、源代码安装 Realsense SDK

通过如上方法无法时

ganahe@ganahe-Nitro-AN515-51:~$ apt-key adv --keyserver keys.gnupg.net --recv-key C8B3A55A6F3EFCDE || apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C8B3A55A6F3EFCDE
Executing: /tmp/apt-key-gpghome.VDtWItvLze/gpg.1.sh --keyserver keys.gnupg.net --recv-key C8B3A55A6F3EFCDE
gpg: keyserver receive failed: No name
Executing: /tmp/apt-key-gpghome.iikOQE6Ij3/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C8B3A55A6F3EFCDE
gpg: key C8B3A55A6F3EFCDE: ""CN = Intel(R) Intel(R) Realsense", O=Intel Corporation" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

源码编译安装
下面的操作是适用于Ubuntu 16.04其它版本见官网。
先更新系统软件

sudo apt update && sudo apt upgrade

然后安装一些推荐的包,这步如果出错可以不管

sudo apt install --install-recommends linux-generic-lts-xenial xserver-xorg-core-lts-xenial xserver-xorg-lts-xenial xserver-xorg-video-all-lts-xenial xserver-xorg-input-all-lts-xenial libwayland-egl1-mesa-lts-xenial

更新完成过后准备重启

sudo update-grub && sudo reboot

查看内核是否符合要求内核要求说明

uname -r

下载SDK

git clone https://github.com/IntelRealSense/librealsense.git

下载完成过后安装依赖

cd librealsense
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev libglfw3-dev

添加udev规则

sudo ./scripts/setup_udev_rules.sh

安装系统内核补丁

sudo ./scripts/patch-realsense-ubuntu-lts.sh

驱动设置开机启动

echo 'hid_sensor_custom' | sudo tee -a /etc/modules

创建编译文件夹

mkdir build && cd build

cmake准备编译,同时编译t265和其它一些可能会用的工具

cmake ../ -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true -DBUILD_WITH_TM2=true 

然后make安装完成

sudo make uninstall && make clean && make && sudo make install

如果没报错就ok了,运行realsense-viewer测试一下能不能打开相机

六、 参考文献

[1]Intel Realsense T265使用教程
[2]Intel RealSense D435i:简介、安装与使用(ROS、Python)