test_actionlib_client.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 import roslib; roslib.load_manifest('sound_play')
00004 import rospy
00005 import actionlib
00006 from sound_play.msg import SoundRequest, SoundRequestAction, SoundRequestGoal
00007 
00008 import os
00009 
00010 def sound_play_client():
00011     client = actionlib.SimpleActionClient('sound_play', SoundRequestAction)
00012 
00013     client.wait_for_server()
00014 
00015     print "Need Unplugging"
00016     goal = SoundRequestGoal()
00017     goal.sound_request.sound = SoundRequest.NEEDS_UNPLUGGING
00018     goal.sound_request.command = SoundRequest.PLAY_ONCE
00019 
00020     client.send_goal(goal)
00021     client.wait_for_result()
00022     print client.get_result()
00023     print "End Need Unplugging"
00024     print
00025 
00026     print "Need Plugging"
00027     goal = SoundRequestGoal()
00028     goal.sound_request.sound = SoundRequest.NEEDS_PLUGGING
00029     goal.sound_request.command = SoundRequest.PLAY_ONCE
00030     client.send_goal(goal)
00031     client.wait_for_result()
00032     print client.get_result()
00033     print "End Need Plugging"
00034     print
00035 
00036     print "Say"
00037     goal = SoundRequestGoal()
00038     goal.sound_request.sound = SoundRequest.SAY
00039     goal.sound_request.command = SoundRequest.PLAY_ONCE
00040     goal.sound_request.arg = "Testing the actionlib interface A P I"
00041     client.send_goal(goal)
00042     client.wait_for_result()
00043     print client.get_result()
00044     print "End Say"
00045     print
00046 
00047     print "Wav"
00048     goal = SoundRequestGoal()
00049     goal.sound_request.sound = SoundRequest.PLAY_FILE
00050     goal.sound_request.command = SoundRequest.PLAY_ONCE
00051     goal.sound_request.arg = os.path.join(roslib.packages.get_pkg_dir('sound_play'),'sounds') + "/say-beep.wav"
00052     client.send_goal(goal)
00053     client.wait_for_result()
00054     print client.get_result()
00055     print "End wav"
00056     print
00057 
00058 if __name__ == '__main__':
00059     rospy.init_node('soundplay_client_test')
00060     sound_play_client()


sound_play
Author(s): Blaise Gassend
autogenerated on Mon Sep 26 2016 03:31:16