Ubuntu 16.04安裝ROS Kinetic詳細教程 | Tutorial to Install and Configure ROS Kinetic on

本文首發於我的博客kezunlin.me/post/e2780b…,歡迎閱讀!python

Tutorial to Install and Configure ROS Kinetic on Ubuntu 16.04.git

ROS release 	  ROS version	      Ubuntu version
2016.3	     ROS Kinetic Kame	Ubuntu 16.04(Xenial)/Ubuntu 15.10
複製代碼

Install Guide

quick commands

sudo sh -c '. /etc/lsb-release && echo "deb [arch=amd64] http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full

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

sudo rosdep init
rosdep update

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

# test
roscore
複製代碼

Notice

tinghua source

http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial
複製代碼

update source

sudo apt-get update
複製代碼

if we encouter errors when update source, we need to fix.github

e.g remove sougou source to fix errors.ubuntu

grep -r kylin .
./sources.list.d/sogoupinyin.list.save:deb http://archive.ubuntukylin.com:10006/ubuntukylin xenial main
./sources.list.d/sogoupinyin.list:deb http://archive.ubuntukylin.com:10006/ubuntukylin xenial main

rm ./sources.list.d/sogoupinyin.list
複製代碼

Configure ros source

ros offical(NOT RECOMMEND)

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
複製代碼

NOT RECOMMEND,when apt-get update, error will occur Hash Sum mismatchruby

ros china(RECOMMEND)

sudo sh -c '. /etc/lsb-release && echo "deb [arch=amd64] http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
複製代碼

ros-latest.listbash

deb [arch=amd64] http://mirrors.ustc.edu.cn/ros/ubuntu/ xenial main
複製代碼

Install ros

ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perceptionapp

sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full

#sudo apt-get install ros-kinetic-desktop
#sudo apt-get install ros-kinetic-ros-base

#sudo apt-get install ros-kinetic-<PACKAGE>
#sudo apt-get install ros-kinetic-slam-gmapping

#apt-cache search ros-kinetic
複製代碼

Initialize rosdep

Before you can use ROS, you will need to initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS.less

sudo rosdep init
rosdep update
複製代碼

will outputide

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index.yaml
Add distro "groovy"
Add distro "hydro"
Add distro "indigo"
Add distro "jade"
Add distro "kinetic"
Add distro "lunar"
updated cache in /home/kezunlin/.ros/rosdep/sources.cache
複製代碼

Environment setup

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
複製代碼

check ROS

env | grep ROS
export | grep ROS
declare -x ROSLISP_PACKAGE_DIRECTORIES=""
declare -x ROS_DISTRO="kinetic"
declare -x ROS_ETC_DIR="/opt/ros/kinetic/etc/ros"
declare -x ROS_MASTER_URI="http://localhost:11311"
declare -x ROS_PACKAGE_PATH="/opt/ros/kinetic/share"
declare -x ROS_ROOT="/opt/ros/kinetic/share/ros"
複製代碼

Dependencies for building packages

sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
複製代碼

Test install

roscore
複製代碼

outputpost

... logging to /home/kezunlin/.ros/log/b777db6c-ff85-11e8-93c2-80fa5b47928a/roslaunch-ke-17139.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ke:36319/
ros_comm version 1.12.14


SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES

auto-starting new master
process[master]: started with pid [17162]
ROS_MASTER_URI=http://ke:11311/

setting /run_id to b777db6c-ff85-11e8-93c2-80fa5b47928a
process[rosout-1]: started with pid [17175]
started core service [/rosout]
^C[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
複製代碼

Create Workspace

Create

Let's create and build a catkin workspace:

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make

ls .
build dist src
複製代碼

tree src folder

src/
└── CMakeLists.txt -> /opt/ros/kinetic/share/catkin/cmake/toplevel.cmake

0 directories, 1 file
複製代碼

tree devel folder

devel
├── env.sh
├── lib
├── setup.bash
├── setup.sh
├── _setup_util.py
└── setup.zsh

1 directory, 5 files
複製代碼

The catkin_make command is a convenience tool for working with catkin workspaces.

source devel setup

before source devel/setup.bash

env | grep ROS
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros
複製代碼

after source devel/setup.bash

env | grep ROS
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/home/kezunlin/catkin_ws/src:/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311
ROSLISP_PACKAGE_DIRECTORIES=/home/kezunlin/catkin_ws/devel/share/common-lisp
ROS_DISTRO=kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros
複製代碼

To make sure your workspace is properly overlayed by the setup script, make sure ROS_PACKAGE_PATH environment variable includes the directory you're in.

echo $ROS_PACKAGE_PATH
/home/kezunlin/catkin_ws/src:/opt/ros/kinetic/share
複製代碼

Reference

History

  • 2018/01/04: created.

Copyright

相關文章
相關標籤/搜索