ros-indigo配置realsense R200的开发套件及遇到问题解决事项

本配置教程安装环境及需求如下:

Ubuntu 14.04.4 LTS 14.04.5也可以)

kernel 4.4.0-040400-generic

ros-indigo-desktop

gcc 4.9.3(貌似4.8.5也可以使用,第一步升级GCC4.9.3可以跳过)

realsense_camera

librealsense

一般情况下,安装完Ubuntu14.04.5ros-indigo-desktop(完全安装)后,kernel4.4.0-040400-generic 就已经配置上了。

而在terminal输入'gcc-v',查看到当前gcc版本为4.8.4,需要升级为4.9.3

1.升级GCC4.9.3(这个步骤可以跳过,其实可以不升级)

Terminal中输入下面的命令,在加上几分钟的等待,即可完成安装:

$
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$
sudo apt-get update
$
sudo apt-get install gcc-4.9 g++-4.9

安装完成后,你会发现如果直接使用gcc/g++命令,默认采用的版本仍然是原来的4.8.4版本。你如果要使用新版的gcc/g++,必须采用命令gcc-4.9/g++-4.9。下面讲解如何将版本4.9设为默认。

采用以下命令:

sudo
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60
--slave /usr/bin/g++ g++ /usr/bin/g++-4.9

就可将gcc/g++的默认版本设为4.9.4update-alternatives是一个管理工具,能够管理同一个软件的不同版本。上命令中,参数slave保证gccg++版本的联动调整。而60是表示的优先级,你可以选用任何你喜欢的大于0的整数。那么,此时你再利用gcc命令查看当前的版本,就会发现已经是新版本了,如下图:
这里写图片描述
但是,接下来的一个问题是,如果你还想继续使用原来的版本,怎么办?况且原来版本并没有删除。同样还是利用update-alternatives,及如下的命令:

sudo
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
--slave /usr/bin/g++ g++ /usr/bin/g++-4.8

上面的优先级设为50,所有当前默认为4.9.2版本。你可以使用命令

sudo
update-alternatives --query gcc

来查看被update-alternatives管理的gcc不同版本,这同样可以针对g++

既然gcc/g++的不同版本已被update-alternatives管理,那么如何在这两个不同的gcc/g++版本间进行切换使用呢?

采用如下图所示的命令,接着再输入对应的序号,就可以在不同的版本间进行切换:
这里写图片描述


2.安装realsense_camera

参考地址:http://wiki.ros.org/realsense_camera

http://wiki.ros.org/librealsense#Installation_Prerequisites

先安装librealsense

Useone of the following methods to enable the downloading of kernelsources on the system. This only needs to be done once per system orif the OS is re-installed or upgrade to a new major release.

(一般采用第一种方式就可以)

Method 1 (Script)(采用该方案即可)

wget -O enable_kernel_sources.sh http://bit.ly/en_krnl_src
bash ./enable_kernel_sources.sh'

or

Method 2 (Manual)

Updateyour /etc/apt/sources.listfile and/or /etc/apt/sources.list.d/*.listto uncomment (or add) the deb-srcentries for all of the entries for the mainrepositories. Below is an examplefor ubuntu 16.04 (Xenial).

deb-src
http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
deb-src
http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb-src
http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted
universe multiverse
deb-src
http://security.ubuntu.com/ubuntu xenial-security main restricted


After the manual edits arecomplete, run the update commands to ensure the entries are correctand update the package database.

sudo apt-get update
Re-install Package

If the package has failed toinstall because the kernel sources were not available, the packagewill need to be re-installed after the update.


sudo apt-get --reinstall install 'ros-indigo-librealsense'

Installation Troubleshooting

如果安装过程出现问题,则参考如下方案:

No cameras detected:

roslaunch realsense_camera [cam_type]_nodelet_[mode].launch

[ERROR]: /camera/driver - No cameras detected! [ERROR]: /camera/driver - Error calling rs_create_context ( api_version:11100 ): uvcvideo kernel module is not loaded ...

sudo modprobe uvcvideo

modprobe: ERROR: could not insert 'uvcvideo': Required key not available

Solution: (需要关掉Secure Boot,参考以下链接https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS)

DKMS does not work with Secure Boot. You need to disable it(https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS).

DKMSFails to Build:

make KERNELRELEASE=4.4.0-43-generic -C /var/lib/dkms/uvcvideo/1.1.1-3-realsense/build/linux-src M=drivers/media/usb/uvc/....(bad exit status: 2)
Error!
Bad return status for module build on kernel: 4.4.0-43-generic
(x86_64)

Solution:

  • Removethe failed DKMS installation

dkms remove -m uvcvideo -v "1.1.1-3-realsense" --all



再安装realsense_camera


Most users should only need toinstall the prebuilt ROS Debian packages.

sudo apt-get install 'ros-indigo-realsense-camera'

This will also install the requiredros-*-librealsense library on your system.

Building both librealsenseand RealSense Camera from Sources

Description: Instructions for building bothlibrealsense AND realsense_camera package from source files in thesame workspace.
Keywords: realsense,librealsense, build, source, sources

Cloning sources into catkin Workspace

# Create the catkin workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
#Download the source files
git
clone https://github.com/intel-ros/realsense.git
git clone https://github.com/IntelRealSense/librealsense.git
#Checkout the latest stable code
cd ~/catkin_ws/src/realsense
git checkout -b stable-branch stable
cd ~/catkin_ws/src/librealsense
git checkout -b stable-branch stable

Install Dependencies

# Update the dependencies database
rosdep update
#Attempt to install dependencies
#Requires that your login has sudo privileges to instal as root using
apt-get
cd ~/catkin_ws
rosdep -y install --from-paths src --ignore-src

Build the Packages

Build librealsense FIRST

cd ~/catkin_ws
catkin_make --pkg librealsense

Build realsense_camera second

cd ~/catkin_ws
#Remove any existing realsense_camera binaries
catkin_make
clean --pkg realsense_camera
#Build the package
catkin_make --pkg realsense_camera

Use the Package

source ~/catkin_ws/devel/setup.bash
roslaunch realsense_camera r200_nodelet_default.launch(这句如果有问题,可能需要Linux安装摄像头的驱动,按照下一步安装摄像头驱动)

2.安装realsense_camera驱动

roslaunch realsense_camera
r200_nodelet_default.launch(这句会有问题,因为目前Linux还未安装摄像头的驱动,下一步我们需要安装摄像头驱动)

Ensure apt-get is up to date

    • sudoapt-get update && sudo apt-get upgrade

    • Note: Use sudoapt-get dist-upgrade, instead of sudoapt-get upgrade, in case you have an older Ubuntu 14.04version (with deprecated nvidia-331*packages installed), as this prevents the linux 4.4* kernel tocompile properly.

    • 这一步运行的时候可能会出现security模式的问题,可以退出安全模式,看到一个窗口时先按esc,再确定,设置8位密码,然后确定即可。

  1. Install libusb-1.0 and pkg-configvia apt-get

    • sudoapt-get install libusb-1.0-0-dev pkg-config

  2. glfw3 is not available in apt-geton Ubuntu 14.04. Use included installer script:

    • scripts/install_glfw3.sh(该文件在下载的librealsensepackage下面,我们需要先cdlibrealsense目录下,执行该命令)

    • For 16.04 you can install glfw3via sudo apt-get install libglfw3-dev

  3. We use QtCreator as an IDE forLinux development on Ubuntu

    • Note: QtCreatoris presently configured to use the V4L2 backend by default

    • sudoapt-get install qtcreator

    • sudoscripts/install_qt.sh (we also need qmake from thefull qt5 distribution)

    • all.procontains librealsense and all example applications

    • From the QtCreator top menu:Clean => Run QMake => Build

    • Built QtCreator projects will beplaced into ./bin/debug or./bin/release

  4. We also provide a cmake file ifyou'd prefer to use your own favourite text editor

    • mkdirbuild

    • cdbuild

    • cmake..

    • make&& sudo make install

    • The library will be installed in/usr/local/lib and header file in /usr/local/include

        • Note: If youwould also like to compile the code examples use:

        • cmake.. -DBUILD_EXAMPLES:BOOL=true

        • make&& sudo make install

        • The example executables will build into ./examplesand install into /usr/local/bin.

    此时,摄像头即可运行~


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值