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

rosparam load into shell script

asked 2013-03-21 06:58:29 -0500

kostasof gravatar image

updated 2013-03-21 13:30:08 -0500

Hello,

I would like to run move_stack from the binary. So what i am actually trying to do is to load the parameters into a shell script. The shell script looks like this:

`#!/bin/bash clear

echo "Executing Move_base"

rosparam load -v ~/ros_stacks_sc/navigation_kostas/cfg_rafa/costmap_common_params.yaml /global_costamap

rosparam load -v ~/ros_stacks_sc/navigation_kostas/cfg_rafa/costmap_common_params.yaml /local_costamap

rosparam load -v ~/ros_stacks_sc/navigation_kostas/cfg_rafa/base_global_planner_params.yaml rosparam load -v

~/ros_stacks_sc/navigation_kostas/cfg_rafa/base_local_planner_params.yaml

rosparam load -v ~/ros_stacks_sc/navigation_kostas/cfg_rafa/global_costmap_params.yaml

rosparam load -v ~/ros_stacks_sc/navigation_kostas/cfg_rafa/local_costmap_params.yaml

cd ~/ros_stacks_sc/navigation_kostas/move_base/bin/

./move_base home/kostasof/Desktop/test_t420/Move_Base.xml wlan0`

As you can see i am loading the parameters by using the "rosparam load" command, and after i go the folder that i have compiled my distribution of "move_base" and executing the binary by giving 2 more arguments(necessary for my changes into the code). The problem is that when i am executing the binary it says that it loads the parameters (-v : verbose mode) but during the move_base execution the parameters that have been loaded are not taken into account.

Any ideas?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2013-03-21 17:42:24 -0500

This is not a direct answer to your question as I am not sure what's going wrong with your approach. I suspect some namespacing issue in play here. Anyway here are 2 alternative solutions for what you're trying to do using launch files:

  1. The roslaunch syntax allows for supplying custom arguments to your binary. See the args attribute inside the node element here: http://www.ros.org/wiki/roslaunch/XML/node
  2. You can convert your binary arguments to ROS parameters, and add appropriate parameters to your launch file. See http://www.ros.org/wiki/roscpp/Overview/Parameter%20Server
edit flag offensive delete link more
1

answered 2013-03-21 17:59:19 -0500

After you bring up the move_base node, you should print the full parameter listing using rosparam list or rosparam dump. This often helps uncover issues where parameters are loaded into the wrong namespace.

In this case, it looks to me like you might be loading your parameters into the "root" namespace (e.g. "/local_costmap"). According to the move_base documentation, these parameters should instead be specified in the node's private namespace (e.g. "/move_base/local_costmap").


Also, have you considered using a launch file to load the parameters and run the node? That would be the normal way this is done in ROS. This automatically loads the parameter files and places the parameters in the node's private namespace.

<launch>
  <arg name="path_file" default="/home/kostasof/Desktop/test_420/Move_Base.xml"/>
  <arg name="cfg_path" value="~/ros_stacks_sc/navigation_kostas/cfg_rafa"/>

  <node name="move_base" pkg="move_base" type="move_base" args="$(arg path_file) wlan0">
    <rosparam command="load" file="$(arg cfg_path)/costmap_common_params.yaml" ns="global_costmap"/>
    <rosparam command="load" file="$(arg cfg_path)/costmap_common_params.yaml" ns="local_costmap"/>
    <rosparam command="load" file="$(arg cfg_path)/base_global_planner_params.yaml"/>
    <rosparam command="load" file="$(arg cfg_path)/base_local_planner_params.yaml"/>
    <rosparam command="load" file="$arg cfg_path)/global_costmap_params.yaml"/>
    <rosparam command="load" file="$arg cfg_path)/local_costmap_params.yaml"/>
  </node>
</launch>

Note: in order to use your version of move_base in place of the standard system package, make sure your home-dir is listed in $ROS_PACKAGE_PATH before the default system path.

edit flag offensive delete link more
0

answered 2013-03-25 05:00:05 -0500

kostasof gravatar image

Thanks for your instant response. I finally used the roslaunch approach which covers my needs. It works fine and i can say that it is much more convenient than shell script :)

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-03-21 06:58:29 -0500

Seen: 1,276 times

Last updated: Mar 25 '13