Home Toolbox functions Sample projects Tutorials Downloads |
|
Reference: Chapters 7 and 10 in Multibody Mechanics and Visualization by Harry Dankowicz, published by Springer Verlag UK, 2004.
To illustrate
This Mambo project contains a non-stationary desk lamp. The configuration of the lamp may be specified in six independent steps, namely
The various parameters correspond to lengths and sizes of the different parts of the lamp.
q1, q2, and q3: coordinates of the point on the top of the base centered between the vertical posts relative to a coordinate system with origin at the reference point of the world observer and axes parallel to the basis vectors in the reference triad of the world observer.
q4, q5, and q6: 3-1-3 sequence of Euler angles corresponding to the orientation of the base relative to the reference triad of the world observer.
q7, q8, and q9: angles that describe the orientation of the lower, middle, and upper beam, respectively relative to the base.
q10 and q11: angles that describe the orientation of the bracket relative to the lower beam and of the lamp shade relative to the bracket, respectively.
lamp.zip (zip file, 16 kb, December 30, 2012) >Restart(): >DeclareObservers(W,Camera,Base,Lamp,Bracket,UpperBeam,LowerBeam,MiddleBeam): >DeclarePoints(W,Camera,Base,Lamp,Bracket,UpperBeam,LowerBeam,MiddleBeam): >DeclareTriads(w,camera,base,lamp,bracket,upperbeam,lowerbeam,middlebeam): >DefineNeighbors([W,Camera],[Camera,Base],[Base,LowerBeam],[LowerBeam,Bracket],[Bracket,Lamp],[Base,MiddleBeam],[Base,UpperBeam]): >DefineObservers([W,W,w],[Camera,Camera,camera],[Base,Base,base],[LowerBeam,LowerBeam,lowerbeam],[MiddleBeam,MiddleBeam,middlebeam],[UpperBeam,UpperBeam,upperbeam],[Bracket,Bracket,bracket],[Lamp,Lamp,lamp]): >DefinePoints([W,Camera,NullVector()],[Camera,Base,camera,q1,q2,q3],[Base,LowerBeam,base,0,0,p1],[Base,MiddleBeam,base,0,0,p2],[Base,UpperBeam,base,0,0,p3],[LowerBeam,Bracket,lowerbeam,0,0,p4],[Bracket,Lamp,bracket,0,0,p5]): >DefineObjects( [Base,'Cylinder',point=MakeTranslations(base,p9,0,-p10),radius=p11,length=2*p10,color=green], [Base,'Cylinder',point=MakeTranslations(base,0,p12,p13),radius=p14,length=2*p13,color=green], [Base,'Cylinder',point=MakeTranslations(base,0,-p12,p13),radius=p14,length=2*p13,color=green], seq([Base,'Cylinder',point=MakeTranslations(base,0,p12*cos((i-1)/20*Pi),(2*p13+p12*sin((i-1)/20*Pi))),orient=MakeRotations((i-1)/20*Pi,1),radius=p14,length=Pi*p12/20,color=green],i=1..21)): #Base >DefineObjects( [UpperBeam,'Cylinder',orient=MakeRotations(Pi/2,1),radius=p15,length=2*p12,color=blue], [UpperBeam,'Cylinder',point=MakeTranslations(upperbeam,0,0,(p6-p16)/2),radius=p17,length=(p6+p16),color=blue], [UpperBeam,'Cylinder',point=MakeTranslations(upperbeam,0,0,-p16),orient=MakeRotations(Pi/2,1),radius=p18,length=p19,color=blue], [UpperBeam,'Cylinder',point=MakeTranslations(upperbeam,0,-p20,0),orient=MakeRotations(Pi/2,1),radius=p21*27/28,length=p22,color=red], seq([UpperBeam,'Block',point=MakeTranslations(upperbeam,p21*sin((i-1)/20*2*Pi),-p20,p21*cos((i-1)/20*2*Pi)),orient=MakeRotations((i-1)/20*2*Pi,2),xlength=p21/8,ylength=p22*.98,zlength=p21/7*27/28,color=yellow],i=1..21)): #Upper beam >DefineObjects( [LowerBeam,'Cylinder',radius=p15,length=2*p12,orient=MakeRotations(Pi/2,1),color=blue], [LowerBeam,'Cylinder',point=MakeTranslations(lowerbeam,0,0,p4/2),radius=p23,length=p4,color=blue]): #Lower beam >DefineObjects( [MiddleBeam,'Cylinder',orient=MakeRotations(Pi/2,1),radius=p24,length=2*p12,color=blue], [MiddleBeam,'Cylinder',point=MakeTranslations(middlebeam,0,p20,p25/2),radius=p26,length=p25,color=blue], [MiddleBeam,'Cylinder',point=MakeTranslations(middlebeam,0,0,p25),orient=MakeRotations(Pi/2,1),radius=p27,length=p28,color=blue], [MiddleBeam,'Cylinder',point=MakeTranslations(middlebeam,0,-p20,0),orient=MakeRotations(Pi/2,1),radius=p21*27/28,length=p22,color=red], seq([MiddleBeam,'Block',point=MakeTranslations(middlebeam,p21*sin((i-1)/20*2*Pi),-p20,p21*cos((i-1)/20*2*Pi)),orient=MakeRotations((i-1)/20*2*Pi,2),xlength=p21/8,ylength=p22*.98,zlength=p21/7*27/28,color=yellow],i=1..21)): #Middle beam >DefineObjects( [Bracket,'Block',point=MakeTranslations(bracket,0,0,p5/2),xlength=p5/3,ylength=p5/3,zlength=p5,color=cyan], [Bracket,'Block',point=MakeTranslations(bracket,-p7/2,0,p8),xlength=p7,ylength=p5/3,zlength=p5/3,color=cyan], [Bracket,'Cylinder',orient=MakeRotations(Pi/2,1),radius=p5/20,length=p5/2.8,color=yellow], [Bracket,'Cylinder',point=MakeTranslations(bracket,0,0,p5),orient=MakeRotations(Pi/2,1),radius=p5/20,length=p5/2.8,color=yellow], [Bracket,'Cylinder',point=MakeTranslations(bracket,-p7,0,p8),orient=MakeRotations(Pi/2,1),radius=p5/20,length=p5/2.8,color=yellow]): #Bracket >DeclarePoints(LampCenter,LampTop,LampBottom,LampMiddle,seq(cat(UpperSide,i),i=1..13),seq(cat(LowerSide,i),i=1..13)): >DeclareTriads(seq(cat(upperside,i),i=1..13),seq(cat(lowerside,i),i=1..13)): >DefineTriads(seq([lamp,cat(upperside,i),(i-1)/12*2*Pi,3],i=1..13),seq([cat(upperside,i),cat(lowerside,i),Pi/6,2],i=1..13)): >DefinePoints([Lamp,LampCenter,lamp,-p29,0,p30],[LampCenter,LampTop,lamp,0,0,-p31/2],[LampCenter,LampBottom,lamp,0,0,p31*8/12],[LampCenter,LampMiddle,lamp,0,0,p31/2],seq([LampCenter,cat(UpperSide,i),cat(upperside,i),p31*.3,0,0],i=1..13),seq([cat(UpperSide,i),cat(LowerSide,i),[cat(upperside,i),0,0,p31/2],[cat(lowerside,i),0,0,p31/6]],i=1..13)): >DefineObjects( [Lamp,'Block',point=MakeTranslations(lamp,-p29/2,0,0),xlength=p29,ylength=p5/3,zlength=p5/3,color=cyan], [Lamp,'Cylinder',point=LampCenter,radius=p31*.2,length=p31*.9,color="{sin(t)^2,sin(t)^2,sin(t)^2}"], [Lamp,'Sphere',point=LampBottom,orient=Matrix(3,3,[[1,0,0],[0,1,0],[0,0,.7]]),radius=p31*.3,color="{sin(t)^2,sin(t)^2,sin(t)^2}"], seq([Lamp,'Block',point=cat(UpperSide,i),orient=cat(upperside,i),xlength=p31/80,ylength=p31/10,zlength=p31,color=blue],i=1..13), [Lamp,'Cylinder',point=LampTop,radius=p31*.35,length=p31/10,color=blue], [Lamp,'Cylinder',point=LampMiddle,radius=p31*.35,length=p31/10,color=blue], seq([Lamp,'Block',point=cat(LowerSide,i),orient=cat(lowerside,i),xlength=p31/20,ylength=p31/3.5,zlength=p31/3,color=blue],i=1..13)): #Lamp >DeclareStates(seq(cat(q,i),i=1..11)): >DeclarePoints(HUpperBeam,HBracket): >DefinePoints([UpperBeam,HUpperBeam,upperbeam,0,0,p6],[Bracket,HBracket,bracket,-p7,0,p8]): >f1:=FindTranslation(HBracket,HUpperBeam) &oo MakeTranslations(base,1)=0: >f2:=FindTranslation(HBracket,HUpperBeam) &oo MakeTranslations(base,3)=0: >motionconst:={q9t=-q8t} union DiffTime({f1,f2}): >GeometryOutput(main=W,parameters=[Pi=3.1416,scale=.1,p11=5.5,p10=3.5,p9=3,p12=2,p13=7,p14=.5,p1=11,p2=12.5,p3=14,p4=45,p5=3.5,p15=.25,p6=45,p16=15,p17=.5,p18=1.5,p19=9.5,p20=1,p21=.75,p22=.3,p23=.125,p24=.375,p25=10,p26=.25,p27=1.25,p28=8,p8=2.6,p7=1.5,p31=8,p29=5,p30=2],states=[q1,q2,q3,q4,q5,q6,q7=1.200039725,q8=1.8,q9=1.2,q10=-.6769771893,q11=2],checkargs,checktree,filename="lamp.geo"): >MotionOutput(ode=kde,parameters=[Pi=3.1416,scale=.1,p11=5.5,p10=3.5,p9=3,p12=2,p13=7,p14=.5,p1=11,p2=12.5,p3=14,p4=45,p5=3.5,p15=.25,p6=45,p16=15,p17=.5,p18=1.5,p19=9.5,p20=1,p21=.75,p22=.3,p23=.125,p24=.375,p25=10,p26=.25,p27=1.25,p28=8,p8=2.6,p7=1.5,p31=8,p29=5,p30=2],states=[q1,q2,q3,q4,q5,q6,q7=1.200039725,q8=1.8,q9=1.2,q10=-.6769771893,q11=2],insignals=[u1=0,u2=0,u3=0,u4=0,u5=0,u6=0,u7=-.2*cos(t),u8=cos(t)],checkargs,checksings,filename="lamp.dyn"); |
©2004-2017 Harry Dankowicz Mechanical Science and Engineering University of Illinois at Urbana-Champaign | Home Toolbox functions Sample projects Tutorials Downloads |