如何解决如何在启动文件中定义参数?
我有以下启动文件,我在其中定义了一个参数:
<launch>
<arg name="coordinates_file" value="$(find pkg_name)/name_of_the_txt_file.txt"/>
<node pkg="pkg_name" type="ros_node_name" name="launch_file_name">
<rosparam file="$(arg coordinates_file)"/>
</node>
</launch>
另外,我正在读取 ros_node 中的参数如下:
ros::NodeHandle nh("~");
std::string param="waypoints_cordinates.txt";
std::string wp_file;
wp_file = nh.getParam("wp_file",param);
std::cout << "param1" << param << std::endl;
std::cout << "param" << wp_file << std::endl;
在对上述启动文件执行 roslaunch 时,我遇到以下错误:
RLException: error loading <rosparam> tag:
'param' attribute must be set for non-dictionary values
XML is <rosparam file="$(arg wp_file)"/>
The traceback for the exception was written to the log file
你能帮我解决这个问题吗?我是否错过了创建和读取参数的任何部分?!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。