ROS Kinetic(ubuntu16.04) 安装

官方安装教程 http://wiki.ros.org/cn/kinetic/Installation/Ubuntu

  1. 添加源
# 国外源
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

# 国内源-清华镜像
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
  1. 添加秘钥
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116
sudo apt-get update

报如下错

W: GPG error: http://mirrors.ustc.edu.cn/ros/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
W: The repository 'http://mirrors.ustc.edu.cn/ros/ubuntu xenial InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.

解决办法:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
sudo apt-get update

  1. 安装ros
sudo apt-get install ros-kinetic-desktop-full

安装完成后,可以用下面的命令来查看可使用的包
apt-cache search ros-kinetic

如果想安装个别功能包,请使用如下命令。
sudo apt-get install ros-kinetic-<包名称>

  1. 初始化
sudo rosdep init
Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run

	rosdep update

可能报如下错误
ERROR: cannot download default sources list from: https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
可能是源未设置对,就直接安装,解决办法:卸载重装
sudo apt-get remove ros-*

按提示,更新rosdep

rosdep update
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-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Add distro "dashing"
Add distro "eloquent"
Add distro "foxy"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Add distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
updated cache in /home/<you_account>/.ros/rosdep/sources.cache

  1. 安装rosinstall
# 这是安装ROS各种功能包的程序。很有用的工具,务必安装
sudo apt-get install python-rosinstall
  1. 环境变量设置
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
  1. 测试运行ros
roscore

... logging to /home/bing/.ros/log/1a27860c-3e11-11ea-8ac5-e4f89cf2cb32/roslaunch-bing-Lenovo-Y50p-70-28894.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://bing-Lenovo-Y50p-70:39251/
ros_comm version 1.12.14


SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES

auto-starting new master
process[master]: started with pid [28905]
ROS_MASTER_URI=http://bing-Lenovo-Y50p-70:11311/

setting /run_id to 1a27860c-3e11-11ea-8ac5-e4f89cf2cb32
process[rosout-1]: started with pid [28918]
started core service [/rosout]
  1. 查看环境变量
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_PYTHON_VERSION="2"
declare -x ROS_ROOT="/opt/ros/kinetic/share/ros"
declare -x ROS_VERSION="1"
  1. 打开一个小乌龟应用
    分别打开两个终端ctrl+alt+t
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
发布了88 篇原创文章 · 获赞 3 · 访问量 5479

猜你喜欢

转载自blog.csdn.net/youlinhuanyan/article/details/104078819