{VERSION 5 0 "IBM INTEL LINUX" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 }{CSTYLE "Text" -1 200 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }{CSTYLE "" -1 202 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 }{CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 0 0 1 }1 1 0 0 0 0 2 0 2 0 2 2 -1 1 }{PSTYLE "Heading 1" -1 3 1 {CSTYLE "" -1 -1 "MS Se rif" 1 18 0 0 0 1 2 1 2 2 2 2 1 0 0 1 }1 1 0 0 8 4 2 0 2 0 2 2 -1 1 } } {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT 200 140 "In this worksheet we wil l set up the equations to solve the forward displacement problem of St ewart-Gough platforms, using soma coordinates." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 58 "We follow the proof of the paper by Charles W. Wampl er on " }{TEXT 256 115 "forward displacement analysis of general six-i n-parallel SPS (Stewart) platform manipulators using Soma coordinates " }{TEXT -1 2 ", " }{TEXT 257 17 "Mech. Mach Theory" }{TEXT -1 36 ", V ol 31, No 3, pages 331-337, 1996." }{TEXT -1 0 "" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 76 "Running this worksheet produces the file \"platfor m\" in the directory \"/tmp\"." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "UseHardwareFloats := true:" }}}{SECT 0 {PARA 3 "" 0 " " {TEXT -1 17 "1. cross products" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 78 "We define the cross product of two vectors via a matrix vector mul tiplication:" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "X := Vector([x[1],x[2],x[3]]):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "Lambda := v -> Matrix([[0,v[3],-v[2]],[-v[3],0,v[1]], [v[2],-v[1],0]]):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "# Line arAlgebra[MatrixVectorMultiply](Lambda(v),X);" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 22 "2.The matrices A and B" }}{PARA 0 "" 0 "" {TEXT -1 124 "Since we will use A and B for the matrices of the coordinates of \+ base and end plate, we use Alpha and Beta for the matrices." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "unprotect(Beta);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 112 "for i from 1 to 6 do\n a[i] := Vector([ A[i,1],A[i,2],A[i,3]]):\n b[i] := Vector([B[i,1],B[i,2],B[i,3]]):\nen d do:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 301 "Beta := proc(a,b, i)\n description `returns matrix B using vectors a[i] and b[i]`:\n l ocal d,t,c,e:\n d := Vector([0,convert(b[i]-a[i],list)]):\n t := Lin earAlgebra[Transpose](a[i]-b[i]):\n c := -Lambda(a[i]+b[i]):\n e := \+ Matrix([convert(t,list),op(convert(c,listlist))]);\n return < d | e > :\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "# Beta(a,b, 1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 342 "Alpha := proc(a,b,L ,i)\n description `returns matrix A using L, vectors a[i] and b[i]`: \n local I3,I4,s,c,d,cd,m1,m2,m3,e,f,g,h:\n I3 := Matrix(3,3,shape=i dentity):\n I4 := Matrix(4,4,shape=identity):\n s := LinearAlgebra[D otProduct](b[i],b[i],conjugate=false)\n + LinearAlgebra[DotProduct ](a[i],a[i],conjugate=false)\n - L[i]^2 + L0^2:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 144 " c := LinearAlgebra[CrossProduct](b[i],a[i]):\n \+ d := LinearAlgebra[DotProduct](a[i],b[i],conjugate=false):\n cd := V ector([d,convert(c,list)]):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 37 " f \+ := LinearAlgebra[Multiply](s,I4):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 69 " m1 := LinearAlgebra[Multiply](b[i],LinearAlgebra[Transpose](a[i] ));" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 69 " m2 := LinearAlgebra[Multip ly](a[i],LinearAlgebra[Transpose](b[i]));" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 38 " m3 := LinearAlgebra[Multiply](d,I3):" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 20 " e := m1 + m2 - m3:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 115 " g := < cd | Matrix([convert(LinearAlgebra[Transpos e](c),list),\n op(convert(e,listlist))]) >:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 " h := LinearAlgebra[Multiply](2,g) :" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 25 " return f - h:\nend proc:" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "# Alpha(a,b,L,3);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "tAlpha := (a,b,L,i) -> Linea rAlgebra[Multiply](1/L0,Alpha(a,b,L,i)):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "# tAlpha(a,b,L,3);" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 31 "3. Formulation of the Equations" }}{EXCHG {PARA 0 "" 0 " " {TEXT 200 107 "The unknowns of the system are the vector x and x wit h a hat, which we will respectively denote by X and Y." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "X := Vector([x[1],x[2],x[3],x[4]]): " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "Y := Vector([y[1],y[2], y[3],y[4]]):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "Xt := Linea rAlgebra[Transpose](X):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 " Yt := LinearAlgebra[Transpose](Y):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "eq[1] := LinearAlgebra[DotProduct](Xt,Y,conjugate=fal se) - 1 + lambda^2:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "eq[2 ] := LinearAlgebra[DotProduct](Xt,X,conjugate=false) - 1 - lambda^2:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "eq[3] := LinearAlgebra[Do tProduct](Yt,Y,conjugate=false) - 1 - lambda^2:" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 183 "for k from 1 to 5 do\n w := tAlpha(a,b,L,k) \+ + LinearAlgebra[Multiply](1/lambda,Beta(a,b,k)):\n eq[k+3] := LinearA lgebra[Multiply](Xt,LinearAlgebra[MatrixVectorMultiply](w,Y)):\nend do :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "# eq[4];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "# expand(eq[4]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "A := LinearAlgebra[RandomMatrix](6,3,gene rator=-1.0..0.0):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "B := L inearAlgebra[RandomMatrix](6,3,generator=0.0..1.0):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "distance := (x,y) -> sqrt((x[1]-y[1])^2+( x[2]-y[2])^2+(x[3]-y[3])^2):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "L := seq(distance(a[k],b[k]),k=1..6):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "L0 := L[6]:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "lambda := stats[random,normald](1):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "# expand(eq[4]);" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 29 "4. Writing the system to file" }}{EXCHG {PARA 0 "" 0 "" {TEXT 200 74 "To write the polynomials into a nice format to file, we \+ use the following:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 202 624 "pr intpoly := proc(p::polynom)\n description `writes p, two terms per li ne, using lprint`:\n local lp,i,s:\n lp := convert(p,list);\n for i from 1 to nops(lp) do\n s := convert(lp[i],string); \n if type( lcoeff(lp[i]),float) or type(lcoeff(lp[i]),integer) then \n if l coeff(lp[i]) > 0 then\n printf(\"+%s\",s);\n else\n \+ printf(\"%s\",s);\n end if;\n else\n if Im(lcoeff(lp[ i])) > 0 then\n printf(\"+%s\",s);\n else\n print f(\"%s\",s);\n end if;\n end if;\n if (i < nops(lp)) and \+ (i mod 2 = 0) then\n printf(\"\\n\");\n end if;\n end do;\n printf(\";\\n\");\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 116 "writeto(\"/tmp/platform\"):\nprintf(\"8\\n\"):\nfor n from 1 \+ to 8 do\n printpoly(expand(eq[n])):\nend do:\nwriteto(terminal):" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}}}{MARK "7 13 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }