relax_arm_server.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 """
00004   relax_arm_server.py - a simple service to relax the arm
00005   Copyright (c) 2011 Vanadium Labs LLC.  All right reserved.
00006 
00007   Redistribution and use in source and binary forms, with or without
00008   modification, are permitted provided that the following conditions are met:
00009       * Redistributions of source code must retain the above copyright
00010         notice, this list of conditions and the following disclaimer.
00011       * Redistributions in binary form must reproduce the above copyright
00012         notice, this list of conditions and the following disclaimer in the
00013         documentation and/or other materials provided with the distribution.
00014       * Neither the name of the copyright holders nor the names of its 
00015         contributors may be used to endorse or promote products derived 
00016         from this software without specific prior written permission.
00017   
00018   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00019   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00020   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00021   DISCLAIMED. IN NO EVENT SHALL VANADIUM LABS BE LIABLE FOR ANY DIRECT, INDIRECT,
00022   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00023   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00024   OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00025   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
00026   OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00027   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028 """
00029 
00030 import roslib; roslib.load_manifest('arbotix_python'); roslib.load_manifest('simple_arm_actions')
00031 import rospy, actionlib
00032 
00033 from arbotix_msgs.srv import Relax
00034 from simple_arm_actions.msg import *
00035 
00036 class RelaxArmServer:
00037 
00038     def __init__(self):
00039         rospy.init_node("relax_arm_server")
00040         try:
00041             self.joints = rospy.get_param("~joints")
00042         except:
00043             self.joints = rospy.get_param("/simple_arms/joints")
00044 
00045         self.services = [rospy.ServiceProxy(name+'/relax',Relax) for name in self.joints]
00046         self.server = actionlib.SimpleActionServer("relax_arm", RelaxArmAction, execute_cb=self.actionCb, auto_start=False)
00047         self.server.start()
00048         rospy.spin()
00049 
00050     def actionCb(self, req):
00051         for service in self.services:
00052             service()
00053         self.server.set_succeeded( ResetArmResult() )   
00054 
00055 
00056 if __name__ == '__main__':
00057     try:
00058         RelaxArmServer()
00059     except rospy.ROSInterruptException:
00060         rospy.loginfo("And that's all folks...")
00061 


simple_arm_actions
Author(s): Michael Ferguson
autogenerated on Mon Oct 6 2014 07:42:43