ROS入门记录 [2]

这篇ROS入门教程涵盖了安装配置环境、ROS文件系统导航、创建ROS包、构建包、理解节点、话题、服务和参数,以及使用rqt_console和roslaunch工具。介绍了package.xml和CMakeLists.txt的重要性,ROS节点的功能,如何使用rostopic和rosrun,以及ROS服务和参数的使用。最后讲解了rqt_console的输出和roslaunch的用法。
摘要由CSDN通过智能技术生成

Tutorial——Beginner Level 1

1. Installing and Configuring Your ROS Environment

ROS入门记录1

2. Navigating the ROS Filesystem

$ rospack find roscpp
$ roscd roscpp
$ rosls roscpp

# rospack = ros + pack(age)
# roscd = ros + cd
# rosls = ros + ls

3. Creating a ROS Package

a catkin Package consist of :

  • package.xml. That package.xml file provides meta information about the package.
  • CMakeLists.txt. There can be no more than one package in each folder.

This means no nested packages nor multiple packages sharing the same directory. Most simplest package’s instructure might be like this:

my_package/
  CMakeLists.txt
  package.xml

A trivial workspace might look like this:

workspace_folder/        -- WORKSPACE
  src/                   -- SOURCE SPACE
    CMakeLists.txt       -- 'Toplevel' CMake file, provided by catkin
    package_1/
      CMakeLists.txt     -- CMakeLists.txt file for package_1
      package.xml        -- Package manifest for package_1
    ...
    package_n/
      CMakeLists.txt     -- CMakeLists.txt file for package_n
      package.xml        -- Package manifest for package_n

catkin_create_pkg

$ cd catkin_ws/src

catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
# catkin_create_pkg <package_name> [depend1] [depend2] [depend3]

$ cd ../catkin_ws
$ catkin_make

$ . ~/catkin_ws/devel/setup.bash

When using catkin_create_pkg earlier, a few package dependencies were provided. These first-order dependencies can now be reviewed with the rospack tool.

$ rospack depends1 beginner_tutorials 

std_msgs
rospy
roscpp

# 初次使用会报错,会建议你 sudo rosdep init

如果使用了proxy网络代理

# sudo rosdep init  will report error 
# rosdep init  ERROR: cannot download default sources list from
# 需要sudo使用 -E 来保留 环境变量配置 ,如之前设置过的 export http_proxy=x:y

$ sudo -E rosdep init

$ rosdep update
$ rospack depends1 beginner_tutorials  # 可得到上述相应依赖包

$ roscd beginner_tutorials
$ vi package.xml

<package>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值