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

roslaunch parameter has additional newlines when set using command=

asked 2015-10-01 03:08:45 -0500

Felix Duvallet gravatar image

I'm trying to set a ROS parameter in a launch file. The parameter is the file path to some resource, so that it can be used by the node later:


    <param name="filename"
     command="$(find param_pkg)/scripts/"

The python script finds the file and prints its location:

#! /usr/bin/python

The python script works fine, and just prints the file location (with no additional whitespace):

$ rosrun param_pkg


However, the parameter set by the launch file gets a trailing newline and some additional ticks:

$ rosparam get /filename



(note the two lines.) If I set the parameter manually (value=), there are no additional ticks or whitespace: $ rosparam get filename_manual:


Why is this whitespace present only when I set the roslaunch parameter by running a python command, and how can I get it to be the same value as manually setting the param value?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-11-23 12:16:37 -0500

Magnus gravatar image

updated 2020-11-23 12:16:51 -0500

It because your python script is printing with newline endings. Print without a newline.

Python 2:


Python 3:

print("/path/to/file", end = '')
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-10-01 03:08:45 -0500

Seen: 474 times

Last updated: Nov 23 '20