Grasp.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Copyright 2011 Shadow Robot Company Ltd.
00004 #
00005 # This program is free software: you can redistribute it and/or modify it
00006 # under the terms of the GNU General Public License as published by the Free
00007 # Software Foundation, either version 2 of the License, or (at your option)
00008 # any later version.
00009 #
00010 # This program is distributed in the hope that it will be useful, but WITHOUT
00011 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00013 # more details.
00014 #
00015 # You should have received a copy of the GNU General Public License along
00016 # with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 #
00018 
00019 VERBOSE = 1
00020 
00021 class Grasp(object):
00022 
00023     def __init__(self):
00024         self.grasp_name = ""
00025         self.joints_and_positions = {}
00026 
00027     def display_grasp(self):
00028         print self.grasp_name
00029         print self.joints_and_positions
00030 
00031     def convert_to_xml(self):
00032         grasp = '       <grasp name="'+self.grasp_name+'">'+'\n'
00033         for key, value in self.joints_and_positions.items():
00034             grasp = grasp + '           <joint name="'+str(key)+'">'+str(value)+'</joint>\n'
00035         grasp = grasp + '       </grasp>'+'\n'
00036         return grasp


sr_hand
Author(s): Ugo Cupcic
autogenerated on Fri Aug 21 2015 12:24:55