节点属性之节点元素的形式:
节点属性之显示属性:
节点属性之复位属性:
节点属性之命名空间:
名称重映射:
重映射是基于替换的思想,每个重映射包含一个原始名称和一个新名称。每当节点使用重映射中的原始名称时,ROS客户端库就会将它默默地替换成其对应的新名称。例如,运行一个 turtlesime 的实例, 如果想要把海龟的姿态数据发布到话题/tim 而不是/turtle1/pose,就可以使用如下命
令:rosrun turtlesim turtlesim_node turtle1/pose:=tim 通过启动文件的方式,只需在启动文件内使用重映射(remap)元素即可:<remap from=”turtle1/pose”to ”tim”/>
包含其他文件:
如果想在启动文件中包含其他启动文件的内容( 包括所有的节点和参数),可以使用包含(include)元素<include file=”$(find package-name)/launch-file-name”>由于直接输入路径信息很繁琐且容易出错,大多数包含元素都使用查找(find)命令搜索功能包的位置来替代直接输入路径。
启动参数:
roslaunch还支持启动参数,有时也简称为参数甚至args。在ROS中prarmeter和argument 是不同的,虽然翻译一样。parameter是运行中的ROS系统使用的数值,存储在参数服务器(parameter server)中,每个活跃的节点都可以通过 ros::param::get 函数来获取parameter的值,用户也可以通过rosparam来获得parameter的值而argument只在启动文件内才有意义他们的值是不能被节点直接获取的。
1运行launch文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52$ roslaunch package_name launch_file_name 举例:
root@yangkai04-Inspiron-3650:~/dev/rosbook/chapter3_tutorials/launch# pwd /root/dev/rosbook/chapter3_tutorials/launch root@yangkai04-Inspiron-3650:~/dev/rosbook/chapter3_tutorials/launch# ls example1_gdb.launch example2.launch example4_record.launch example1.launch example3.launch example6.launch example1_valgrind.launch example4_5.launch example7.launch root@yangkai04-Inspiron-3650:~/dev/rosbook/chapter3_tutorials/launch# roslaunch chapter3_tutorials example1.launch ctrl+c杀死,运行结果如下: 复制代码process[example1-2]: started with pid [4535] [DEBUG] [1478764514.875191516]: This is a simple DEBUG message! [DEBUG] [1478764514.875269524]: This is a DEBUG message with an argument: 3.140000 [DEBUG] [1478764514.875324276]: This is DEBUG stream message with an argument: 3.14 [example1-2] process has finished cleanly log file: /root/.ros/log/037b2b7e-a71b-11e6-bcd2-f48e38af57c0/example1-2*.log ^C[rosout-1] killing on exit [master] killing on exit shutting down processing monitor... ... shutting down processing monitor complete done
launch/example1.launch内容如下:复制代码<?xml version="1.0" encoding="UTF-8"?> <launch> <!-- Logger config --> <env name="ROSCONSOLE_CONFIG_FILE" value="$(find chapter3_tutorials)/config/chapter3_tutorials.config"/> <!-- Example 1 --> <node pkg="chapter3_tutorials" type="example1" name="example1" output="screen"/> </launch>
参考
http://blog.csdn.net/fengmengdan/article/details/42984429
最后
以上就是激动小熊猫最近收集整理的关于由浅到深理解ROS(5)- 启动文件 节点属性之节点元素的形式: 节点属性之显示属性: 节点属性之复位属性: 节点属性之命名空间: 名称重映射: 包含其他文件: 启动参数:的全部内容,更多相关由浅到深理解ROS(5)-内容请搜索靠谱客的其他文章。
发表评论 取消回复