标签:设置 path nod create pre value open string 传输
<launch>
<arg name="model" default="model_name" doc="this is a model name"/>
<arg name="param_path" default="$(find package_name)/data/" doc="this is a param path" />
<group ns="group_name">
<node pkg="package_name1" name="node_name1" type="node_type1" output="screen" >
<param name="model" value="$(arg model)"/>
<param name="param_path" value="$(arg param_path)/xx.xml" />
<remap from="old_topic" to="new_topic"/>
</node>
</group>
<node pkg="package_name2" name="node_name2" type="node_type2" output="screen" >
<param name="string" type="str" value="ABC" />
<param name="int" type="int" value="6" />
<rosparam param="min_in">[1, 1, 1]</rosparam>
<rosparam param="paras">
"a": 1
"b": 2
</rosparam>
</node>
<node pkg="rviz" name="rviz" type="rviz" args="-d $(find package_name)/rviz/package_name.rviz">
</node>
</launch>
<group ns="group_name">
</group>
<remap from="old_topic" to="new_topic"/>
<param name="string_name" type="str" value="ABC" />
<param name="int_name" type="int" value="6" />
<param name="param_path" value="$(arg param_path)/xx.xml" />
支持 string、 int 、double和file(xml, csv等)
ros::NodeHandle priv_nh("~");
std::string string_name;
priv_nh.param<std::string>("string_name", string_name, "string_defalut");
priv_nh.param<int>("int_name", int, "0");
<rosparam param="range">[1, 1, 1]</rosparam>
<rosparam param="paras">
"a": 1
"b": 2
</rosparam>
使用rosparam向node传输参数
std::vector<double> v_range(3, 0);
priv_nh.getParam("range", v_range);
std::map<std::string, double> m_paras;
priv_nh.getParam("paras", m_paras);
How to create a launch file? - ROS Answers: Open Source Q&A Forum
roslaunch/XML - ROS Wiki
标签:设置 path nod create pre value open string 传输
原文地址:https://www.cnblogs.com/ChrisCoder/p/9949643.html