ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to use a parameter file with a rosrun

asked 2014-02-04 22:38:05 -0500

Markus Bader gravatar image


I have a node like the laser_filter, amcl or move base with many parameters. Using a launch file allows me to store the parameters within a yaml file like:

  <node name="move_base" output="screen" pkg="move_base" respawn="false" type="move_base">   
    <rosparam command="load" file="$(find cfg_pkg)/cfg/common_costmap.yaml" ns="global_costmap">
    <rosparam command="load" file="$(find cfg_pkg)/cfg/common_costmap.yaml" ns="local_costmap">
    <rosparam command="load" file="$(find cfg_pkg)/cfg/global_costmap.yaml">
    <rosparam command="load" file="$(find cfg_pkg)/cfg/local_costmap.yaml">
    <rosparam command="load" file="$(find cfg_pkg)/cfg/base_local_planner.yaml">

But I like to start the node directly but how are the options to load parmater files? Using the using the underline like with normal parameters are not working?

I am looking for something like:

rosrun move_base move_base _load:=????? #


edit retag flag offensive close merge delete


Actually one simple trick depending on what you want to do is: Run the launch file once (that loads all parameters correctly like you set it up) and the just run the node. The parameters from the launch stay on the param server.

dornhege gravatar image dornhege  ( 2014-02-04 23:47:19 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-02-04 23:45:37 -0500

dornhege gravatar image

rosrun itself doesn't load parameters. rosparam is the tool for that. Basically the command is the same like in the lauch file, you'd only need to take care of pushing things into the node's namespace, e.g.

<rosparam command="load" file="$(find cfg_pkg)/cfg/common_costmap.yaml" ns="global_costmap">


rosparam load $(rospack find cfg_pkg)/cfg/common_costmap.yaml my_node_name/global_costmap</rosparam>
edit flag offensive delete link more


Thanks I will try that

Markus Bader gravatar image Markus Bader  ( 2014-02-07 06:22:45 -0500 )edit

Question Tools

1 follower


Asked: 2014-02-04 22:38:05 -0500

Seen: 3,071 times

Last updated: Feb 04 '14