MAGIKS  1.1
Manipulator General Inverse Kinematic Solver
 All Classes Namespaces Files Functions Variables Pages
manipulator_library.py
Go to the documentation of this file.
1 # HEADER
2 
3 ## @file manipulator_library.py
4 # @brief Contains a function that defines geometric parameters and joint limits for a number of known manipulators
5 # Some examples: (PUMA, PA10, EXO, AILA Arm and PR2 Arm)
6 # @author Nima Ramezani Taghiabadi
7 #
8 # PhD Researcher
9 # Faculty of Engineering and Information Technology
10 # University of Technology Sydney (UTS)
11 # Broadway, Ultimo, NSW 2007, Australia
12 # Phone No. : 04 5027 4611
13 # Email(1) : nima.ramezani@gmail.com
14 # Email(2) : Nima.RamezaniTaghiabadi@uts.edu.au
15 # @version 3.0
16 #
17 # Last Revision: 03 January 2015
18 
19 # BODY
20 
21 import numpy, math
22 
24 import math_tools.general_math as genmath # A library of mathemathical global variables
26 
27 # Geometry of PUMA:
28 PUMA_geometry_settings = geolib.Manipulator_Geometry_Settings(6, 'PUMA')
29 PUMA_geometry_settings.theta = genmath.deg_to_rad*numpy.array([ 90.00, -45.00, 45.00, 0.00, 0.00, 0.00 ])
30 PUMA_geometry_settings.alpha = genmath.deg_to_rad*numpy.array([ -90.00, 0.00, 90.00, -90.00, 90.00, 0.00 ])
31 PUMA_geometry_settings.a = numpy.array([ 0.0000, 0.4318, -0.0203, 0.0000, 0.0000, 0.0000])
32 PUMA_geometry_settings.d = numpy.array([ 0.0000, 0.1491, 0.0000, 0.4331, 0.0000, 0.0562])
33 
34 # Geometry of PA10:
35 PA10_geometry_settings = geolib.Manipulator_Geometry_Settings(7, 'PA10')
36 PA10_geometry_settings.theta = genmath.deg_to_rad*numpy.array([ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00])
37 PA10_geometry_settings.alpha = genmath.deg_to_rad*numpy.array([ -90.00, 90.00, -90.00, 90.00, -90.00, 90.00, 0.00])
38 PA10_geometry_settings.a = numpy.array([ 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000])
39 PA10_geometry_settings.d = numpy.array([ 0.3150, 0.0000, 0.4500, 0.0000, 0.5000, 0.0000, 0.0800])
40 
41 # Geometry of PA10 Reduced:
42 PA10R_geometry_settings = geolib.Manipulator_Geometry_Settings(5, 'PA10R')
43 PA10R_geometry_settings.theta = genmath.deg_to_rad*numpy.array([ 0.00, 0.00, 0.00, 0.00, 0.00])
44 PA10R_geometry_settings.alpha = genmath.deg_to_rad*numpy.array([ -90.00, 90.00, -90.00, 90.00, -90.00])
45 PA10R_geometry_settings.a = numpy.array([ 0.0000, 0.0000, 0.0000, 0.0000, 0.0000])
46 PA10R_geometry_settings.d = numpy.array([ 0.3150, 0.0000, 0.4500, 0.0000, 0.5000 ])
47 PA10R_geometry_settings.d6 = 0.08
48 
49 # Geometry of PR2ARM:
50 PR2ARM_geometry_settings = geolib.Manipulator_Geometry_Settings(7, 'PR2ARM')
51 PR2ARM_geometry_settings.theta = genmath.deg_to_rad*numpy.array([ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00])
52 PR2ARM_geometry_settings.alpha = genmath.deg_to_rad*numpy.array([ -90.00, 90.00, -90.00, 90.00, -90.00, 90.00, 0.00])
53 PR2ARM_geometry_settings.a = numpy.array([ 0.1000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000])
54 PR2ARM_geometry_settings.d = numpy.array([ 0.0000, 0.0000, 0.4000, 0.0000, 0.3210, 0.0000, 0.0000])
55 
56 # Geometry of DFKI Exoskeleton:
57 EXO_geometry_settings = geolib.Manipulator_Geometry_Settings(15, 'EXO')
58 EXO_geometry_settings.theta = genmath.deg_to_rad*numpy.array([ 0.0 , 0.0 , 0.0 , 77.0, 36.0, 0.0 , 62.0, 43.0, 0.0 , 0.0, 0.0, 0.0 , 0.0, 0.0, 0.0])
59 EXO_geometry_settings.alpha = genmath.deg_to_rad*numpy.array([ 90.0, 90.0, 90.0,-90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 0.0, 0.0, 90.0, 0.0, 0.0 ,90.0])
60 EXO_geometry_settings.a = numpy.array([0.000, 0.000, 0.000, 0.000, 0.046, 0.000, 0.000, 0.000, 0.046, 0.000, 0.000, -0.120, 0.000, 0.000 ,0.000])
61 EXO_geometry_settings.d = numpy.array([0.048, 0.205, 0.000, 0.000, 0.046, 0.050, 0.078, 0.050, 0.278, 0.129, 0.106, 0.000, 0.095, 0.125 ,0.100])
62 
63 # Geometry of DFKI AILA:
64 AILA_geometry_settings = geolib.Manipulator_Geometry_Settings(7, 'AILA')
65 AILA_geometry_settings.theta = genmath.deg_to_rad*numpy.array([ 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00])
66 AILA_geometry_settings.alpha = [math.pi/2, -math.pi/2, math.pi/2, -math.pi/2, math.pi/2, -math.pi/2, math.pi /2]
67 AILA_geometry_settings.a = numpy.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
68 AILA_geometry_settings.d = numpy.array([214.0174059160209765, 0.0, 284.9916407054798242, 0.0, 288.6165426053090641, 0.0, 0.0])
69 
70 # Geometry of DFKI ROT:
71 
72 ROT_geometry_settings = geolib.Manipulator_Geometry_Settings(5, 'ROT')
73 ROT_geometry_settings.theta = genmath.deg_to_rad*numpy.array([ 0.00, 0.00, 0.00, -90.00, 90.00 ])
74 ROT_geometry_settings.alpha = genmath.deg_to_rad*numpy.array([ -90.00, 90.00, -90.00, 90.00, -90.00 ])
75 ROT_geometry_settings.a = numpy.array([ 0.0000, 0.0000, 0.0000, 0.1000, 0.0000 ])
76 ROT_geometry_settings.d = numpy.array([ 0.4000, 0.0000, 0.5000, 0.0000, 0.0000 ])
77 
78 
79 # Configuration Settings:
80 
81 # For PA10:
82 def PA10_config_settings(joint_mapping):
83  cs = conflib.Manipulator_Configuration_Settings(njoint = 7, DOF = 7, joint_mapping = joint_mapping)
84  cs.limited[4] = False
85  cs.limited[6] = False
86  cs.joint_handling[4] = 'NM'
87  cs.joint_handling[6] = 'NM'
88 
89  cs.ql = genmath.deg_to_rad*numpy.array([ -177.00, -91.00, -174.00, -137.00, -180.00, -165.00, -180.00])
90  cs.qh = genmath.deg_to_rad*numpy.array([ 177.00, 91.00, 174.00, 137.00, 180.00, 165.00, 180.00])
91 
92  return cs
93 
94 # For PA10 Reduced:
95 def PA10R_config_settings(joint_mapping):
96  cs = conflib.Manipulator_Configuration_Settings(njoint = 5, DOF = 5, joint_mapping = joint_mapping)
97  cs.limited[4] = False
98  cs.joint_handling[4] = 'NM'
99  cs.ql = genmath.deg_to_rad*numpy.array([ -177.00, -91.00, -174.00, -137.00, -180.00])
100  cs.qh = genmath.deg_to_rad*numpy.array([ 177.00, 91.00, 174.00, 137.00, 180.00])
101  return cs
102 
103 # For PR2ARM:
104 def PR2ARM_config_settings(joint_mapping):
105  cs = conflib.Manipulator_Configuration_Settings(njoint = 7, DOF = 7, joint_mapping = joint_mapping)
106  cs.limited[4] = False
107  cs.limited[6] = False
108  cs.joint_handling[4] = 'NM'
109  cs.joint_handling[6] = 'NM'
110 
111  cs.joint_label = ['Shoulder Pan Joint', 'Shoulder Lift Joint', 'Upper Arm Roll Joint',
112  'Shoulder Pan Joint', 'Elbow Flex Joint', 'Forearm Roll Joint',
113  'Wrist Flex Joint', 'Wrist Roll Joint']
114 
115  cs.ql = genmath.deg_to_rad*numpy.array([- 130.00, 60.00, -180.00, 0.00, -180.00, 0.00, -180.00])
116  cs.qh = genmath.deg_to_rad*numpy.array([ 40.00, 170.00, 44.00, 130.00, 180.00, 130.00, 180.00])
117  return cs
118 
119 # For PUMA:
120 def PUMA_config_settings(joint_mapping):
121  cs = conflib.Manipulator_Configuration_Settings(njoint = 6, DOF = 6, joint_mapping = joint_mapping)
122  cs.joint_handling[5] = 'NM'
123  cs.joint_handling[5] = 'NM'
124  cs.ql = genmath.deg_to_rad*numpy.array([ -160.00,-180.00, -90.00,-110.00,-100.00, -180.00])
125  cs.qh = genmath.deg_to_rad*numpy.array([ 160.00, 90.00, 180.00, 170.00, 100.00, 180.00])
126  return cs
127 
128 # For DFKI Exoskeleton:
129 def EXO_config_settings(joint_mapping):
130  cs = conflib.Manipulator_Configuration_Settings(njoint = 15, DOF = 9, joint_mapping = joint_mapping)
131  cs.limited[3] = False
132  cs.limited[4] = False
133  cs.limited[5] = False
134  cs.limited[7] = False
135  cs.limited[8] = False
136  cs.joint_handling[3] = 'NM'
137  cs.joint_handling[4] = 'NM'
138  cs.joint_handling[5] = 'NM'
139  cs.joint_handling[7] = 'NM'
140  cs.joint_handling[8] = 'NM'
141 
142  cs.ql = genmath.deg_to_rad*numpy.array([-12.0,-14.0, 0.0,-180.0,-180.0,-180.0,-180.0,-180.0,-180.0,-180.0,-180.0,-180.0,45.0 ,-180.0,-180.0])
143  cs.qh = genmath.deg_to_rad*numpy.array([ 17.0, 8.0, 0.2, 180.0, 180.0, 180.0, 180.0, 180.0, 180.0, 180.0, 180.0, 180.0,120.0, 180.0, 180.0])
144  cs.qh[2] = 0.2
145 
146  '''
147  Joint Number : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
148  Free Joint Number : 0 1 2 3 4 5 6 7 8
149  '''
150  cs.qh[2] = 0.2
151  cs.prismatic[2] = True
152  cs.free[3] = False
153  cs.free[4] = False
154  cs.free[6] = False
155  cs.free[7] = False
156  cs.free[9] = False
157  cs.free[11] = False
158  return cs
159 
160 # For DFKI AILA:
161 def AILA_config_settings(joint_mapping):
162  cs = conflib.Configuration_Settings(njoint = 7, DOF = 7, joint_mapping = joint_mapping)
163  cs.ql = genmath.deg_to_rad*numpy.array([ -90.0, -90.0, -90.0, -90.0, -90.0, -15.0, -45.0])
164  cs.qh = genmath.deg_to_rad*numpy.array([ 90.0, 90.0, 90.0, 90.0, 90.0, 15.0, 45.0])
165  return cs
166 
167 # For DFKI ROT:
168 def ROT_config_settings(joint_mapping):
169  cs = conflib.Configuration_Settings(njoint = 5, DOF = 5,joint_mapping = joint_mapping)
170  cs.ql = genmath.deg_to_rad*numpy.array([ -180.0, -90.0, -180.0, -90.0, -90.0])
171  cs.qh = genmath.deg_to_rad*numpy.array([ 180.0, 90.0, 180.0, 90.0, 90.0])
172  return cs
173 
174 def manip_geo_settings(manip_name):
175  if manip_name == 'PUMA':
176  return PUMA_geometry_settings
177  elif manip_name == 'PA10':
178  return PA10_geometry_settings
179  elif manip_name == 'PA10R':
180  return PA10R_geometry_settings
181  elif manip_name == 'EXO':
182  return EXO_geometry_settings
183  elif manip_name == 'AILA':
184  return AILA_geometry_settings
185  elif manip_name == 'ROT':
186  return ROT_geometry_settings
187  elif manip_name == 'PR2ARM':
188  return PR2ARM_geometry_settings
189  else:
190  assert False, "Error from manipulator_geometry(): " + manip_name + " is an Unknown Manipulator"
191 
192 def manip_config_settings(manip_name, joint_mapping = 'TM'):
193  if manip_name == 'PUMA':
194  settings = PUMA_config_settings(joint_mapping)
195  elif manip_name == 'PA10':
196  settings = PA10_config_settings(joint_mapping)
197  elif manip_name == 'PA10R':
198  settings = PA10R_config_settings(joint_mapping)
199  elif manip_name == 'EXO':
200  settings = EXO_config_settings(joint_mapping)
201  elif manip_name == 'AILA':
202  settings = AILA_config_settings(joint_mapping)
203  elif manip_name == 'ROT':
204  settings = ROT_config_settings(joint_mapping)
205  elif manip_name == 'PR2ARM':
206  settings = PR2ARM_config_settings(joint_mapping)
207  else :
208  assert False, "Error from manipulator_configuration(): " + manip_name + " is an Unknown Manipulator"
209 
210  return settings