ROS学习手记 - 1了解并安装ROS+创建ROS_Package


ROS学习手记:

开始之前:

     先看了 《认识ROS操作系统(2015版)》,了解了ROS的基本概念。
     这里补充一点ROS的发展历程,以便了解catkin的由来,及willow garage公司与ROS的关系:
    ROS was originally developed in 2007 under the name switchyard by the Stanford Artificial Intelligence Laboratory in support of the Stanford AI Robot STAIR (STanford AI Robot) [6][7] project.From 2008 until 2013, development was performed primarily at Willow Garage, a robotics research institute/incubator. During that time, researchers at more than twenty institutions collaborated with Willow Garage engineers in a federated development model.[8][9]
    In February 2013, ROS stewardship transitioned to the Open Source Robotics Foundation.[10] In August 2013, a blog posting[11] announced that Willow Garage would be absorbed by another company started by its founder, Suitable Technologies. The support responsibilities for the PR2 created by Willow Garage were also subsequently taken over by Clearpath Robotics.[12] (https://en.wikipedia.org/wiki/Robot_Operating_System)


提纲:一台Ubuntu的PC主要要做以下两方面的工作

* 安装 ros-hydro-desktop-full

               ref: http://wiki.ros.org/hydro/Installation/Ubuntu

* 配置workspace (catkin_ws/ rosbuild_ws/ 理解overlay)

  •   配置 catkin_ws (所有catkin类型包放在 ~/catkin_ws/src/ 目录下编译或者运行)
  • * 配置 rosbuild_ws (所有rosbuild类型包放在 ~/rosbuild_ws/sandbox/ 目录下编译或者运行)
  • * 配置 overlay: rosbuild_ws -> catkin_ws -> hydro

                ref: http://wiki.ros.org/catkin/Tutorials


下面我就具体展开。读者可以直接看上面俩链接步步操作还好点。

1. ROS 的安装,

      ROS官方Tutorial里的 Installing and Configuring Your ROS Environment比较繁琐。我们采用虚拟机搭载Ubuntu_for_ROS的方式。

      具备了虚拟机使用经验的同学可以搜“ Ubuntu for ROS”进行下载 .iso 文件在虚拟机里安装。笔者使用的是VirtualBox作为虚拟机工具。这里就不多说了。
      需要注意的是,ROS有很多版本,对应Ubuntu不同的版本,别搞错了。 我用的 Ubuntu12.04 + ROS_Hydro(ubuntu12.04-i386-ros-exbot-h2-140520.iso)

      运行如下命令可看ROS的Package Path是否配置完毕。
      >> echo $ROS_PACKAGE_PATH


  2. 熟悉一下ROS的文件系统命令行

       roscd, rosls, rospack 等命令的熟悉:

  3. ROS Package

开始之前,ROS有这几个概念需要了解:
  >>catkin - catkin is the official build system of ROS(相当于GNC Make,CMake这样的编译链接系统). The name catkin comes from the tail-shaped flower cluster found on willow trees -- a reference to Willow Garage where catkin was created.(http://wiki.ros.org/catkin/conceptual_overview)
  >>Packages - ROS的基本组织单位,为了很好的定制和重用,包含库、数据集、节点、配置文件、第三方软件或任何有用的模型。Packages are the most atomic unit of build and the unit of release.
  >>Metapackages - 
  >>Manifest
  >>msg
  preference: http://wiki.ros.org/Packages
  >>srv
-- Create an empty catkin workspace
   参考: http://wiki.ros.org/catkin/Tutorials/create_a_workspace

   我装的ubuntu for ROS应该是已经source了/opt/ros/hydro/setup.bash,否则要运行:
     $ source /opt/ros/hydro/setup.bash
   开始来create a catkin workspace(我装的ubuntu for ROS应该是已经建立了workspace):
     $ mkdir -p ~/catkin_ws/src
     $ cd ~/catkin_ws/src
     $ catkin_init_workspace
   但是我的这个路径下已经有了文件了:
       exbot@ubuntu:~/catkin_ws/src$ ls
       CMakeLists.txt  exbot_xi
       cd ~/catkin_ws/src/exbot_xi && ls
       exbotxi_bringup      exbotxi_example  exbotxi_rviz    README.md
       exbotxi_description  exbotxi_nav      exbotxi_teleop


   看样子已经有很多包了,所以我就没搞 catkin_init_workspace

4. 创建Package

   跟着这个教程一步步来:http://wiki.ros.org/ROS/Tutorials/CreatingPackage
   一个catkin Package包含的东西:1. package.xml file; 2.CMakeLists.txt; 3.其他文件. 
   Package不共用一个文件夹,nest(嵌套)也不行。


   现在我们来Create一个Package:
    $  cd ~/catkin_ws/src
    $  catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
       Created file beginner_tutorials/CMakeLists.txt
       Created file beginner_tutorials/package.xml
       Created folder beginner_tutorials/include/beginner_tutorials
       Created f

  • 5
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值