Problem with pr2 simulation [closed]
This is my server code:
#include <ros/ros.h>
#include <stdio.h>
#include "not_yeld_module/trajectory.h"
#include <iostream>
#include <sound_play/sound_play.h>
#include <unistd.h>
bool notYeldSound_script(not_yeld_module::trajectory::Request &req, not_yeld_module::trajectory::Response &res )
{
ros::NodeHandle nh;
sound_play::SoundClient sc(nh,"robotsound");
ROS_INFO("mot1");
sc.say("Please stop!I need the elevator");
sound_play::Sound s2 = sc.voiceSound("Please stop!I need the elevator");
s2.play();
sleep(0.5);
ROS_INFO("mot2");
res.processFinished=true;
return true;
ROS_INFO("mot2");
//}
}
int main(int argc, char **argv)
{
ros::init(argc, argv,"notYeldSoundServer");
ros::NodeHandle n;
ros::ServiceServer service = n.advertiseService("notYeldSound", notYeldSound_script);
ROS_INFO("notYeldSound ready");
ros::spin();
return 0;
}
If I run sound play node:
rosrun sound_play soundplay_node.py
and call the service with its proper client I get this error:
^Ccamilla@camilla-OEM:~$ rosrun not_yeld_module notYeldSoundServer
[ INFO] [1363856219.149537474]: notYeldSound ready
[ WARN] [1363856229.542190931, 222.756000000]: Sound command issued, but no node is subscribed to the topic. Perhaps you forgot to run soundplay_node.py
[ WARN] [1363856229.542295040, 222.756000000]: Sound command issued, but no node is subscribed to the topic. Perhaps you forgot to run soundplay_node.py
What could be the problem? I'm using ros electric and simulating the pr2 on gazebo with:
roslaunch pr2_gazebo pr2_empty_world.launch
I worked looking at this example: http://www.ros.org/doc/api/sound_play/html/test_8cpp_source.html