当前位置:网站首页>ROS notes (10) - Launch file startup
ROS notes (10) - Launch file startup
2022-06-29 14:57:00 【wohu1104】
1. background
Multiple nodes may need to be started in a program , such as :ROS Built in Little Turtle case , If you want to control tortoise movement , To start multiple windows , To start, respectively, roscore、 Tortoise interface node 、 Keyboard control node . If you call every time rosrun Start one by one , Obviously inefficient , How to optimize ?
The official optimization strategy is launch file ( adopt xml File to achieve multi node configuration and startup ), You can start more than one at a time ROS node , And it can start automatically ROS Master.
2. Realization
2.1 Create Feature Pack
$ catkin_create_pkg launch
Created file launch/package.xml
Created file launch/CMakeLists.txt
Successfully created files in /home/wohu/project/ros/ros_demo/src/launch. Please adjust the values in package.xml.
2.2 add to launch file

launch.yaml The contents of the document
<launch>
<node pkg="turtlesim" type="turtlesim_node" name="t1"/>
<node pkg="turtlesim" type="turtle_teleop_key" name="key1" />
</launch>
2.3 function
$ roslaunch launch launch.yaml
... logging to /home/wohu/.ros/log/e021148a-f125-11ec-92ca-00e070ce7d11/roslaunch-wohu-pc-17490.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://wohu-pc:35733/
SUMMARY
========
PARAMETERS
* /rosdistro: melodic
* /rosversion: 1.14.13
NODES
/
key1 (turtlesim/turtle_teleop_key)
t1 (turtlesim/turtlesim_node)
auto-starting new master
process[master]: started with pid [17500]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to e021148a-f125-11ec-92ca-00e070ce7d11
process[rosout-1]: started with pid [17512]
started core service [/rosout]
process[t1-2]: started with pid [17516]
process[key1-3]: started with pid [17520]
3. launch File syntax

3.1 launch label
<launch> All labels are launch The root tag of the file , Act as a container for other labels , All other labels are launch The children of .
3.2 node label
<node> Labels are used to specify ROS node , Is the most common label , It should be noted that : roslaunch Orders do not guarantee compliance with node Start the node in the declared order ( The startup of nodes is multi process ).
Properties are as follows :
pkg=“ Package name ”
The package to which the node belongs
type=“nodeType”
Node type ( An executable with the same name )
name=“nodeName”
The name of the node ( stay ROS The name of the node in the network topology )
args=“xxx xxx xxx” ( Optional )
Pass parameters to node
machine=“ machine name ”
Start the node on the specified machine
respawn=“true | false” ( Optional )
If the node exits , Whether to restart automatically
respawn_delay=" N" ( Optional )
If respawn by true, So delay N Start the node in seconds
required=“true | false” ( Optional )
Whether the node must , If true, Then, if the node exits , Will kill the whole roslaunch
ns=“xxx” ( Optional )
In the specified namespace xxx Start node
clear_params=“true | false” ( Optional )
Before starting , Delete all parameters of the node's private space
output=“log | screen” ( Optional )
Log sending destination , It can be set to log Log files , or screen The screen , The default is log
Child labels
env Environment variable Settings
remap Remap node name
rosparam Parameter setting
param Parameter setting
3.3 include label

include The tag is used to put another xml Format launch Import the file into the current file
attribute
file=“$(find Package name )/xxx/xxx.launch”
File path to include
ns=“xxx” ( Optional )
Import the file in the specified namespace
Child labels
env Environment variable Settings
arg Pass parameters to the included file
3.4 remap label

For topic renaming
from=“xxx”
Original topic nameto=“yyy”
Target name

3.5 param label

<param> The tag is mainly used to set parameters on the parameter server , The parameter source can be in the tag through value Appoint , It can also be loaded through external files , stay <node> In the label , Equivalent to private namespace .
attribute
name=“ Namespace / Parameter name ”
Parameter name , Can contain namespaces
value=“xxx” ( Optional )
Define parameter values , If omitted here , You must specify an external file as the parameter source
type=“str | int | double | bool | yaml” ( Optional )
Specify parameter type , If not specified ,roslaunch Will try to determine the parameter type , The following rules :
If you include ‘.’ The number of is not parsed as a floating point type , Otherwise, it is an integer
“true” and “false” yes bool value ( Case insensitive )
Others are strings

3.6 rosparam label
<rosparam> Labels can be from YAML File import parameters , Or export parameters to YAML file , It can also be used to delete parameters ,<rosparam> Tag in <node> Label is treated as private .
attribute
command=“load | dump | delete” ( Optional , Default load)
load 、 Export or delete parameters
file=“$(find xxxxx)/xxx/yyy…”
Loaded or exported to yaml file
param=“ Parameter name ”
ns=“ Namespace ” ( Optional )
3.7 group label
<group> Tags can group nodes , have ns attribute , Nodes can belong to a namespace
attribute
ns=“ The name space ” ( Optional )
clear_params=“true | false” ( Optional )
Before startup , Delete all parameters of the group namespace ( Use with caution … This function is dangerous )
Child labels
except launch Labels other than labels
3.8 arg label

<arg> Tags are used to dynamically transfer parameters , It's like a function parameter , Can enhance launch Flexibility of documents .
attribute
name=“ Parameter name ”
default=“ The default value is ” ( Optional )
value=“ The number ” ( Optional )
You can't be with default Coexist
doc=“ describe ”
Parameter description
Example :
- launch Implementation of file parameter passing Syntax ,hello.lcaunch
<launch>
<arg name="xxx" />
<param name="param" value="$(arg xxx)" />
</launch>
- Command line call launch The ginseng
roslaunch hello.launch xxx:= value
边栏推荐
- Ogg synchronize MySQL data to greenplus
- 知乎热议:一个程序员的水平能差到什么程度?
- 阿里云体验有奖:使用PolarDB-X与Flink搭建实时数据大屏
- 信息学奥赛一本通1000:入门测试题目
- Is 100W data table faster than 1000W data table query in MySQL?
- PostgreSql学习(基于菜鸟课程)
- phpcms打开后台首页时向官网发送升级请求觉得卡怎么办?
- 网易严选离线数仓质量建设实践
- What should phpcms do when it sends an upgrade request to the official website when it opens the background home page?
- CKS CKA CKAD 将终端更改为远程桌面
猜你喜欢
![[practical chapter of correlation analysis] why can't Bi software do correlation analysis](/img/f2/4f99deb63b1beffae90b8a1fb270d1.png)
[practical chapter of correlation analysis] why can't Bi software do correlation analysis

phpcms打开后台首页时向官网发送升级请求觉得卡怎么办?

【Try to Hack】vulnhub DC2

Opengauss community establishes sig knowledgegraph

Illustration of Ctrip quarterly report: net revenue of RMB 4.1 billion has been "halved" compared with that before the outbreak

PostgreSql学习(基于菜鸟课程)

Wei long updated the prospectus: the annual revenue of 4.8 billion founder liuweiping has a strong family color

The first lesson on cloud - how easy is it to build a small broken station? The old driver of cloud computing will take you one hour to finish it

MySQL中100w数据表比1000w数据表查询更快吗?

熊市慢慢,Bit.Store提供稳定Staking产品助你穿越牛熊
随机推荐
How word automatically generates directories
MySQL中100w数据表比1000w数据表查询更快吗?
Jet hydrogen technology rushes to the scientific innovation board: SAIC Group is the major shareholder to raise 1.06 billion yuan
Draw a slash on a plane coordinate
go学习(四、面向接口)
MCS:离散随机变量——Hyper Geometric分布
Practical application cases of drives
VQA needs not only pictures, but also external knowledge! University of Washington & Microsoft proposed revive, using gpt-3 and wikidata to help answer questions
[QT tutorial] QPushButton key and double click effect
Huashu high tech rushes to the scientific innovation board: the actual controller xuxiaoshu and his son, who plan to raise 660million yuan, are both American nationals
synchronized 与多线程的哪些关系
PostgreSql学习(基于菜鸟课程)
Uncover the secret! Pay attention to those machines under the membership system!
类模板案例-【数组类封装】
Chinese garbled code output from idea output station
Huali biology rushes to the scientific innovation board: the annual revenue is RMB 226million and it is planned to raise RMB 800million
【Try to Hack】vulnhub DC2
Differences between @resource and @autowired annotations automatically injected:
What should phpcms do when it sends an upgrade request to the official website when it opens the background home page?
Uniapp problem list and experience