# roll pitch yaw to orientation altitude tool

I require a function to convert angles expressed in Roll, Pitch, Yaw to O (orientation), a (altitude), t (tool). The oat notation is used by
the Puma and Kawasaki robots to express the orientation of the end effector.
I have a tempted to write the code in python. Please can someone validate my code. If any one can help, it does not matter what computer language the code is written in please email me: andrew at vaporise dot net.
r = 50 # roll p = 60 # pitch y = 90 # yaw
#generate empty 4x4 matrix inp = [[0,0,0,0], [0,0,0,0], [0,0,0,0],[0,0,0,0]]
#Convert roll, pitch, roll to homogeneous transform matrix # Equation from # Robot Manipulators: Mathematics, Programming and Control # Richard P. Paul # page 47 inp = cos(r)*cos(p) inp = cos(r)*sin(p)*sin(y) - sin(r)*cos(y) inp = cos(r)*sin(p)*cos(y) + sin(r)*sin(y) inp = 0
inp = sin(r)*cos(p) inp = sin(r)*sin(p)*sin(y) + cos(r)*cos(y) inp = sin(r)*sin(p)*cos(y) - cos(r)*sin(y) inp = 0
inp = -sin(p) inp = cos(p)*sin(y) inp = cos(p)*cos(y) inp = 0
inp = 0 inp = 0 inp = 0 inp = 1
print inp
#convert matrix to oat # Equations from # Robotics: Control, sensing, vision and intelligence. # K.S. Fu R.C. Gonzalez, C.S.G. Lee # page 60 t=atan2(inp, -inp) ct=cos(t) st=sin(t) p = ((-inp * ct) + (inp*st)) a = atan2(-inp,p) top = ((inp*st) + (inp*ct)) bottom = ((inp*st)+(inp*ct)) o=atan2(top,bottom)
o = o * 180 / pi a = a * 180 / pi t = t * 180 / pi
print "o=",o print "a=",a print "t=",t
Andrew Seaford andrew at vaporise dot net
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
snipped-for-privacy@hotmail.com wrote:

looks reasonable to me. haven't checked the exact equations, but it looks like you are loading the 4X4 matrix correctly. does python represent matrices as [row][column]? what values of o,a,t do you get?
Mike Ross
--

<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
snipped-for-privacy@hotmail.com wrote:

But in what order are roll, pitch, and yaw applied, and are they relative or absolute? There are 24 different representations possible. Here's C code to support all 24:
http://www.acm.org/pubs/tog/GraphicsGems/gemsiv/euler_angle
John Nagle