Ubuntu20.04 配置D435i相机

文章目录

  • 一、安装使用 InterRealSenseD435i SDK2
    • 1.注册服务器的公钥
    • 2.安装
    • 3.安装开发者和调试包
    • 4.测试SDK2
  • 二、安装realsense-ros
    • 1.创建工作空间
    • 2.源码安装
    • 3.编译:
  • 三、安装kalibr
    • 1.安装kalibr 依赖
    • 2.安装python-igraph 和 python3-pyx
    • 3.创建工作空间
    • 4.编译:
    • 4. 文件移动
    • 5. kalibr工具生成标定板
  • 四、配置港科大IMU标定
    • 1.安装[ceres](https://blog.csdn.net/SEAL0107/article/details/127790837?spm=1001.2014.3001.5501)
    • 2.创建IMU工作空间
    • 3.下载code_utils并编译
    • 错误:
      • 1) :
      • 2) :
      • 3) :(opencv 4.4.0出现的错误,原因:opencv版本高导致)
        • 1、
        • 2、
    • 4.下载imu_utils并编译
    • 错误:
      • 1) :上半部分中的错误中第二个错误
      • 2) :


一、安装使用 InterRealSenseD435i SDK2

官方安装1 ,
官方安装2 。

1.注册服务器的公钥

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

sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u

2.安装

sudo apt-get update

sudo apt-get install librealsense2-dkms

sudo apt-get install librealsense2-utils

3.安装开发者和调试包

sudo apt-get install librealsense2-dev

sudo apt-get install librealsense2-dbg

4.测试SDK2

连接USB3.0接口

realsense-viewer

二、安装realsense-ros

1.创建工作空间

mkdir -p ~/catkin_ws/src

cd ~/catkin_ws/src/

2.源码安装

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 ..

安装ros包ddynamic_reconfigure

sudo apt install ros-noetic-ddynamic-reconfigure

3.编译:

catkin_init_workspace
cd ..
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install

发布的话题

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

rs_camera.launch更改选项

source devel/setup.bash
roslaunch realsense2_camera rs_camera.launch

新建一个终端: rostopic list

再新建一个终端,并执行:  rviz

在弹出的rviz软件中,左下角有个‘Add’,然后在弹框中选择‘By topic’, 
在里面选择其中一个选项的image。

三、安装kalibr

1.安装kalibr 依赖

sudo apt-get install python3-setuptools
 
sudo apt-get install python3-setuptools python3-rosinstall python3-ipython libeigen3-dev libboost-all-dev doxygen libopencv-dev
 
sudo apt-get install libopencv-dev ros-noetic-vision-opencv ros-noetic-image-transport-plugins ros-noetic-cmake-modules python3-software-properties software-properties-common libpoco-dev python3-matplotlib python3-scipy python3-git python3-pip libtbb-dev libblas-dev liblapack-dev python3-catkin-tools libv4l-dev

2.安装python-igraph 和 python3-pyx

sudo pip install python-igraph --upgrade

 如果不成功,则可以直接安装:
 
sudo apt-get install python-igraph

sudo apt-get install python3-pyx

3.创建工作空间

mkdir -p ~/kalibr_ws/src
cd ~/kalibr_ws
source /opt/ros/noetic/setup.bash
catkin init
catkin config --extend /opt/ros/noetic
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release

4.编译:

cd ~/kalibr_ws/src
git clone https://github.com/ethz-asl/Kalibr.git
cd ~/kalibr_ws
catkin build -DCMAKE_BUILD_TYPE=Release -j4

重新打开一个终端:
echo "source ~/kalibr_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

4. 文件移动

在文件夹kalibr_ws内,安装完成后,没有可执行文件,因此要将可执行文件移动到文件夹kalibr_ws中。
可执行文件在 kalibr_ws/devel/lib/kalibr 路径下,
Ubuntu20.04 配置D435i相机_第1张图片
将该路径下的所有文件复制到kalibr_ws内
Ubuntu20.04 配置D435i相机_第2张图片

5. kalibr工具生成标定板

./kalibr_create_target_pdf --type 'apriltag' --nx 6 --ny 6 --tsize 0.08 --tspace 0.3

四、配置港科大IMU标定

1.安装ceres

2.创建IMU工作空间

mkdir -p ~/imu_catkin_ws/src
cd ~/imu_catkin_ws/src
catkin_init_workspace
cd ~/imu_catkin_ws 
catkin_make
source ~/imu_catkin_ws/devel/setup.bash
source ~/.bashrc

3.下载code_utils并编译

cd ~/imu_catkin_ws/src
git clone https://github.com/gaowenliang/code_utils.git
cd ~/imu_catkin_ws/
catkin_make 

错误:

1) :

/imu_catkin_ws/src/code_utils/src/sumpixel_test.cpp:2:10: fatal error: backward.hpp: 没有那个文件或目录    
2 | #include "backward.hpp"

解决办法:

sudo apt-get install libdw-dev

将出错文件中的
#include “backward.hpp
替换为
#include "code_utils/backward.hpp"

2) :

/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:21: error: ‘integer_sequence’ is not a member of ‘std’
   64 | struct SumImpl<std::integer_sequence<T, N, Ns...>> {

解决方法1
解决方法2
找到报错的项目的CMakeList.txt
set(CMAKE_CXX_FLAGS “-std=c++11”)
改成
set(CMAKE_CXX_STANDARD 14)

3) :(opencv 4.4.0出现的错误,原因:opencv版本高导致)

1、

/imu_catkin_ws/src/code_utils/src/mat_io_test.cpp:33:47: error: ‘CV_LOAD_IMAGE_UNCHANGED’ was not declared in this scope
   33 |     Mat img1 = imread( "/home/gao/IMG_1.png", CV_LOAD_IMAGE_UNCHANGED );
/imu_catkin_ws/src/code_utils/src/sumpixel_test.cpp:85:47: error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
   85 |     Mat img1 = imread( "/home/gao/IMG_1.png", CV_LOAD_IMAGE_GRAYSCALE );

解决方法

将  CV_LOAD_IMAGE_UNCHANGED   换成   IMREAD_UNCHANGED
并在代码头文件下面添加命名空间   using namespace cv;

将  CV_LOAD_IMAGE_GRAYSCALE   换成   IMREAD_GRAYSCALE

2、

/imu_catkin_ws/src/code_utils/src/sumpixel_test.cpp:95:35: error: ‘CV_MINMAX’ was not declared in this scope; did you mean ‘CV_MMX’?
   95 |     normalize( img, img2, 0, 255, CV_MINMAX );
   

解决方法1

原因:缺少 
#include 

解决:添加到对应报错的文件中
.

解决方法2

CV_MINMAX  改成    NORM_MINMAX

4.下载imu_utils并编译

cd ~/imu_catkin_ws/src/
git clone https://github.com/gaowenliang/imu_utils.git
cd ~/imu_catkin_ws/
catkin_make
echo "source ~/imu_catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

错误:

1) :上半部分中的错误中第二个错误

2) :

/imu_catkin_ws/src/imu_utils/src/imu_an.cpp:68:19: error: aggregate ‘std::ofstream out_t’ has incomplete type and cannot be defined
   68 |     std::ofstream out_t;

解决方法

添加头文件:

#include 

你可能感兴趣的:(D435i,c++)