ROS向节点传递参数的方法总结(rosrun,roslaunch) + (参数服务器,main函数参数)

本文详细介绍了在ROS中通过rosrun和roslaunch两种方式向节点传递参数的方法。不仅包括了如何将参数存入参数服务器,还讲解了如何直接传递给main函数。文中提供了具体的配置示例,帮助读者更好地理解并应用。

参考:ROS向节点传递参数的方法总结(rosrun,launch) + (参数服务器,main函数参数)https://blog.youkuaiyun.com/u013834525/article/details/88744327

rosrun 向 参数服务器

rosrun package node _param:=value

 param前加 "_" 

roslaunch 向 参数服务器

 使用param标签

<launch>

     <node name="imu2txt" pkg="data2txt" type="imu2txt" respawn="false" output="screen" >

         <param name="file_name"         type="string" value="/home/night_fury/Documents/record_bags/calibration/imudata_to_wall.txt"/>

     </node>

</launch>

rosrun 向 main()

直接在后边添加

rosrun package node p1 p2 p3

roslaunch 向 main()

在 node标签中,使用 args 

<node pkg="ros_tutorials_parameter" type="service_client_with_parameter" name="service_client" args="6 8">
<param name="calculation_method"  value="2"/>
<launch>

     <node name="map_server" pkg="map_server" type="map_server" args="(findcostmap2d)/test/willow−full−0.025.pgm 0.025"/>

<node name="rosplay"pkg="rosbag"type="play"args="−s 5 −r 1 −−clock −−hz=10 (find costmap_2d)/test/simple_driving_test_indexed.bag" />

</launch>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值