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

how to pass argument to executable in launchfile

asked 2015-07-10 12:38:56 -0500

fabian77 gravatar image

Want to start a executable within a launchfile which needs an argument (its note a node), normally i would launch that executable like this from the commandline:

setuart2 on

where "on" is the argument.

I've put the executable into a scriptfolder into the workspace and am starting it like that in the launchfile:

<node name="setuart2" pkg="base_controller" type="setuart2" required="true" output="screen" machine="robotOS"/>

, seems that it is found through the launchfile, but i get the following error (what is clear, because the parameter "on" is missing:

killing on exit remote[robotOS.local-0]: /home/robot/ROS-Groovy-Workspace/src/base_controller/scripts/setuart2: either 'on' or 'off' argument is required

Now i've found no way to pass the parameter, tryed it throug parameters, but no success.

Can somebody help?

Thx a lot Fabian

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-07-10 13:09:18 -0500

ahendrix gravatar image

Try using the args property:

<node name="setuart2" pkg="base_controller" type="setuart2" args="on"/>

But also note that roslaunch assumes that any nodes listed are ROS nodes, and silently passes additional __name and __log parameters to your program (which ROS nodes handle correctly).

edit flag offensive delete link more


Hi, thanks for having a look, allready tried with args, but no success. Still getting error:

/home/robot/ROS-Groovy-Workspace/src/base_controller/scripts/setuart2: either 'on' or 'off' argument is required

fabian77 gravatar image fabian77  ( 2015-07-10 13:45:26 -0500 )edit

maybe i just try writing a scriptfile which passes the argument correct and trying to execute that script instead...

fabian77 gravatar image fabian77  ( 2015-07-10 13:45:42 -0500 )edit

Your program is probably confused by the __name and __log options I mentioned. Try writing a ROS node which calls your program.

ahendrix gravatar image ahendrix  ( 2015-07-10 16:00:11 -0500 )edit

Question Tools


Asked: 2015-07-10 12:38:56 -0500

Seen: 640 times

Last updated: Jul 10 '15