Intel RealSense D435i
- 一、安装试验librealsense SDK 2.0
-
- 方法一(安装不成功)
-
- 1. 注册公匙
- 2. 添加repositories
- 3. 安装library
- 4. 安装developer和debug packages
- 5. 测试SDK
- 方法二(本次使用 成功)
-
- 1. 下载安装包
- 2. 更新依赖库
- 3. 安装依赖库
- 4. 运行脚本
- 5. 下载并编译内核模块
- 6. 编译SDK2.0
- 7. 测试
- 二、安装ROS Wrapper —— realsense-ros
-
- 1、建立workspace,已经可以跳过
- 2、在catkin_ws/src/下载源程序
- 3、catkin_make
-
- 报错:
- 原因:
- 解决办法:
- 4.如果没有错误的说明,已经安装好了,启动相机节点
-
- 报错:
- 解决办法:
- 报错:
- 解决办法:
- 看看发布的topic
- 三、检查相机内参
-
- 方法一:
- 方法二:
- 参考文献
一、安装试验librealsense SDK 2.0
方法一(安装不成功)
librealsense SDK相当于相机的驱动,SR300和ZR300的支持驱动是librealsense SDK 1.0,而D435i是librealsense SDK 2.0-官方安装教程Intel? RealSense? SDK 2.0
1. 注册公匙
sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
2. 添加repositories
Ubuntu 16 LTS:
sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main" -u
Ubuntu 18 LTS:
sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main" -u
报错:
E: 无法下载 http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo/dists/bionic/InRelease 403 Forbidden [IP: 52.218.0.218 80] E: 仓库 “http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic InRelease” 没有数字签名。 N: 该源无法安全更新,默认禁用。 N: 参见 apt-secure(8) 了解仓库创建和用户配置的细节。
3. 安装library
sudo apt-get install librealsense2-dkms sudo apt-get install librealsense2-utils
报错:
4. 安装developer和debug packages
sudo apt-get install librealsense2-dev sudo apt-get install librealsense2-dbg
5. 测试SDK
realsense-viewer
运行完上面测试命令之后会弹出来一个看上去还满酷的SDK界面,打开三个按钮可以看到RGB、双目和IMU的结果就证明你的SDK装成功了。
方式二(本次使用 成功)
1. 下载安装包
git clone https://github.com/IntelRealSense/librealsense.git
cd librealsense
更新软件源,获取最新的稳定的内核,可以用uname -r查看内核,满足4.8及以上就行,有时候会在这里出错,如果内核版本不够高的话。
2. 更新依赖库
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
3. 安装依赖库
安装一些编译所需的依赖,不同版本系统安装依赖不同,以ubuntu18.04为例需要安装的是:
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
4. 运行脚本
进入到librealsense文件夹目录下,运行Intel Realsense 的许可脚本
./scripts/setup_udev_rules.sh
5. 下载并编译内核模块
./scripts/patch-realsense-ubuntu-lts.sh
这一步要很长时间,连外网会快点。 另外,执行sudo dmesg | tail -n 50可以看到新的uvcvideo驱动已经登记了。
###########运行结果###############################
sfann@sfann-virtual-machine:~/D435i/librealsense$ sudo dmesg | tail -n 50
[ 15.370489] RAPL PMU: hw unit of domain psys 2^-0 Joules
[ 16.314142] AVX2 version of gcm_enc/dec engaged.
[ 16.314143] AES CTR mode by8 optimization enabled
[ 22.329178] audit: type=1400 audit(1652624204.097:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/12725/usr/lib/snapd/snap-confine" pid=813 comm="apparmor_parser"
[ 22.329180] audit: type=1400 audit(1652624204.097:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/12725/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=813 comm="apparmor_parser"
[ 22.336127] audit: type=1400 audit(1652624204.101:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/sbin/dhclient" pid=812 comm="apparmor_parser"
[ 22.336130] audit: type=1400 audit(1652624204.101:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=812 comm="apparmor_parser"
[ 22.336131] audit: type=1400 audit(1652624204.101:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-helper" pid=812 comm="apparmor_parser"
[ 22.336132] audit: type=1400 audit(1652624204.101:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/connman/scripts/dhclient-script" pid=812 comm="apparmor_parser"
[ 22.341581] audit: type=1400 audit(1652624204.109:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=816 comm="apparmor_parser"
[ 22.341583] audit: type=1400 audit(1652624204.109:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_filter" pid=816 comm="apparmor_parser"
[ 22.341584] audit: type=1400 audit(1652624204.109:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_groff" pid=816 comm="apparmor_parser"
[ 22.365700] audit: type=1400 audit(1652624204.133:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/cups-browsed" pid=818 comm="apparmor_parser"
[ 23.322767] NET: Registered protocol family 40
[ 23.598943] Adding 1047548k swap on /dev/sda5. Priority:-2 extents:1 across:1047548k FS
[ 31.401406] IPv6: ADDRCONF(NETDEV_UP): ens33: link is not ready
[ 31.406653] IPv6: ADDRCONF(NETDEV_UP): ens33: link is not ready
[ 31.414323] e1000: ens33 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
[ 31.415290] IPv6: ADDRCONF(NETDEV_CHANGE): ens33: link becomes ready
[ 77.691250] systemd-journald[374]: File /var/log/journal/76ea0dfdb2f1489285439ca8aa43ad46/user-1000.journal corrupted or uncleanly shut down, renaming and replacing.
[ 86.214263] ISO 9660 Extensions: Microsoft Joliet Level 3
[ 86.214950] ISO 9660 Extensions: RRIP_1991A
[ 86.399338] rfkill: input handler disabled
[ 91.531125] SGI XFS with ACLs, security attributes, realtime, no debug enabled
[ 91.566506] JFS: nTxBlock = 8192, nTxLock = 65536
[ 91.602079] ntfs: driver 2.1.32 [Flags: R/O MODULE].
[ 91.637737] QNX4 filesystem 0.2.3 registered.
[ 91.729219] raid6: sse2x1 gen() 13408 MB/s
[ 91.777008] raid6: sse2x1 xor() 7464 MB/s
[ 91.824648] raid6: sse2x2 gen() 16331 MB/s
[ 91.872198] raid6: sse2x2 xor() 11164 MB/s
[ 91.920205] raid6: sse2x4 gen() 13969 MB/s
[ 91.968053] raid6: sse2x4 xor() 9204 MB/s
[ 92.016400] raid6: avx2x1 gen() 25069 MB/s
[ 92.064069] raid6: avx2x1 xor() 16626 MB/s
[ 92.111806] raid6: avx2x2 gen() 32793 MB/s
[ 92.160096] raid6: avx2x2 xor() 19053 MB/s
[ 92.208093] raid6: avx2x4 gen() 24681 MB/s
[ 92.255781] raid6: avx2x4 xor() 8268 MB/s
[ 92.255786] raid6: using algorithm avx2x2 gen() 32793 MB/s
[ 92.255787] raid6: .... xor() 19053 MB/s, rmw enabled
[ 92.255789] raid6: using avx2x2 recovery algorithm
[ 92.267133] xor: automatically using best checksumming function avx
[ 92.329871] Btrfs loaded, crc32c=crc32c-intel
[ 4591.987198] media: Linux media interface: v0.10
[ 4591.988442] videodev: loading out-of-tree module taints kernel.
[ 4591.988535] videodev: module verification failed: signature and/or required key missing - tainting kernel
[ 4591.991439] Linux video capture interface: v2.00
[ 4592.090064] usbcore: registered new interface driver uvcvideo
[ 4592.090065] USB Video Class driver (1.1.1)
6. 编译SDK2.0
cd librealsense
mkdir build
cd build
cmake ../ -DBUILD_EXAMPLES=true
make
sudo make install
7. 测试
测试SDK2.0是否成功安装,使用usb3.0接口
连上相机,进入到build/examples/capture
文件夹中,执行
cd examples/capture
./rs-capture
realsense-viewer
二、安装ROS Wrapper —— realsense-ros
官方教程
1、建立workspace,已经有的可以跳过
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
catkin_init_workspace
cd ..
catkin_make
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
2、在catkin_ws/src/下载源程序
cd src
git clone https://github.com/intel-ros/realsense.git
3、catkin_make
cd ..
catkin_make
报错:
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by
"ddynamic_reconfigure" with any of the following names:
ddynamic_reconfigureConfig.cmake
ddynamic_reconfigure-config.cmake
Add the installation prefix of "ddynamic_reconfigure" to CMAKE_PREFIX_PATH
or set "ddynamic_reconfigure_DIR" to a directory containing one of the
above files. If "ddynamic_reconfigure" provides a separate development
package or SDK, be sure it has been installed.
Call Stack (most recent call first):
realsense/realsense2_camera/CMakeLists.txt:11 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/sfann/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/sfann/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:1118: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
原因:
realsense/realsense2_camera/CMakeLists.txt:11 (find_package)
解决办法:
sudo apt-get install ros-melodic-ddynamic-reconfigure
sfann@sfann-virtual-machine:~/catkin_ws$ roslaunch realsense2_camera rs_camera.launch
Traceback (most recent call last):
File "/opt/ros/melodic/bin/roslaunch", line 34, in <module>
import roslaunch
File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/__init__.py", line 39, in <module>
import rospkg
ImportError: No module named rospkg
4、如果没有错误说明,已经装好了,启动相机节点
roslaunch realsense2_camera rs_rgbd.launch
报错:
sfann@sfann-virtual-machine:~/catkin_ws$ roslaunch realsense2_camera rs_rgbd.launch
Traceback (most recent call last):
File "/opt/ros/melodic/bin/roslaunch", line 34, in <module>
import roslaunch
File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/__init__.py", line 39, in <module>
import rospkg
ImportError: No module named rospkg
解决办法:
sfann@sfann-virtual-machine:~/catkin_ws$ pip install -U rospkg
Collecting rospkg
Downloading https://files.pythonhosted.org/packages/2a/80/ac835a4acaf97ab545bff52cd147cd5a3d53d9519cdfeaff2f8961b07772/rospkg-1.4.0.tar.gz (41kB)
100% |████████████████████████████████| 51kB 112kB/s
Collecting catkin_pkg (from rospkg)
Downloading https://files.pythonhosted.org/packages/52/d1/3fa5d3de65798a33100f7d07ded7fb86c5d63534111baa4959993701c1d4/catkin_pkg-0.5.0.tar.gz (62kB)
100% |████████████████████████████████| 71kB 92kB/s
Collecting PyYAML (from rospkg)
Using cached https://files.pythonhosted.org/packages/ba/d4/3cf562876e0cda0405e65d351b835077ab13990e5b92912ef2bf1a2280e0/PyYAML-5.4.1-cp27-cp27mu-manylinux1_x86_64.whl
Collecting docutils (from catkin_pkg->rospkg)
Downloading https://files.pythonhosted.org/packages/8d/14/69b4bad34e3f250afe29a854da03acb6747711f3df06c359fa053fae4e76/docutils-0.18.1-py2.py3-none-any.whl (570kB)
100% |████████████████████████████████| 573kB 12kB/s
Collecting python-dateutil (from catkin_pkg->rospkg)
Using cached https://files.pythonhosted.org/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl
Collecting pyparsing (from catkin_pkg->rospkg)
Using cached https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl
Collecting setuptools (from catkin_pkg->rospkg)
Using cached https://files.pythonhosted.org/packages/e1/b7/182161210a13158cd3ccc41ee19aadef54496b74f2817cc147006ec932b4/setuptools-44.1.1-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil->catkin_pkg->rospkg)
Using cached https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Building wheels for collected packages: rospkg, catkin-pkg
Running setup.py bdist_wheel for rospkg ... done
Stored in directory: /home/sfann/.cache/pip/wheels/24/c6/77/53579e95e74d5d61dc451ab67be41649a405c4c6cfc02932d5
Running setup.py bdist_wheel for catkin-pkg ... done
Stored in directory: /home/sfann/.cache/pip/wheels/17/74/2c/92aedace906f9f08496e1cda8754f47b4ca7f9731a11f1ae80
Successfully built rospkg catkin-pkg
Installing collected packages: docutils, six, python-dateutil, pyparsing, setuptools, catkin-pkg, PyYAML, rospkg
Successfully installed PyYAML-5.4.1 catkin-pkg-0.5.0 docutils-0.18.1 pyparsing-2.4.7 python-dateutil-2.8.2 rospkg-1.4.0 setuptools-44.1.1 six-1.16.0
报错:
sfann@sfann-virtual-machine:~/catkin_ws$ roslaunch realsense2_camera rs_rgbd.launch
... logging to /home/sfann/.ros/log/e1ae5558-d4e5-11ec-90a4-000c298e2de6/roslaunch-sfann-virtual-machine-2498.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.
Resource not found: rgbd_launch
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/home/sfann/catkin_ws/src
ROS path [2]=/home/sfann/catkfu_ws/src
ROS path [3]=/opt/ros/melodic/share
The traceback for the exception was written to the log file
解决办法:
sudo apt-get install ros-melodic-rgbd-launch
5、看一下发布的topic
rostopic list
sfann@sfann-virtual-machine:~/catkin_ws$ rostopic list /camera/align_to_color/parameter_descriptions /camera/align_to_color/parameter_updates /camera/aligned_depth_to_color/camera_info /camera/aligned_depth_to_color/image_raw /camera/aligned_depth_to_color/image_raw/compressed /camera/aligned_depth_to_color/image_raw/compressed/parameter_descriptions /camera/aligned_depth_to_color/image_raw/compressed/parameter_updates /camera/aligned_depth_to_color/image_raw/compressedDepth /camera/aligned_depth_to_color/image_raw/compressedDepth/parameter_descriptions /camera/aligned_depth_to_color/image_raw/compressedDepth/parameter_updates /camera/aligned_depth_to_color/image_raw/theora /camera/aligned_depth_to_color/image_raw/theora/parameter_descriptions /camera/aligned_depth_to_color/image_raw/theora/parameter_updates /camera/color/camera_info /camera/color/image_raw /camera/color/image_raw/compressed /camera/color/image_raw/compressed/parameter_descriptions /camera/color/image_raw/compressed/parameter_updates /camera/color/image_raw/compressedDepth /camera/color/image_raw/compressedDepth/parameter_descriptions /camera/color/image_raw/compressedDepth/parameter_updates /camera/color/image_raw/theora /camera/color/image_raw/theora/parameter_descriptions /camera/color/image_raw/theora/parameter_updates /camera/color/image_rect_color /camera/color/image_rect_color/compressed /camera/color/image_rect_color/compressed/parameter_descriptions /camera/color/image_rect_color/compressed/parameter_updates /camera/color/image_rect_color/compressedDepth /camera/color/image_rect_color/compressedDepth/parameter_descriptions /camera/color/image_rect_color 标签:
zr2012w3y二极管