Ubuntu下ZED CAMERA的安装配置
系统环境
- 型号:Thinkpad 460p
- 显卡:GeForce 940MX & Intel HD Graphics 530
- 系统:Ubuntu 14.04.5 LTS
- 内核:4.4.0-31-generic
前期准备
1 | sudo apt-get update |
安装显卡驱动
CUDA 7.5自带的驱动在Ubuntu 14.04.5(4.4 kernel)上会出现安装错误:
1 | The driver installation is unable to locate the kernel source. |
这是由于CUDA 7.5的驱动是针对3.xx kernels的,所以需要安装较新的驱动1。
在这里下载安装包cuda_8.0.61_375.26_linux.run
在这里下载安装包cuda_7.5.18_linux.run
1 | sudo apt-get install linux-headers-$(uname -r) g++ |
关掉开源的Nouveau驱动2:
1 | lsmod | grep nouveau #检测Nouveau是否开启,有输出则开启,无输出则为开启 |
如果Nouveau开启:
1 | sudo gedit /etc/modprobe.d/blacklist-nouveau.conf |
在创建的文件中输入以下内容关闭掉Nouveau
1 | blacklist nouveau |
更新list,使得更改生效
1 | sudo update-initramfs -u |
重启电脑,进入登录界面的时候,先不要登录进入桌面3,按Ctrl+Alt+F1
进入命令行界面,关闭图形化界面:
1 | sudo service lightdm stop |
安装驱动
继续上个步骤,在命令行界面中进入到cuda_8.0.61_375.26_linux.run
所在文件夹,运行:
1 | chmod +x cuda_8.0.61_375.26_linux.run |
注意我们这里只选择安装Driver!
安装CUDA 7.5
1 | chmod +x cuda_7.5.18_linux.run |
需要gcc 4.8版本的编译器 注意不要安装openGL,不然会遇到循环登录的问题!
重启图形化界面:
1 | sudo service lightdm start |
配置环境:
1 | sudo gedit ~/.bashrc |
添加:
1 | export PATH=/usr/local/cuda-7.5/bin:$PATH |
重启电脑,执行:
1 | ls /dev/nvidia* |
应出现如:
1 | /dev/nvidia0 /dev/nvidiactl /dev/nvidia-uvm /dev/nvidia-uvm-tools |
"/dev/nvidia*: No such file or directory"错误
1 | sudo gedit /etc/rc.local |
去掉第一行中#!/bin/sh -e
的-e
,
并且在exit 0
前添加4:
1 | /sbin/modprobe nvidia |
测试
输入:
1 | cat /proc/driver/nvidia/version |
显示:
1 | NVRM version: NVIDIA UNIX x86_64 Kernel Module 375.26 Thu Dec 8 18:36:43 PST 2016 |
输入:
1 | nvcc -V |
输出:
1 | nvcc: NVIDIA (R) Cuda compiler driver |
编译sample
在NVIDIA_CUDA-8.0_Samples
文件夹下执行:
1 | make |
进入NVIDIA_CUDA-8.0_Samples/bin/x86_64/linux/release
文件夹,运行:
1 | ./deviceQuery |
删除CUDA的方法
当出现问题需要重装时,可输入:
1 | sudo /usr/local/cuda-7.5/bin/uninstall_cuda_7.5.pl |
升级gcc到4.9(可选)
Ubuntu系统默认的是gcc 4.8,版本比较老,在使用时候可能会导致一些错误,所以将gcc升级到4.9版本,并且将4.9作为默认编译器。
查看当前版本:
1 | gcc -v |
安装gcc 4.9:
1 | sudo add-apt-repository ppa:ubuntu-toolchain-r/test |
显示和选择使用版本:
1 | sudo update-alternatives --config gcc |
安装libfreenect2(可选)
由于将来需要使用Kinect2,所以顺带将相应的驱动也装上了:
1 | git clone https://github.com/OpenKinect/libfreenect2.git |
测试:
1 | ./bin/Protonect |
安装OpenCV 2.4.10
修改/modules/gpu/src/graphcuts.cpp
的内容,将:
1 | #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) |
修改为:
1 | #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000) |
运行:
1 | mkdir build |
卸载OpenCV的方法
1 >sudo make uninstall
安装Pangolin(可选)
1 | sudo apt-get install libglew-dev libboost-dev libboost-thread-dev libboost-filesystem-dev |
安装ROS Indigo5
1 | sudo sh -c '. /etc/lsb-release && echo "deb http://mirror.sysu.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list' |
Depends错误
如果在安装时出现Depends: ros-indigo-simulators but it is not going to be installed
的错误(安装gazebo2导致的错误),可以先下载老版本的libsdformat-dev,安装,然后再执行sudo apt-get install ros-indigo-desktop-full
。
安装iai_kinect2(可选)
This is a collection of tools and libraries for a ROS Interface to the Kinect One (Kinect v2).
1 | mkdir -p ~/catkin_ws/src |
此时可能会显示有关[kinect2_bridge] and [depth_registration]的错误,不用理它。
1 | cd ~/catkin_ws |
"libfreenect2.so: undefined reference to clRetainContext@OPENCL_1.0"错误
这是由于CUDA自带的/usr/local/cuda/lib64/libOpenCL.so
和其他库提供的/usr/lib/x86_64-linux-gnu/libOpenCL.so
冲突导致6,执行以下命令:
1 | sudo apt-get remove nvidia-modprobe opencl-headers |
测试
打开一个窗口:
1 | roscoe |
打开另外一个窗口:
1 | cd ~/catkin_ws/ |
再打开另外一个窗口:
1 | cd ~/catkin_ws/ |
安装ORB_SLAM2
1 | sudo apt-get install libblas-dev liblapack-dev |
安装OpenCV 3.1
ZED SDK v1.1需要OpenCV 3.1,所以需要再安装一个。在这里下载openCV 3.1版本的源代码。
修改/modules/cudalegacy/src/graphcuts.cpp
的内容7,将:
1 | #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) |
修改为:
1 | #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000) |
运行:
1 | mkdir build |
查看当前OpenCV版本号
1 | pkg-config --modversion opencv |
OpenCV多版本冲突
由于系统安装了两个版本的OpenCV,在编译时有可能会发生以下错误:
1 | /usr/bin/ld: warning: libopencv_highgui.so.2.4, needed by /opt/ros/indigo/lib/libcv_bridge.so, may conflict with libopencv_highgui.so.3.1 |
这时,可以在CMakeLists.txt
文件中指定OpenCV所需版本的的build目录路径来解决冲突问题,如8:
1 | set(OpenCV_DIR "/home/luohanjie/Documents/Software/opencv-2.4.10/build") |
安装ZED SDK
在这里下载ZED SDK for Linux。
最新的v2.0版本在Ubuntu 14.04下无法使用,所以使用v1.1版本。
1 | chmod +x ZED_SDK_Linux_x86_64_v1.1.0 |
输入 q 退出 license agreement。
安装zed-ros-wrapper
1 | cd ~/catkin_ws/src |
测试
打开一个窗口,执行:
1 | roscore |
打开另外一个窗口,执行:
1 | cd ~/catkin_ws |
再打一个窗口:
1 | rosrun rviz rviz |
Then click on add (bottom left), select the By Topic tab, select point_cloud->cloud->PointCloud2 and click OK9.
运行结果:
Launch file parameters
Parameter | Description | Value |
---|---|---|
svo_file | SVO filename | path to an SVO file |
resolution | ZED Camera resolution | '0': HD2K |
_ | _ | '1': HD1080 |
_ | _ | '2': HD720 |
_ | _ | '3': VGA |
quality | Disparity Map quality | '0': NONE |
_ | _ | '1': PERFORMANCE |
_ | _ | '2': MEDIUM |
_ | _ | '3': QUALITY |
sensing_mode | Depth sensing mode | '0': FILL |
_ | _ | '1': STANDARD |
openni_depth_mode | Convert depth to 16bit in millimeters | '0': 32bit float meters |
_ | _ | '1': 16bit uchar millimeters |
frame_rate | Rate at which images are published | int |
rgb_topic | Topic to which rgb==default==left images are published | string |
rgb_cam_info_topic | Topic to which rgb==default==left camera info are published | string |
rgb_frame_id | ID specified in the rgb==default==left image message header | string |
left_topic | Topic to which left images are published | string |
left_cam_info_topic | Topic to which left camera info are published | string |
left_frame_id | ID specified in the left image message header | string |
right_topic | Topic to which right images are published | string |
right_cam_info_topic | Topic to which right camera info are published | string |
right_frame_id | ID specified in the right image message header | string |
depth_topic | Topic to which depth map images are published | string |
depth_cam_info_topic | Topic to which depth camera info are published | string |
depth_frame_id | ID specified in the depth image message header | string |
point_cloud_topic | Topic to which point clouds are published | string |
cloud_frame_id | ID specified in the point cloud message header | string |
odometry_topic | Topic to which odometry is published | string |
odometry_frame_id | ID specified in the odometry message header | string |
odometry_transform_frame_id | Name of the transformation following the odometry | string |
https://devtalk.nvidia.com/default/topic/978812/installing-cuda-7-5-fails-on-ubuntu-14-0-4-5-with-error-driver-installation-is-unable-to-locate-the-kernel-source/↩︎
http://www.cnblogs.com/leexiaoming/p/6576274.html↩︎
http://www.jianshu.com/p/35c7fde85968↩︎
http://www.jianshu.com/p/35c7fde85968↩︎
http://wiki.ros.org/cn/indigo/Installation/Ubuntu↩︎
https://github.com/OpenKinect/libfreenect2/issues/804↩︎
http://docs.opencv.org/3.1.0/d7/d9f/tutorial_linux_install.html↩︎
http://www.cnblogs.com/leexiaoming/p/6576274.html↩︎
https://github.com/stereolabs/zed-ros-wrapper/tree/v1.0.0↩︎