Ubuntu14.04环境下ROS indigo 安装

时间:2021-08-30 06:30:06

    从去年7月份左右开始接触ROS,一直都想整理一些东西出来和大家分享以下.可惜一直没执行下去.静不下心来整理,而且说实话,本人学的

也不怎么样.权作学习笔记.

    其实很多都是直接从网站上面照着抄下来的.ROS网站上面资料非常齐全,


ROS 安装:

    ROS安装其实很简单.按照如下网站中的步骤,一步一步执行即可.
    如果你想从源码编译安装,可参考参考网站2(不推荐)

参考网站1:
    http://wiki.ros.org/indigo/Installation/Ubuntu
参考网站1:
    http://wiki.ros.org/indigo/Installation/Source

Environment setup:

1. It's convenientif the ROS environment variables are automatically added to your bashsession every time a new shell is launched:


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

$ source ~/.bashrc


2. If you just wantto change the environment of your current shell, you can type:


$ source/opt/ros/indigo/setup.bash


Cteate a ROS Workspace

1. Creating a new workspace
    The following command creates a new workspace in ~/workspace/ROS which extends the set of packages install in /opt/ros/indigo

    $ rosws init ~/workspace/ROS /opt/ros/indigo
    $ source ~/workspace/ROS/setup.bash
    (该方式配置,每次打开终端均需配置该环境.如果想每次自动加载,参考环境配置的方式)
    rosws命令是rosinstall package中命令.如果没有安装,输入下诉命令安装
    $ sudo apt-get install python-rosinstall

2. Creating a sandbox directory for new packages.
    New packages need to be put in a path that is in the variable ROS_PACKAGE_PATH.All directories that are managed by rows, i.e. that have been added using rosws are automatically added to the ROS_PACKAGE_PATH when the file setup.bash of the corresponding workspace is sourced.

    $ mkdir ~/workspace/ROS/theFirstPackage
    $ rosws set ~/workspace/ROS/theFirstPackage

3. Confirmation
    To confirm that your package path has been set, echo the ROS_PACKAGE_PATH variable.

    $ echo $ROS_PACKAGE_PATH
You should see something similar to:
/home/burial/workspace/ROS/camera:/opt/ros/indigo/share:/opt/ros/indigo/stacks

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

1. 在Terminal中输入下诉命令.我的理解是,该命令是初始化ROS环境,全局参数,以及每个节点注册等工作.
    $ roscore

Ubuntu14.04环境下ROS indigo 安装

2. 再打开一个Terminal,输入下诉命令.开启一个小乌龟界面.

    $ rosrun turtlesim turtlesim_node

Ubuntu14.04环境下ROS indigo 安装



3. 再打开一个Terminal,输入下诉命令.接受键盘输入,控制小乌龟移动.

    $ rosrun turtlesim turtle_teleop_key

4. 选中最后打开的Terminal,键盘按下上下左右按键,可看到控制小乌龟移动.

5. 再打开一个Terminal,输入下诉命令,可以看到当前ROS nodes以及Topic等图形展示.

    $ rosrun rqt_graph rqt_graph

Ubuntu14.04环境下ROS indigo 安装

    由上图可见,左右两边矩形为ROS node,中间连线上是Topic名称.