ros_zenither_server.py
Go to the documentation of this file.
00001 #!/usr/bin/python
00002 # Copyright (c) 2009, Georgia Tech Research Corporation
00003 # All rights reserved.
00004 # 
00005 # Redistribution and use in source and binary forms, with or without
00006 # modification, are permitted provided that the following conditions are met:
00007 #     * Redistributions of source code must retain the above copyright
00008 #       notice, this list of conditions and the following disclaimer.
00009 #     * Redistributions in binary form must reproduce the above copyright
00010 #       notice, this list of conditions and the following disclaimer in the
00011 #       documentation and/or other materials provided with the distribution.
00012 #     * Neither the name of the Georgia Tech Research Corporation nor the
00013 #       names of its contributors may be used to endorse or promote products
00014 #       derived from this software without specific prior written permission.
00015 # 
00016 # THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
00017 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 # DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
00020 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00021 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00022 # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00023 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
00024 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00025 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 #
00027 
00028 ## author Advait Jain (Healthcare Robotics Lab, Georgia Tech.)
00029 ## author Travis Deyle (Healthcare Robotics Lab, Georgia Tech.)
00030 ## author Hai Nguyen (Healthcare Robotics Lab, Georgia Tech.)
00031 
00032 
00033 import roslib
00034 roslib.load_manifest('zenither')
00035 import rospy
00036 from hrl_srvs.srv import Float_Int
00037 
00038 import time
00039 import sys
00040 
00041 
00042 class ZenitherServer():
00043     def __init__(self, zenither):
00044         try:
00045             rospy.init_node('ZenitherServer')
00046             rospy.logout('ZenitherServer: Initialized Node')
00047         except rospy.ROSException:
00048             pass
00049 
00050         self.zenither = zenither
00051         self.smp = rospy.Service('/zenither/move_position', Float_Int,
00052                                  self.move_position)
00053         self.ss = rospy.Service('/zenither/stop', Float_Int,
00054                                 self.estop)
00055         self.sat = rospy.Service('/zenither/apply_torque', Float_Int,
00056                                  self.apply_torque)
00057         self.stmp = rospy.Service('/zenither/torque_move_position',
00058                                   Float_Int, self.torque_move_position)
00059 
00060     def move_position(self, msg):
00061         print 'move_position is UNTESTED'
00062         #self.zenither.move_position( msg.value )
00063         return True
00064     
00065     def apply_torque(self, req):
00066         self.zenither.nadir(req.value)
00067         return True
00068 
00069     def estop(self, req):
00070         self.zenither.estop()
00071         return True
00072 
00073     def torque_move_position(self, req):
00074         self.zenither.torque_move_position(req.value)
00075         return True
00076 
00077 
00078 
00079 if __name__ == '__main__':
00080     import zenither.zenither as zenither
00081     z = zenither.Zenither('HRL2', pose_read_thread = True)
00082     zs = ZenitherServer(z)
00083     rospy.spin()
00084 
00085     # rosservice call /zenither/move_position 0.3


zenither
Author(s): Cressel Anderson, Advait Jain, Hai Nguyen, Advisor: Prof. Charlie Kemp, Lab: Healthcare Robotics Lab at Georgia Tech
autogenerated on Wed Nov 27 2013 11:54:59