ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

Announcing rosbash_params - give your bash scripts a rospy-like feel

release

#1

New package rosbash_params has been released into I, K, L and M: http://wiki.ros.org/rosbash_params

This Bash env-hook adds a “node-like” interface to your code written in Bash. The main thing it adds is ROS-like command-line parameter parsing (_param:=value), so that you can easily call the Bash script from a launch file like this:

pkg/launch/test.launch:
...
<node name="test" pkg="pkg" type="my_bash_script.sh">
    <param name="par" value="test" />
</node>
...

pkg/src/my_bash_script.sh:
rosbash_init_node "node_name" "$@"  # parse the command line arguments
rosbash_param param_var "par" 
echo "Got parameter 'par' with value ${param_var}"

Please note this is not a full-featured client library for Bash - it just adds some convenience for people writing Bash scripts ros ROS packages. So even though there’s rosbash_init_node call, it does not start up a real ROS node - but it reads the private parameters from the same namespace a real node would.

The package can work both with ROS param server and without it. It can even be used without a roscore running.

One of the ideas behind this package was to allow easier writing of ROS nodes which can be used by downstream packages without knowing which language they are written in. Currently, even C++ and Python nodes process parameters differently when called from commandline. Put a thumb-up to the issue if you also want language-agnostic ROS nodes :slight_smile: