ROS安装并运行小乌龟

镜像选择:

2. ROS kinetic安装与使用


爲了保證安裝速度,請選擇國內鏡像如下:ustc鏡像

2.1 设置安装源

ROS Kinetic只支持Wily(15.10)Xenial(16.04)对应内核分别为4.2和4.4,其他版本需要编译安装不支持直接deb软件源安装,

使用下面命令:

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

2.2 设置keys

~$ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116

Executing: /tmp/tmp.vZcRo5lOC8/gpg.1.sh --keyserver

hkp://ha.pool.sks-keyservers.net:80
--recv-key
0xB01FA116

2.3 安装

~$ sudo apt-get update

~$ sudo apt-get install ros-kinetic-desktop-full

安装功能包:

~$ sudo apt-get install ros-kinetic-PACKAGE

例如:

~$ sudo apt-get install ros-kinetic-slam-gmapping

查找在kinetic中可以使用的功能包:

~$ apt-cache search ros-kinetic

2.4 初始化


~$ sudo rosdep init

Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run

    rosdep update

~$ 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.yaml
Add distro "groovy"
Add distro "hydro"
Add distro "indigo"
Add distro "jade"
Add distro "kinetic"
updated cache in /home/relaybot/.ros/rosdep/sources.cache
 

2.5 环境配置

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

~$ source ~/.bashrc

注意当安装多个ROS发行版,使用kinetic需要用到下面命令:

~$ source /opt/ros/kinetic/setup.bash

2.6 安装rosinstall

~$ sudo apt-get install python-rosinstall

2.7 测试roscore

~$ roscore

安装ROS成功后,在Beginner Tutorials中有一个简单的示例程序.

  1. 在Terminal中运行以下命令: 
    $ roscore
  2. 新开一个terminal,运行以下命令,打开小乌龟窗口: 
    $ rosrun turtlesim turtlesim_node
  3. 新开一个terminal,运行以下命令,打开乌龟控制窗口,可使用方向键控制乌龟运动: 
    $ rosrun turtlesim turtle_teleop_key
  4. 选中控制窗口,按方向键,可看到小乌龟窗口中乌龟在运动。
  5. 新开一个terminal,运行以下命令,可以看到ROS的图形化界面,展示结点的关系: 
    $ rosrun rqt_graph rqt_graph
  6. 至此,测试完成,说明ROS安装没有问题。
  7.  

个人分类: 软件

相关热词: ubuntu和 在ubuntu ubuntu的 ubuntu时区 ubuntu中

猜你喜欢

转载自blog.csdn.net/LSG_Down/article/details/81451070