test_mimic.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00004 #
00005 # Licensed under the Apache License, Version 2.0 (the "License");
00006 # you may not use this file except in compliance with the License.
00007 # You may obtain a copy of the License at
00008 #
00009 #   http://www.apache.org/licenses/LICENSE-2.0
00010 #
00011 # Unless required by applicable law or agreed to in writing, software
00012 # distributed under the License is distributed on an "AS IS" BASIS,
00013 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 # See the License for the specific language governing permissions and
00015 # limitations under the License.
00016 
00017 
00018 import roslib
00019 import rospy
00020 import sys
00021 
00022 # Brings in the SimpleActionClient
00023 import actionlib
00024 
00025 # Brings in the messages used by the set_mimic action, including the
00026 # goal message and the result message.
00027 import cob_mimic.msg
00028 
00029 def mimic_client():
00030     # Creates the SimpleActionClient, passing the type of the action
00031     # to the constructor.
00032     client = actionlib.SimpleActionClient('/mimic/set_mimic', cob_mimic.msg.SetMimicAction)
00033 
00034     # Waits until the action server has started up and started
00035     # listening for goals.
00036     client.wait_for_server()
00037 
00038     # Creates a goal to send to the action server.
00039     goal = cob_mimic.msg.SetMimicGoal()
00040     goal.mimic = sys.argv[1]
00041 
00042     # Sends the goal to the action server.
00043     client.send_goal(goal)
00044 
00045 if __name__ == '__main__':
00046     try:
00047         # Initializes a rospy node so that the SimpleActionClient can
00048         # publish and subscribe over ROS.
00049         if len(sys.argv) != 2:
00050             print "Error: please specify mimic string as input"
00051             sys.exit(1)
00052 
00053         rospy.init_node('mimic_test_node')
00054         result = mimic_client()
00055     except rospy.ROSInterruptException:
00056         print "program interrupted before completion"


cob_mimic
Author(s): Nadia Hammoudeh Garcia , Benjamin Maidel
autogenerated on Sat Jun 8 2019 21:02:12