torso_action.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Dummy Torso Action Server for Rosie
00004 # Mimics the PR2 torso interface
00005 #
00006 # Copyright (c) 2010 Alexis Maldonado <maldonado@tum.de>
00007 # Technische Universitaet Muenchen
00008 #
00009 # This program is free software: you can redistribute it and/or modify
00010 # it under the terms of the GNU General Public License as published by
00011 # the Free Software Foundation, either version 3 of the License, or
00012 # (at your option) any later version.
00013 #
00014 # This program is distributed in the hope that it will be useful,
00015 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 # GNU General Public License for more details.
00018 #
00019 # You should have received a copy of the GNU General Public License
00020 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
00021 
00022 import roslib; roslib.load_manifest('rosie_torso_action')
00023 import rospy
00024 
00025 from actionlib_msgs.msg import *
00026 from pr2_common_action_msgs.msg import *
00027 from pr2_controllers_msgs.msg import *
00028 import actionlib
00029 
00030 class TorsoActionServer:
00031     def __init__(self, node_name):
00032         self.node_name = node_name
00033         self.action_server = actionlib.simple_action_server.SimpleActionServer(node_name, SingleJointPositionAction, self.executeCB)
00034     
00035     def executeCB(self, goal):
00036         print("executing a torso action!")
00037         #Just answer success instantly
00038         result = SingleJointPositionResult()
00039         self.action_server.set_succeeded(result)
00040     
00041 def main():
00042     action_name = 'rosie_torso_action'
00043     action_name = '/torso_controller/position_joint_action'
00044     rospy.loginfo("%s: Starting up!" %(action_name))
00045     
00046     rospy.init_node("torso_action")
00047     tuck_arms_action_server = TorsoActionServer(action_name)
00048     rospy.spin()
00049 
00050 if __name__ == '__main__':
00051     main()


rosie_torso_action
Author(s): Alexis Maldonado
autogenerated on Mon Oct 6 2014 09:32:19