相关材料:https://blog.csdn.net/u014303046/article/details/51019994
在 launch 标签内的是全局参数,而在node 标签内的则是局部参数,node 标签内的是局部参数其有效域是当前节点
https://blog.csdn.net/shijinqiao/article/details/50450844
经过在launch实测即有如下规则
(1)在一个launch文件中
<arg name=" " /> 只能在一个作用域中出现一次 ,否则提示 arg “ ” has already been declared // 已经被声明过了
也不能重复赋值
先<arg name="" default="" /> 后 <arg name="" value="" /> arg “ ” has already been declared
类似,default-default / value-value 均不可
(2)参数值传递给一个include文件 [只传值,类似函数参数]
including file(使用<include/> 标签的file) 需要有 <arg="name",value""/>
included file (被引用的file) 需要有<arg="name"/> (name是including file 传递参数的名)
PS:可以有default 属性,不能有value属性——不能复写这个传递过来的值,
否则提示 cannot override arg[ ],which has already been set
而关于有default属性的话,可能是其可以单独作为一个launch使用(重用性更好);
没有default的话,如果作为一个单独launch启动,则会因为没值传入,而可能产生BUG。
1、其中一定要有value 否则提示 include args must have declared values
PS:非include args 可没有value
2、使用了include args 的话 included flie 一定要使用到它(即调用$) 否则提示 unused args [ ]for [included file]