• ubuntu1804配置OAK-D相机的ROS以及depthai_ros环境


    自己的环境:
    ubuntu18.04、ros-melodic

    1下载depthai安装包

    这里下载的目前最新的版本:depthai_2.19.1_amd64.deb
    下载地址:地址

    2安装

    参考这个链接:https://docs.oakchina.cn/en/latest/pages/Advanced/ros_test_depthai_cpp_library.html#ros1-noetic-depthai-ros

    2.1更新 usb 规则

    echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
    sudo udevadm control --reload-rules && sudo udevadm trigger
    
    • 1
    • 2

    2.2配置安装包,这里没有用官方给的安装命令,直接dpkg -i

    sudo dpkg -i depthai_2.19.1_amd64.deb
    
    • 1

    2.3安装opencv,已经安装好了,4.5版本

    2.4安装rviz-imu-plugin,ros版本改成自己的

    sudo apt install ros-melodic-rviz-imu-plugin -y
    
    • 1

    2.5设置程序,ros版本改成自己的

    mkdir -p dai_ws/src
    cd dai_ws/src
    git clone https://gitee.com/oakchina/depthai-ros.git
    cd ..
    source /opt/ros/melodic/setup.bash
    rosdep install --from-paths src --ignore-src -r -y
    catkin_make
    source devel/setup.bash
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    2.6 执行示例运行双目相机对应的launch文件

    cd dai_ws
    source devel/setup.bash
    roslaunch depthai_examples stereo_node.launch
    
    • 1
    • 2
    • 3

    2.7 查看相机内参和外参

    1. 在启动相机驱动后使用命令行查看
    rostopic echo -n 1 /stereo_publisher/left/camera_info
    rostopic echo -n 1 /stereo_publisher/right/camera_info
    
    • 1
    • 2

    -n 1指消息只打印1次
    参数如下
    D:相机的畸变系数,在SLAM中一般用到前5位[k1,k2,p1,p2,k3]
    K:相机内参矩阵
    R:相机旋转矩阵
    P:相机投影矩阵,矩阵中第4个数字59.60097983474698对应ORB-SLAM3配置文件中的bf参数

    header: 
      seq: 0
      stamp: 
        secs: 1668563459
        nsecs: 222877835
      frame_id: "oak_left_camera_optical_frame"
    height: 720
    width: 1280
    distortion_model: "rational_polynomial"
    D: [6.860053539276123, 8.262731552124023, -0.0022835570853203535, -0.0021555486600846052, -33.7902717590332, 6.535381317138672, 9.392735481262207, -34.76184844970703]
    K: [800.8717041015625, 0.0, 630.91015625, 0.0, 800.8717041015625, 313.4556884765625, 0.0, 0.0, 1.0]
    R: [0.9999741911888123, 8.463647827738896e-05, 0.00718728918582201, -7.144125265767798e-05, 0.9999983310699463, -0.0018361477414146066, -0.007187432609498501, 0.0018355868523940444, 0.9999724626541138]
    P: [799.4793090820312, 0.0, 629.921875, 59.60097983474698, 0.0, 799.4793090820312, 289.2037658691406, 0.0, 0.0, 0.0, 1.0, 0.0]
    binning_x: 0
    binning_y: 0
    roi: 
      x_offset: 0
      y_offset: 0
      height: 0
      width: 0
      do_rectify: False
    ---
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    1. 参考链接使用另一种方法获得
    python3 -m pip install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/ depthai
    git clone https://github.com/luxonis/depthai-python
    # 运行该命令的时候把双目的节点关掉,不然会有冲突
    python3 depthai-python/examples/calibration/calibration_reader.py
    
    • 1
    • 2
    • 3
    • 4

    附一下自己获得的参数,畸变参数大的让我有点震惊,,,

    RGB Camera Default intrinsics...
    [[3101.96142578125, 0.0, 1907.9949951171875], [0.0, 3101.96142578125, 1062.4305419921875], [0.0, 0.0, 1.0]]
    3840
    2160
    RGB Camera Default intrinsics...
    [[3101.96142578125, 0.0, 1907.9949951171875], [0.0, 3101.96142578125, 1062.4305419921875], [0.0, 0.0, 1.0]]
    3840
    2160
    RGB Camera resized intrinsics... 3840 x 2160 
    [[3.10196143e+03 0.00000000e+00 1.90799500e+03]
     [0.00000000e+00 3.10196143e+03 1.06243054e+03]
     [0.00000000e+00 0.00000000e+00 1.00000000e+00]]
    RGB Camera resized intrinsics... 4056 x 3040 
    [[3.27644678e+03 0.00000000e+00 2.01531970e+03]
     [0.00000000e+00 3.27644678e+03 1.50144226e+03]
     [0.00000000e+00 0.00000000e+00 1.00000000e+00]]
    LEFT Camera Default intrinsics...
    [[800.8717041015625, 0.0, 630.91015625], [0.0, 800.8717041015625, 353.4556884765625], [0.0, 0.0, 1.0]]
    1280
    800
    LEFT Camera resized intrinsics...  1280 x 720
    [[800.8717041    0.         630.91015625]
     [  0.         800.8717041  313.45568848]
     [  0.           0.           1.        ]]
    RIGHT Camera resized intrinsics... 1280 x 720
    [[799.47930908   0.         629.921875  ]
     [  0.         799.47930908 289.20376587]
     [  0.           0.           1.        ]]
    LEFT Distortion Coefficients...
    k1: 6.860053539276123
    k2: 8.262731552124023
    p1: -0.0022835570853203535
    p2: -0.0021555486600846052
    k3: -33.7902717590332
    k4: 6.535381317138672
    k5: 9.392735481262207
    k6: -34.76184844970703
    s1: 0.0
    s2: 0.0
    s3: 0.0
    s4: 0.0
    τx: 0.0
    τy: 0.0
    RIGHT Distortion Coefficients...
    k1: -6.954834461212158
    k2: 72.10208129882812
    p1: 0.002446624916046858
    p2: -0.0010923939989879727
    k3: -56.510074615478516
    k4: -7.038227558135986
    k5: 71.96546173095703
    k6: -55.74861145019531
    s1: 0.0
    s2: 0.0
    s3: 0.0
    s4: 0.0
    τx: 0.0
    τy: 0.0
    RGB FOV 68.7938003540039, Mono FOV 71.86000061035156
    LEFT Camera stereo rectification matrix...
    [[ 9.92582395e-01  1.52826154e-03  8.94126118e+00]
     [-2.66677967e-03  9.98922586e-01 -2.37076286e+01]
     [-8.97451186e-06  2.29198615e-06  1.00491614e+00]]
    RIGHT Camera stereo rectification matrix...
    [[ 9.94311104e-01  1.53092320e-03  8.86955389e+00]
     [-2.67142421e-03  1.00066234e+00  1.53122947e-02]
     [-8.99014212e-06  2.29597793e-06  1.00497154e+00]]
    Transformation matrix of where left Camera is W.R.T right Camera's optical center
    [[ 9.99980092e-01 -5.61705092e-03  2.88275210e-03 -7.45497704e+00]
     [ 5.62753947e-03  9.99977529e-01 -3.64335626e-03 -4.23889123e-02]
     [-2.86222226e-03  3.65950656e-03  9.99989212e-01 -3.22463810e-02]
     [ 0.00000000e+00  0.00000000e+00  0.00000000e+00  1.00000000e+00]]
    Transformation matrix of where left Camera is W.R.T RGB Camera's optical center
    [[ 9.99982953e-01  3.72270565e-03  4.49601887e-03 -3.76168180e+00]
     [-3.75821535e-03  9.99961615e-01  7.91575387e-03 -1.48493946e-02]
     [-4.46637813e-03 -7.93251581e-03  9.99958575e-01 -1.99031860e-01]
     [ 0.00000000e+00  0.00000000e+00  0.00000000e+00  1.00000000e+00]]
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
  • 相关阅读:
    七月集训(1)数组
    JavaScript 编程的内部方法有哪些?
    2022第五空间WEB&MISC
    一、Redis入门之——介绍、安装,图形化界面(GUI)工具Redis Desktop Manager (RDM)安装
    Springboot毕设项目餐厅后勤管理系统cxjgl(java+VUE+Mybatis+Maven+Mysql)
    SpringBoot SpringBoot 开发实用篇 4 数据层解决方案 4.14 ES 索引操作
    Kubernetes(k8s)pod 探针检测
    阅读mybatis的源码的思路
    有哪些能赚钱的手机app?
    DDD概念理解
  • 原文地址:https://blog.csdn.net/guanjing_dream/article/details/127859240