ROS2 launch design doc

ROS 2 Launch 系统

本文整理并翻译自:ros2 launch system

roslaunch:这里特指ROS 1中的launch 系统。

前言

ROS 2中的 launch 系统负责帮助用户描述其系统的配置,然后按说明执行它。 系统的配置包括运行哪些程序,在何处运行它们,传递它们的参数以及ROS特定约定,这些约定通过为每个组件赋予不同的配置,可以轻松地在整个系统中重用组件。 另外,由于 launch 系统是负责执行用户进程的进程(或进程集),因此它负责监视由它启动的用户进程的状态,并报告并且响应这些进程的状态变化。

ROS 2 的launch系统作为ROS 1中roslaunch的继承者,我们在这里先对ROS 1的launch系统的知识进行一些补充和梳理。通过他们之间的相同点与不同点,深入了解ROS2 launch的作用与特点。

ROS 1中的 roslaunch

wiki中的描述如下:

roslaunch is a tool for easily launching multiple ROS nodes locally and remotely via SSH, as well as setting parameters on the Parameter Server. It includes options to automatically respawn processes that have already died. roslaunch takes in one or more XML configuration files (with the .launch extension) that specify the parameters to set and nodes to launch, as well as the machines that they should be run on.

我们可以总结出roslaunch在 ROS 1 中的主要作用:

  1. 启动节点(集);
  2. 通过SSH协议远程启动节点(集);
  3. 在parameter server上设定parameter;
  4. 自动重启那些死掉的进程;
  5. 节点描述、节点参数以及运行的位置都是基于静态和XML的。

在ROS 2的wiki中,对launch系统有更详细的解释:

roslaunch was designed to fit the ROS architecture of complexity via composition: write a simple system first, then combine it with other simple systems to make more complex systems. In roslaunch, this is expressed through several mechanisms:

roslaunch旨在通过组合来适配复杂的ROS架构:通过一些简单的系统组合成一个复杂的系统,具体来说,在roslaunch,有以下几种机制实现这一目的:

<include>s: you can easily include other .launch files and also assign them a namespace so that their names do not confict with yours.

通过<include>s我们可以使用其他的.launch文件,同时支持namespace,来避免命名的冲突。

' 's: you can group together a collection of nodes to give them the same name remappings.

可以将nodes组合到一个集合里,可以给这些节点重映射一个相同的名字(多节点之间组成的构件应该就是这样处理的)。

aliased' 's: you can separate machine definitions and node definitions into separate .launch files and use aliases to define which machines get used at runtime. This allows you to reuse the same node definitions for multiple robots. For example, instead of saying that a laser_assembler runs on ‘foo.willowgarage.com’, you can say that it runs on the ‘tilt-laser’ machine. The machine definitions then take care of which host is the ‘tilt-laser’ machine.

我们推荐将机器和节点的.launch文件分开定义,并且可以使用别名来定义在运行时使用哪些机器。这样的好处是可以将相同的节点定义应用到不同的机器人上(注:使用别名可以使launch文件的可读性更好),例如我们可以说一个laser_assembler运行在“tilt-laser”主机上,不用说这个主机的全称,不妨是”foo.willowgarage.com“,而主机名解析的任务就交给machine launch文件去处理。

roslaunch also contains a variety of tools to help you write your .launch files as portably as possible. You can use the tag to specify environment variables that need to be set for a particular machine or node. The $(find pkg) syntax let you specify file paths relative to a ROS package, instead of specifying their location on a particular machine. You can also use the $(env ENVIRONMENT_VARIABLE) syntax within include tags to load in .launch files based on environment variables (e.g. MACHINE_NAME).

roslaunch还包含许多工具,可以帮助用户轻松地编写可移植的launch文件,可以使用<env>tag来指定针对特定计算机或者节点设置的环境变量,使用$(find pkg)语法指定相对于ROS package的相对文件路径,而不必指定他们在特定机器上的绝对路径,还可以将$(env ENVIRONMENT_VARIABLE)语法和<include>tag一起使用,实现根据环境变量加载launch文件。

我们可以看出,ROS 1中 roslaunch的设计目的和特点如下:

  1. 由简单的系统组成复杂的
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值