Ubuntu20.04中Realsense的安装与使用

汤依灵 2024-07-25 08:07:03 阅读 66

一. 安装realsense SDK

(注意:安装时需要拔掉相机)

由于T265停产,Intel RealSense SDK 2.0(v.2.54.1)在该版本中移除了对T265相机的支持,因此下载v2.48.0版本。

首先下载安装包:

<code>git clone -b v2.48.0 https://github.com/IntelRealSense/librealsense

 分别执行安装依赖项:

cd librealsense

sudo apt-get install libudev-dev pkg-config libgtk-3-dev

sudo apt-get install libusb-1.0-0-dev pkg-config

sudo apt-get install libglfw3-dev

sudo apt-get install libssl-dev

安装权限脚本:

sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/

sudo udevadm control --reload-rules && udevadm trigger

编译librealsense:

mkdir build

cd build

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

sudo make uninstall

make clean && make -j8

sudo make install

将t265插到USB3.0插口,测试安装好的librealsense

realsense-viewer

此时会打开realsense软件,把界面左边的off按钮拨到on, 即可出现相机的轨迹。

如果显示mission一个模块,右上角会有标注,输入如下指令安装该模块:

sudo cp ~/.99-realsense-libusb.rules /etc/udev/rules.d/99-realsense-libusb.rules && sudo udevadm control --reload-rules && udevadm trigger

再次打开realsense-viewer就可以看到t265的数据了~

三. 报错解决

(1)Error booting T265

把usb2.0口换为usb3.0口

(2)打开realsense-viewer后右上角有红色提醒

Description: Multiple realsense udev-rules were found!

1: /etc/udev/rules.d/99-realsense-libusb.rules

2:/lib/udev/rules.d/60-librealsense2-udev-rules.rules

Make sure to remove redundancies!

 解决方法:

sudo rm -rf /etc/udev/rules.d/99-realsense-libusb.rules

sudo apt-get autoremove librealsense2-dkms

(3)无法获得锁/var/lib/dkpg/lock-frontend. 锁正由进程12836(unattended-upgr)持有。

解决方法:

sudo rm /var/cache/apt/archives/lock

sudo rm /var/lib/dpkg/lock

四. 使用ROS获取数据

方式一:

首先安装ros-noetic-realsense2-camera

sudo apt-get install ros-noetic-realsense2-camera

执行rs_t265.launch文件

roslaunch realsense2_camera rs_t265.launch

打开一个新的终端,查看发布的ros话题,可以看到realsense-camera和odom之类的数据

rostopic list

方式二:

源码位置:GitHub - IntelRealSense/realsense-ros at ros1-legacy

Create a catkin workspace Ubuntu

mkdir -p ~/catkin_ws/src

cd ~/catkin_ws/src/

Clone the latest Intel® RealSense™ ROS from here into 'catkin_ws/src/'

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

Make sure all dependent packages are installed. You can check .travis.yml file for reference.Specifically, make sure that the ros package ddynamic_reconfigure is installed. If ddynamic_reconfigure cannot be installed using APT or if you are using Windows you may clone it into your workspace 'catkin_ws/src/' from here

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



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。