参考:https://answers.ros.org/question/197304/creatingparsing-a-dictionary-of-dictionary-params/
官网:http://wiki.ros.org/roslaunch/XML/rosparam
官网解读:
The load command is considered additive: if you declare a dictionary or namespace of parameters, those parameters will be added to any other parameters declared for that namespace. Similarly, load commands can override parameters previously declared.
The <rosparam> tag can either reference a YAML file or contain raw YAML text. If the YAML text defines a dictionary, the param attribute may be omitted.
<launch>
<node pkg="beginner_tutorials" type="v1.py" name="" output="screen" respawn="true">
<param name="launchpath" value="/home/haypin/pytest/launchdir"/>
<rosparam command="load" file="$(find beginner_tutorials)/launch/mydict.yaml" />
<rosparam param="a_list">[3,1,4,1,5,9,2,6]</rosparam>
</node>
<!-- <node pkg="beginner_tutorials" type="SubYamlOrder.py" name="tacticSub" output="screen" respawn="true"/> -->
</launch>
ob_extract:
board:
adjacent_dis_min: 0.1
len:
min: 0.2
max: 0.3
if DEBUG:
param_ob_extract = rospy.get_param("~ob_extract") #~替代/node_name/,不用再加/
print(type(param_ob_extract)) #已经是个Python字典dict了
本文深入探讨了ROS(Robot Operating System)中如何使用<rosparam>标签进行参数的加载与管理,包括如何定义和加载YAML文件中的参数,以及直接在XML中声明参数的方法。此外,还介绍了通过Python脚本获取这些参数的具体方式。
122

被折叠的 条评论
为什么被折叠?



