ROS2-launch文件

launch文件介绍

我们在之前运行listener和talker两个节点的时候肯定注意到过一个问题,就是我们需要重复打开两个终端,运行两次,那如果我们做一个大型项目,里面包含了一万个节点,难道我们要打开一万个终端,输入一万个指令吗?这显然是浪费生命且D疼的一件事,这也是不可能出现在发展了这么久的ROS上的。于是乎,launch应运而生,他就可以很好地解决这个问题。
launch文件主要就是将所有要运行的节点信息写在该文件中,然后运行这个launch文件即可,这样就省去了极大的麻烦。当然官方文档对他的介绍是相当隆重的:

The launch system in ROS 2 is responsible for helping the user describe the configuration of their system and then execute it as described. The configuration of the system includes what programs to run, where to run them, what arguments to pass them, and ROS-specific conventions which make it easy to reuse components throughout the system by giving them each a different configuration. It is also responsible for monitoring the state of the processes launched, and reporting and/or reacting to changes in the state of those processes.

大概意思就是可以描述配置,可以运行配置,还可以监视配置,等。

创建launch文件

官方教程是新建功能包再进行教程,我们这里为了更好的运用,所以就利用上次的cpp_pubsub功能包了。首先在包目录下创建一个launch文件夹,再在文件夹内创建相应的launch文件。如图
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值