树莓派(raspberry pi 3b)安装ROS Kinetic Kame

1.概述

可以使用PIBOT提供镜像,预装了ROS Kinetic Kame,如果你想体验下安装过程,也可以先输入官方UBUNTU后再安装ROS

2.刷入pibot_ros_kinetic镜像

树莓派(raspberry pi 3b)安装ROS Kinetic Kame_第1张图片

PIBOT网盘中提供了相关工具与镜像,我们需要使用工具 Win32 Disk Mangaer及 ROS镜像

选择镜像和相应的盘符,点击 Write按钮,然后点一下 Yes确定操作,开始系统写入
树莓派(raspberry pi 3b)安装ROS Kinetic Kame_第2张图片

等待安装完成即可
树莓派(raspberry pi 3b)安装ROS Kinetic Kame_第3张图片

刷完看到容量变小了,不用担心,正常情况
用户名密码都是pibot

3 逐步安装ROS

使用PIBOT提供的镜像可以跳过该步骤,同时实际上面生成的镜像就是执行了以下步骤而已

3.1下载ubuntu

从百度网盘或者官网下载Ubuntu mate或者Lubuntu

3.2 刷入ubuntu

同2刷入镜像

3.3安装ROS

使用PIBOT ROS安装脚本即可完成ROS的一键安装

cd ~/pibot_ros
./pibot_install_ros.sh
source ~/.bashrc

脚本见文末附录

4.测试

安装完成,运行roscore可以看到下面输出即可标识完成ros安装

树莓派(raspberry pi 3b)安装ROS Kinetic Kame_第4张图片

5.交换分区的设置

5.1 查看交换分区

free -m

** 如果显示下图,标识已经有2G的交换空间,无需再次设置**


5.2 创建交换分区

5.2.1 创建交换分区

sudo mkdir /opt/image
cd /opt/image/
sudo touch swap
sudo dd if=/dev/zero of=/opt/image/swap bs=1024 count=2048000
sudo mkswap /opt/image/swap  
sudo swapon /opt/image/swap  

dd命令执行时间较长

再次查看交换分区
free -m

5.2.2 设置重启生效

sudo vim /etc/fstab
最后行添加
/opt/image/swap /swap swap defaults 0 0

重启后再次查看
free -m

6.编译PIBOT驱动

6.1拷贝源码包至树莓派

树莓派(raspberry pi 3b)安装ROS Kinetic Kame_第5张图片

6.2解压编译

tar jxvf pibot_ros_ws.tar.bz2
cd pibot_ros/ros_ws/
catkin_make
树莓派(raspberry pi 3b)安装ROS Kinetic Kame_第6张图片

pibot_install_ros.sh

#!/bin/bash

sudo sh -c 'echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
sudo apt-get update

code_name=$(lsb_release -sc)

if [ "$code_name" = "trusty" ]; then
    ros_version="indigo"
elif [ "$code_name" = "xenial" ]; then
    ros_version="kinetic"
else
    echo "PIBOT not support "$code_name
    exit
fi

echo "ros:" $ros_version

sudo apt-get -y --allow-unauthenticated  install ros-${ros_version}-ros-base ros-${ros_version}-slam-gmapping ros-${ros_version}-navigation ros-${ros_version}-xacro ros-${ros_version}-yocs-velocity-smoother ros-${ros_version}-robot-state-publisher ros-${ros_version}-joint-state-publisher ros-${ros_version}-teleop-twist-* ros-${ros_version}-rviz ros-${ros_version}-control-msgs ros-${ros_version}-kdl-parser-py ros-${ros_version}-tf2-geometry-msgs ros-${ros_version}-hector-mapping ros-${ros_version}-slam-karto ros-${ros_version}-hector-geotiff ros-${ros_version}-hector-trajectory-server ros-${ros_version}-usb-cam ros-${ros_version}-image-transport ros-${ros_version}-image-transport-plugins ros-${ros_version}-astra-launch ros-${ros_version}-astra-camera ros-${ros_version}-depthimage-to-laserscan ros-${ros_version}-openni2*

read -s -n1 -p "install ros gui tools?(y/N)" 

if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
    sudo apt-get -y --allow-unauthenticated  install ros-${ros_version}-rviz ros-${ros_version}-rqt-reconfigure
fi

你可能感兴趣的:(树莓派(raspberry pi 3b)安装ROS Kinetic Kame)