0
$\begingroup$

Rosanswers logo

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

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

(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:

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

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
[ERROR] [1502179966.421258]: Sound synthesis failed. Is festival installed? Is a festival voice installed? Try running "rosdep satisfy sound_play|sh". Refer to http://wiki.ros.org/sound_play/Troubleshooting
[ERROR] [1502179966.421695]: Exception in callback: 'NoneType' object has no attribute 'command'

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
[WARN] [1502179964.306939]: Sound command issued, but no node is subscribed to the topic. Perhaps you forgot to run soundplay_node.py?

Originally posted by s_mostafa_a on ROS Answers with karma: 1 on 2017-08-08

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by naveedhd with karma: 161 on 2017-08-08

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Ed Venator on 2017-08-09:
Possibly helpful: http://wiki.ros.org/rospy/Overview/Initialization%20and%20Shutdown#Accessing_your_command-line_arguments

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.