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

why say.py in sound_play package cannot be used with roslaunch?

asked 2017-08-08 03:42:10 -0500

s_mostafa_a gravatar image

updated 2017-08-08 03:46:10 -0500

say.py works if it come with rosrun. I mean at first I have launched a launch file containing:

<launch>

<node pkg="sound_play" type="soundplay_node.py" name="sound_play" output="screen"/>

</launch>

(consider its name is first.launch)

and then in another terminal I have run:

rosrun mypackage say.py


but how can I launch say.py with a launch file? I have say.py inside "mypackage" and a launch file(named second.launch) like this:

<launch>

<node pkg="mypackage" type="say.py" name="say" output="screen"/>

</launch>

but it got some errors in the terminal in which i have launched first.luanch:

sound: -3 command: 1 volume: 1.0 arg: __name:=say arg2: __log:=/home/mostafa/.ros/log/53b70204-7c11-11e7-b929-acbc32787137/say-1.log SIOD ERROR: unbound variable : __log:=/home/mostafa/.ros/log/53b70204-7c11-11e7-b929-acbc32787137/say-1.log

and a warning in the terminal of second.launch:

Saying: __name:=say Voice: __log:=/home/mostafa/.ros/log/53b70204-7c11-11e7-b929-acbc32787137/say-1.log Volume: 1.0

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-08-08 08:24:03 -0500

naveedhd gravatar image

This is because script say.py (must be written to be a standalone python script and hence) accepts sysargs. When say.py is launched with roslaunch, addition sysargs are passed to the script and __name:=say becomes the sys.argv[1].

The solution for this is to modify the say.py to accept rosparam.

edit flag offensive delete link more

Comments

1
Ed Venator gravatar image Ed Venator  ( 2017-08-09 23:29:56 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-08-08 03:42:10 -0500

Seen: 207 times

Last updated: Aug 08 '17