一次并不成功的Guidance安装过程
410C到了,一块主控板(右),一块接口板(左)。一张名片大小,比pixhawk飞控(下图中红色的)略大
设想将它作为上位机,加装到M100四旋翼上。安装Debian和ROS机器人操作系统,主要负责处理传感器(如Guidance)、导航、规划、避障等运算,然后将(mavlink)指令发送给飞控。
首先介绍下410C基本特性:
1. 安装Debian操作系统
目前已经有制作好的Debian、Android、OpenEmbedded镜像和Windows IoT Core。
下面我们在win10的主机上通过SD卡安装Debian镜像。
首先下载win32diskimager安装器文件:https://sourceforge.net/projects/win32diskimager/files/latest/download
和镜像文件:http://builds.96boards.org/releases/dragonboard410c/linaro/debian/latest/dragonboard410c_sdcard_install_debian-*.zip
安装运行win32diskimager,并加载解压出来的db410c_sd_install_debian.img文件。
完成后将SD卡插入410C。
将410C 板子背面的开关设置为`0-1-0-0`
接上显示器和鼠标。
一起就绪,加电!按照提示操作install,大概十几分钟刷系统完毕。
……
移除SD卡
将410C 板子背面的开关设置为``0-0-0-0`
屏幕点击OK
重启
就可以愉快地跑Debian啦!(用户名和密码都是linaro)
2. 修改虚拟内存
我在编译文件时,常常会出现报错
“virtual memory exhausted”
这是因为410c内存为1G,而系统默认的虚拟内存是0,当编译工程比较大时,耗尽了所有的内存,导致编译出错。我们可以手动修改一下虚拟内存。
运行命令查看内存空余情况:
~$ free -m
total used free shared buffers cached
Mem: 833 431 401 55 11 177
-/+ buffers/cache: 243 590
Swap: 0 0 0
此时显示Swap分区为0.
再查看下硬盘容量:
~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 10M 0 10M 0% /dev
tmpfs 167M 5.1M 162M 4% /run
/dev/mmcblk0p10 6.9G 2.9G 3.8G 43% /
tmpfs 417M 136K 417M 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 417M 0 417M 0% /sys/fs/cgroup
tmpfs 84M 0 84M 0% /run/user/0
tmpfs 84M 8.0K 84M 1% /run/user/1000
/dev/mmcblk0p1 64M 22M 42M 35% /media/linaro/00BC-614E
修改虚拟分区方法可参考网页:
http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/
3. 安装ROS
操作系统配置完毕,开始安装ROS机器人操作系统。
最新的kinetic版本安装步骤可参考:
http://wiki.ros.org/kinetic/Installation/Ubuntu
由于存储空间有限我们安装最基本的base版,然后根据需要再添加相应的包。
sudo apt-get install ros-kinetic-ros-base
为了节省时间,我们尽量通过apt install使用库里已有的包,避免源码编译。
sudo apt-get update
通过apt-cache search+关键词可以查阅相应的包。
~$ apt-cache search ros-kinetic
ros-kinetic-ackermann-msgs - ROS messages for robots using Ackermann steering.
ros-kinetic-actionlib - The actionlib stack provides a standardized interface for interfacing with preemptable tasks.
ros-kinetic-actionlib-lisp - actionlib_lisp is a native implementation of the famous actionlib in Common Lisp.
ros-kinetic-actionlib-msgs - actionlib_msgs defines the common messages to interact with an action server and an action client.
ros-kinetic-actionlib-tutorials - The actionlib_tutorials package
ros-kinetic-agvs-common - URDF description of the Agvs and Agvs.
ros-kinetic-agvs-control - The agvs_control package.
ros-kinetic-agvs-description - The agvs_description package.
ros-kinetic-agvs-gazebo - The agvs_gazebo package.
ros-kinetic-agvs-pad - The agvs_pad package.Component to control the robot by using a ps3 pad.
ros-kinetic-agvs-robot-control - The agvs_robot_control package.
ros-kinetic-agvs-sim - agvs Gazebo simulation packages
ros-kinetic-agvs-sim-bringup - The agvs_sim_bringup package.
ros-kinetic-amcl - amcl is a probabilistic localization system for a robot moving in 2D.
ros-kinetic-angles - This package provides a set of simple math utilities to work with angles.
ros-kinetic-ar-track-alvar - This package is a ROS wrapper for Alvar, an open source AR tag tracking library.
ros-kinetic-ar-track-alvar-msgs - This package is a ROS wrapper for Alvar, an open source AR tag tracking library.
ros-kinetic-astra-camera - Drivers for Orbbec Astra Devices.
目前amd64的软件包相对于x86相对要少一些,但主要的功能包基本上也齐。
下面我们安装OpenCV
sudo apt-get install ros-kinetic-vision-opencv
其他与opencv相关的包有:
~$ apt-cache search ros-kinetic | grep opencv
ros-kinetic-ecto-opencv - Ecto bindings for common opencv functionality.
ros-kinetic-opencv-apps - The opencv_apps package, most of code is taken from https://github.com/Itseez/opencv/tree/master/samples/cpp
ros-kinetic-opencv-candidate - Experimental OpenCV functions
ros-kinetic-opencv3 - OpenCV 3.x
ros-kinetic-swri-opencv-util - swri_opencv_util
ros-kinetic-vision-opencv - Packages for interfacing ROS with OpenCV, a library of programming functions for real time computer vision.
4. 编译Guidance
Guidance是DJI生产的一款5个双目摄像头+超声波的系统,可用于无人机避障和目标跟踪,详细介绍可参考:developer.dji.com
代码下载地址:
https://github.com/dji-sdk/Guidance-SDK-ROS
编译前要安装几个必要的库,否则会报错:
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install libopencv-dev
sudo apt-get install libyaml-cpp-dev
修改编译时的opencv版本
在编译时出现以下错误:
CMake Error at Guidance-SDK-ROS/CMakeLists.txt:11 (find_package):
Could not find a configuration file for package "OpenCV" that is compatible
with requested version "2".
The following configuration files were considered but not accepted:
/opt/ros/kinetic/share/OpenCV-3.1.0-dev/OpenCVConfig.cmake, version: 3.1.0
/opt/ros/kinetic/share/OpenCV-3.1.0-dev/OpenCVConfig.cmake, version: 3.1.0
这是因为在ROS的Indigo和Jade版本中默认的OpenCV2
需要在CMakeLists.txt手动修改对opencv2的依赖:
find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(my_awesome_library ${OpenCV_LIBRARIES})
在ROS的Kinetic版本中,默认使用openCV3,如果你不希望用OpenCV3,可以修改为:
find_package(OpenCV 2 REQUIRED)
最后一个问题是giuhub上的libDJI_guidance.so文件目前不支持arm64,导致编译无法进行。所以只能暂时告一段落。我已把问题提交给guidance开发者,得到的答复是后面会开放出libDJI_guidance的源码,可以自行编译。所以只能先等等了。
没办法只好拿出RGBD摄像头,下一步准备试一下ORB-SLAM。