pcduino上编译安装ros

3 篇文章 0 订阅

原来用别人的博客写的,现在全搬过来

参考:1 ros官网的arm安装包安装: http://wiki.ros.org/groovy/Installation/UbuntuARM

2源代码编译安装: http://wiki.ros.org/groovy/Installation/Source

3 http://wiki.ros.org/groovy/Installation/Linaro/SourceLinaro系统上源代码编译ros

4 http://wiki.ros.org/groovy/Installation/Raspbian/Source树莓派编译ros 

一、pcduino的sd卡镜像

http://yuanboshe.github.io/blog/2013-07-setup_pcduino_for_ros.html

自带的内存太小,必须在sd卡上安装,我的是16gsd

1. Kernel   2 sd卡上刷Lubuntu系统  3 sd卡扩容 4 更新
制作sd卡镜像,dd命令不识别是否使用,所以我的镜像有16g,时间长,很多不必要的浪费,网上有方法减少镜像大小,如分成fat32utf格式的两个盘,ggzip工具等

为了以防万一,我是16g的无压缩的img文件

参考http://my.oschina.net/daijy/blog/112051

sudo dd if=/dev/sdbof=~/pcDuino.img

sd卡复制16g到硬盘,时间很长

二、chroot环境建立

最好是在chroot环境下,节省时间,sd卡下直接编译问题:

1)耗时 

2pcl编译时显示内存不足

参考这段


parted gumstix.img

(parted) unit                                                             

Unit?  [compact]? B                                                       

(parted) print                                                            

Model:  (file)

Disk /home/frk1pal/gumstix/gumstix.img: 13958643712B

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number  Start      End           Size          Type     File system  Flags

 1      32256B     54525439B     54493184B     primary  fat32        boot, lba

 2      54525952B  13958643711B  13904117760B  primary  ext3

(parted) quit

挂载
sudo mount -o loop,offset=54525952 gumstix.img /mnt

sudo mount -o bind /proc /mnt/proc

sudo mount -o bind /dev /mnt/dev

sudo mount -o bind /dev/pts /mnt/dev/pts

sudo mount -o bind /sys /mnt/sys

 

编译器

sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/

sudo chroot /mnt


dns设置
dpkg --configure -a
printf "nameserver 8.8.8.8" > /etc/resolv.conf
ping google.com
 
apt-get update成功则证明一切都设置好了

三、apt-get安装

apt-getinstall安装最简单,但由于依赖库冲突问题,许多包不存在,需要自己编译

参考http://wiki.ros.org/groovy/Installation/UbuntuARM进行apt-get安装最基本的包ros_common,ros_base


sudo sh -c 'echo "deb http://packages.ros.org/ahendrix-mirror/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list'

wget http://packages.ros.org/ros.key -O - | sudo apt-key add -

sudo apt-get update

sudo apt-get install ros-groovy-ros-base


apt-cache search ros-groovy命令可以查看有哪些已编译好的包
 
sudo apt-get install python-rosdep

sudo rosdep init

rosdep update

sudo apt-get install python-rosinstall
 

四、wet源代码编译安装

主要参考http://wiki.ros.org/groovy/Installation/Source

source /opt/ros/groovy/setup.bash

4.1 安装必要的工具

sudo apt-get install python-rosdep python-rosinstall-generator python-wstool build-essential


4.2下载源代码
生成.rosinstall,指定需要下载的包,分wet包和dry包,wet包用catkin编译,dry包用rosmake编译,因为还没有完全移植到catkin上,目前比较费劲,以后会好的

wet
rosinstall_generator robot --rosdistro groovy --deps --wet-only > groovy-robot-wet.rosinstall

wstool init -j8 src groovy-robot-wet.rosinstall


根据groovy-robot-wet.rosinstall的内容,在src文件夹中生成.rosinstall文件,其中包含需要下载的网址和版本信息,下载
下面这些是我根据自己的需要下载的
rosinstall_generator mobile --rosdistro groovy --deps --wet-only > groovy-mobile-wet.rosinstall

rosinstall_generator perception --rosdistro groovy --deps --wet-only > groovy-perception-wet.rosinstall

rosinstall_generator openni_launch --rosdistro groovy --deps --wet-only > groovy-openni_launch-wet.rosinstall

rosinstall_generator turtlebot --rosdistro groovy --deps --wet-only > groovy-turtlebot-wet.rosinstall


wstool merge groovy-mobile-wet.rosinstall 是在原来的基础上加入mobile,只更新新加入的包,src/rosinstall中可以检查

可能有重复,为了避免不必要的编译,可以先自己检查生成的.rosinstall文件,去掉已经安装好的,对于可以使用apt-get安装的尽量使用apt-get安装,source安装真的是费力不讨好

第一次使用wstool init工具,以后可以根据需要随机更改.rosinstall,避免不必要的重复安装

4.3 检查依赖包是否完全安装

检查依赖包并安装,有错误也继续安装其他包

rosdep install --os=ubuntu:precise --from-paths src --ignore-src --rosdistro groovy -yr
检查依赖包
rosdep check --os=ubuntu:precise --from-paths src --ignore-src --rosdistro groovy

检查哪些包依赖出错?
find -type f -name "*.xml" |xargs grep "xxx"

对于自己通过源代码/tar.gz等编译安装的包,rosdep不识别,rosdep只识别apt-get或者dpkg安装的包,没有办法,可在package.xml文件中将依赖包所在的行去掉

4.3.1 源代码安装依赖包

yaml-cpp包  sudo apt-get install libyaml-cpp-dev

opencv包 sudo apt-get install libopencv-dev


(1)Collada包

'moblie' perception都需要,从源安装 collada-domsource http://sourceforge.net/projects/collada-dom/files/latest/download

$ sudo apt-get install libxml2-dev

$ mkdir /opt/ros/collada

$ cd /opt/ros/collada

  {download the collada source from the above link and put it in this directory}

$ tar -xf collada*; rm collada*tgz; cd collada*; mkdir build; cd build

$ cmake .. ; make -j1; sudo make install

(2)openni包 
(3)PCL
vimsrc/pcl/cmake/pcl_find_sse.cmake  去掉-march=native

Set endian

/commentMarcus: My ARMboard was correctly detected to use little endian.

vim src/pcl/io/include/pcl/io/ply/byte_order.h  


设置if... udif...else...
,将最后一种可能else下,#error替换成#define PLY_LITTLE_ENDIAN 

4.3.2 安装包

sudo ./src/catkin/bin/catkin_make_isolated --install --install-space /opt/ros/groovy


最好指定安装地方--install-space /opt/ros/groovy,这样编译好之后就可以删掉源代码包了,否则太占sd卡空间

这一步很耗时,尤其是pcl的安装。寻找安装依赖包的时候容易卡住,只好重新来,只要寻找好,开始安装后则一般不会在寻找安装包时卡住了

4.4 dry源代码下载,编译,安装

ros_ws包中,使用rosws init初始化

生成.rosinstall,包含了需要下载的代码和地址,一定要自己检查一遍,去掉不必要的安装
rosinstall_generator mobile --rosdistro groovy --deps --dry-only > groovy-mobile-dry.rosinstall

rosinstall_generator perception --rosdistro groovy --deps --dry-only > groovy-perception-dry.rosinstall

rosinstall_generator openni_launch --rosdistro groovy --deps --dry-only > groovy-openni_launch-dry.rosinstall

rosinstall_generator turtlebot --rosdistro groovy --deps --dry-only > groovy-turtlebot-dry.rosinstall


rosws merge groovy-mobile-dry.rosinstall 是在原来的基础上加入mobile,只更新新加入的包,.rosinstall中可以检查
rosws update下载

最后需要自己编译的只有一些laser包,navigation包,slam_gmapping,turtlebot

sourcesetup.bash

rosmake-a 

我没有找到安装到/opt/ros/groovy的命令,只能就放在ros_ws下了,当成自己的包来用,记得将setup.bash写入.bashrc

也可以将源代码包拷贝到/opt/ros/groovy/stacks下编译安装

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值