Home Toolbox functions Sample projects Tutorials Downloads |
|
Reference: Chapter 9 in Multibody Mechanics and Visualization by Harry Dankowicz, published by Springer Verlag UK, 2004.
To illustrate
This Mambo project contains a non-stationary blocks and a stationary plane. The non-stationary block may be positioned and oriented relative to the world observer in two independent steps, namely
lx, ly, and lz: lengths of the sides of the blocks.
Lx, Ly, and Lz: lengths of the sides of the plane.
Bx, By, and Bz: coordinates of the point B in a coordinates system with origin at the center of the block and axes parallel to the edges of the block.
marker: radius of a sphere at the point B.
n1, n2, and n3: coordinates relative to the world reference triad of a vector perpendicular to the plane. If they all equal zero, the normal direction to the plane is unspecified.
q1, q2, and q3: coordinates of the point B in a coordinate system with origin at the reference point of the world observer and axes parallel to the basis vectors of the reference triad of the world observer.
q4, q5, and q6: 3-1-3 sequence of Euler angles representing the orientation of the block relative to the reference triad of the world observer.
toplane.zip (zip file, 15 kb, December 30, 2012) >Restart(): >DeclareObservers(W,B): >DeclarePoints(W,B,BlockCenter,seq(seq(cat(E,i,j),i=1..3),j=1..4)): >DeclareTriads(w,b): >DefineObservers([W,W,w],[B,B,b]): >DefinePoints([W,B,w,q1,q2,q3],[B,BlockCenter,b,Bx,By,Bz],[BlockCenter,E11,b,0,ly/2,lz/2],[BlockCenter,E12,b,0,ly/2,-lz/2],[BlockCenter,E13,b,0,-ly/2,-lz/2],[BlockCenter,E14,b,0,-ly/2,lz/2],[BlockCenter,E21,b,lx/2,0,lz/2],[BlockCenter,E22,b,lx/2,0,-lz/2],[BlockCenter,E23,b,-lx/2,0,-lz/2],[BlockCenter,E24,b,-lx/2,0,lz/2],[BlockCenter,E31,b,lx/2,ly/2,0],[BlockCenter,E32,b,lx/2,-ly/2,0],[BlockCenter,E33,b,-lx/2,-ly/2,0],[BlockCenter,E34,b,-lx/2,ly/2,0]): >DefineTriads(w,b,[q4,3],[q5,1],[q6,3]): >DefineNeighbors([W,B]): >assume(n1,real):assume(n2,real):assume(n3,real): >n:=MakeTranslations(w,n1,n2,n3): >t3:=(1/VectorLength(n)) &** n: >t1:=(1/VectorLength(t3 &xx MakeTranslations(w,0,-((n1^2+n2^2)&==0),((n1^2+n2^2)&!=0)))) &** (t3 &xx MakeTranslations(w,0,-((n1^2+n2^2)&==0),((n1^2+n2^2)&!=0))): >t2:=t3 &xx t1: >rot:=[seq(seq(cat(r,i,j)=simplify(MakeTranslations(w,i) &oo cat(t,j)),i=1..3),j=1..3)]: >DefineObjects( seq([B,'Block',point=cat(E,1,j),xlength=lx,ylength=(lx+ly+lz)/30,zlength=(lx+ly+lz)/30,color=yellow],j=1..4), seq([B,'Block',point=cat(E,2,j),xlength=(lx+ly+lz)/30,ylength=ly,zlength=(lx+ly+lz)/30,color=yellow],j=1..4), seq([B,'Block',point=cat(E,3,j),xlength=(lx+ly+lz)/30,ylength=(lx+ly+lz)/30,zlength=lz,color=yellow],j=1..4), [B,'Sphere',radius=marker,color=red], [W,'Block',orient=Matrix(3,3,(i,j)->cat(r,i,j)),xlength=Lx,ylength=Ly,zlength=Lz,color=green]): >DeclareStates(q1,q2,q3,q4,q5,q6): >linvel:=LinearVelocity(W,B): >angvel:=AngularVelocity(w,b): >kde:={(case1+case2+case4)*linvel &oo MakeTranslations(w,1)+case3*linvel &oo MakeTranslations(w,2) = u1, (case1+case4)*linvel &oo MakeTranslations(w,2)+(case2+case3)*linvel &oo MakeTranslations(w,3) = u2, seq(angvel &oo MakeTranslations(b,i) = cat(u,i+3),i=1..3), (1-case4)*linvel &oo n + case4*(linvel &oo MakeTranslations(w,3)-u3)= 0}: >GeometryOutput(main=W,states=[q1,q2,q3,q4,q5,q6],anims=[codegen:-optimize(rot)],parameters=[Lx=5,Ly=5,Lz=.01,lx=.25,ly=.5,lz=1,Bx=0.125,By=.25,Bz=.5,marker=.1,n1,n2,n3],checkargs,checktree,filename="toplane.geo"): >MotionOutput(ode=kde,states=[q1,q2,q3,q4,q5=1,q6=.5],parameters=[Lx=5,Ly=5,Lz=.01,lx=.25,ly=.5,lz=1,Bx=0.125,By=.25,Bz=.5,marker=.1,n1,n2,n3],insignals=[u1=-cos(2*t),u2=-cos(t),u3=sin(t),u4=cos(2*t),u5=0.1,u6=sin(t),case1=(n3&!=0),case2=(n3&==0)*(n2&!=0),case3=(n3&==0)*(n2&==0)*(n1&!=0),case4=(n3&==0)*(n2&==0)*(n1&==0)],anims=[codegen:-optimize(rot)],checkargs,checksings,filename="toplane.dyn"); |
©2004-2017 Harry Dankowicz Mechanical Science and Engineering University of Illinois at Urbana-Champaign | Home Toolbox functions Sample projects Tutorials Downloads |