def __init__(self): self.controller = game_controller.RobotController() self.client = actionlib.SimpleActionClient('sound_play', SoundRequestAction) self.soundPath = os.path.dirname( os.path.dirname(os.path.abspath(__file__))) + "/storyAudio/" self.request_response = 0 self.motivation_list = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'l', 'm', 'n', 'o', 'p' ]
import rospy rospy.init_node('example', anonymous=True) import smach import smach_ros from std_msgs.msg import Int32 import game_state import game_controller import signal import sys c = game_controller.RobotController() s = game_state.UserGameState(c) r = game_state.RobotGameState(c) i = 0 def sigint_handler(signum, frame): import actionlib from sound_play.msg import SoundRequest, SoundRequestAction, SoundRequestGoal client = actionlib.SimpleActionClient('sound_play', SoundRequestAction) client.wait_for_server() goal = SoundRequestGoal() goal.sound_request.sound = SoundRequest.PLAY_FILE goal.sound_request.command = SoundRequest.PLAY_ONCE goal.sound_request.arg = "" goal.sound_request.volume = 1.0