Home Toolbox functions Sample projects Tutorials Downloads |
|
Reference: Chapter 1 in Multibody Mechanics and Visualization by Harry Dankowicz, published by Springer Verlag UK, 2004.
To illustrate
This Mambo project contains two non-stationary blocks and one stationary block (representing the reference configuration). The non-stationary blocks may be repositioned and reoriented relative to the reference configuration. For each non-stationary block, this is achieved in five independent steps, namely
l1, l2, and l3: lengths of the sides of the block.
a1x, a1y, a1z, b1x, b1y, and b1z: coordinates of the points A and B on the first block relative to a coordinate system with origin at the center of the block and axes parallel to the edges of the block.
a2x, a2y, a2z, b2x, b2y, and b2z: coordinates of the points A and B on the second block relative to a coordinate system with origin at the center of the block and axes parallel to the edges of the block.
marker: radius of six spheres placed at the points A and B on the stationary block and the two non-stationary blocks.
x1, y1, and z1: coordinates of the point A on the first block in the final configuration relative to a coordinate system with origin at the point A in the reference configuration and axes parallel to the edges of the block. These correspond to the pure translation applied to the first block.
x2, y2, and z2: coordinates of the point A on the first block in the final configuration relative to a coordinate system with origin at the point A in the reference configuration and axes parallel to the edges of the block. These correspond to the pure translation applied to the second block.
theta11 and theta12: angles that describe the pure rotation that aligns the point B on the first block with its location in the final configuration.
theta13: angle that describes the subsequent pure rotation about the axis through A and B on the first block.
theta21 and theta22: angles that describe the pure rotation that aligns the point B on the second block with its location in the final configuration.
theta23: angle that describes the subsequent pure rotation about the axis through A and B on the second block.
block.zip (zip file, 10 kb, January 19, 2013) >Restart(): >DeclareObservers(world,stationary_block,reference_configuration1,reference_configuration2,auxiliary_observer_A1,auxiliary_observer_A2,auxiliary_observer_B1,auxiliary_observer_B2,actual_configuration1,actual_configuration2,moving_block1,moving_block2): >DeclarePoints(W,SB,RC1,RC2,A1,A2,B1,B2,AC1,AC2,MB1,MB2): >DeclareTriads(w,sb,rc1,rc2,a1,a2,b1,b2,ac1,ac2,mb1,mb2): >DefineObservers([world,W,w],[stationary_block,SB,sb],[reference_configuration1,RC1,rc1],[reference_configuration2,RC2,rc2],[auxiliary_observer_A1,A1,a1],[auxiliary_observer_A2,A2,a2],[auxiliary_observer_B1,B1,b1],[auxiliary_observer_B2,B2,b2],[actual_configuration1,AC1,ac1],[actual_configuration2,AC2,ac2],[moving_block1,MB1,mb1],[moving_block2,MB2,mb2]): >DefinePoints([W,SB,NullVector()],[W,RC1,w,a1x,a1y,a1z],[W,RC2,w,a2x,a2y,a2z],[RC1,A1,rc1,x1,y1,z1],[RC2,A2,rc2,x2,y2,z2],[A1,B1,NullVector()],[A2,B2,NullVector()],[B1,AC1,NullVector()],[B2,AC2,NullVector()],[AC1,MB1,ac1,-a1x,-a1y,-a1z],[AC2,MB2,ac2,-a2x,-a2y,-a2z]): >DefineTriads([w,sb,0,1],[w,rc1,0,1],[w,rc2,0,1],[rc1,a1,0,1],[rc2,a2,0,1],[a1,b1,Matrix([[c11*c12,-s11,c11*s12],[s11*c12,c11,s11*s12],[-s12,0,c12]])],[a2,b2,Matrix([[c21*c22,-s21,c21*s22],[s21*c22,c21,s21*s22],[-s22,0,c22]])],[b1,ac1,Matrix([[rot111,rot112,rot113],[rot121,rot122,rot123],[rot131,rot132,rot133]])],[b2,ac2,Matrix([[rot211,rot212,rot213],[rot221,rot222,rot223],[rot231,rot232,rot233]])],[ac1,mb1,0,1],[ac2,mb2,0,1]): >DefineNeighbors([world,stationary_block],[world,reference_configuration1],[world,reference_configuration2],[reference_configuration1,auxiliary_observer_A1],[reference_configuration2,auxiliary_observer_A2],[auxiliary_observer_A1,auxiliary_observer_B1],[auxiliary_observer_A2,auxiliary_observer_B2],[auxiliary_observer_B1,actual_configuration1],[auxiliary_observer_B2,actual_configuration2],[actual_configuration1,moving_block1],[actual_configuration2,moving_block2]): >DefineObjects( [stationary_block,'Block',point=MakeTranslations(sb,0,l2/2,l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow], [stationary_block,'Block',point=MakeTranslations(sb,0,l2/2,-l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow], [stationary_block,'Block',point=MakeTranslations(sb,0,-l2/2,-l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow], [stationary_block,'Block',point=MakeTranslations(sb,0,-l2/2,l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow], [stationary_block,'Block',point=MakeTranslations(sb,l1/2,0,l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow], [stationary_block,'Block',point=MakeTranslations(sb,l1/2,0,-l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow], [stationary_block,'Block',point=MakeTranslations(sb,-l1/2,0,-l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow], [stationary_block,'Block',point=MakeTranslations(sb,-l1/2,0,l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow], [stationary_block,'Block',point=MakeTranslations(sb,l1/2,l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow], [stationary_block,'Block',point=MakeTranslations(sb,l1/2,-l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow], [stationary_block,'Block',point=MakeTranslations(sb,-l1/2,-l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow], [stationary_block,'Block',point=MakeTranslations(sb,-l1/2,l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow]): >DefineObjects( [moving_block1,'Block',point=MakeTranslations(mb1,0,l2/2,l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=red], [moving_block1,'Block',point=MakeTranslations(mb1,0,l2/2,-l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=red], [moving_block1,'Block',point=MakeTranslations(mb1,0,-l2/2,-l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=red], [moving_block1,'Block',point=MakeTranslations(mb1,0,-l2/2,l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=red], [moving_block1,'Block',point=MakeTranslations(mb1,l1/2,0,l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=red], [moving_block1,'Block',point=MakeTranslations(mb1,l1/2,0,-l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=red], [moving_block1,'Block',point=MakeTranslations(mb1,-l1/2,0,-l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=red], [moving_block1,'Block',point=MakeTranslations(mb1,-l1/2,0,l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=red], [moving_block1,'Block',point=MakeTranslations(mb1,l1/2,l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=red], [moving_block1,'Block',point=MakeTranslations(mb1,l1/2,-l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=red], [moving_block1,'Block',point=MakeTranslations(mb1,-l1/2,-l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=red], [moving_block1,'Block',point=MakeTranslations(mb1,-l1/2,l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=red]): >DefineObjects( [moving_block2,'Block',point=MakeTranslations(mb2,0,l2/2,l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=red], [moving_block2,'Block',point=MakeTranslations(mb2,0,l2/2,-l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=red], [moving_block2,'Block',point=MakeTranslations(mb2,0,-l2/2,-l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=red], [moving_block2,'Block',point=MakeTranslations(mb2,0,-l2/2,l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=red], [moving_block2,'Block',point=MakeTranslations(mb2,l1/2,0,l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=red], [moving_block2,'Block',point=MakeTranslations(mb2,l1/2,0,-l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=red], [moving_block2,'Block',point=MakeTranslations(mb2,-l1/2,0,-l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=red], [moving_block2,'Block',point=MakeTranslations(mb2,-l1/2,0,l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=red], [moving_block2,'Block',point=MakeTranslations(mb2,l1/2,l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=red], [moving_block2,'Block',point=MakeTranslations(mb2,l1/2,-l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=red], [moving_block2,'Block',point=MakeTranslations(mb2,-l1/2,-l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=red], [moving_block2,'Block',point=MakeTranslations(mb2,-l1/2,l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=red]): >DefineObjects([actual_configuration1,'Sphere',radius=marker,color=green],[actual_configuration1,'Sphere',point=MakeTranslations(ac1,b1x-a1x,b1y-a1y,b1z-a1z),radius=marker,color=blue]): >DefineObjects([reference_configuration1,'Sphere',radius=marker,color=green],[reference_configuration1,'Sphere',point=MakeTranslations(rc1,b1x-a1x,b1y-a1y,b1z-a1z),radius=marker,color=blue]): >DefineObjects([actual_configuration2,'Sphere',radius=marker,color=green],[actual_configuration2,'Sphere',point=MakeTranslations(ac2,b2x-a2x,b2y-a2y,b2z-a2z),radius=marker,color=blue]): >DefineObjects([reference_configuration2,'Sphere',radius=marker,color=green],[reference_configuration2,'Sphere',point=MakeTranslations(rc2,b2x-a2x,b2y-a2y,b2z-a2z),radius=marker,color=blue]): >rotmat1:=MakeRotations(theta13,b1x-a1x,b1y-a1y,b1z-a1z): >rotmat2:=MakeRotations(theta23,b2x-a2x,b2y-a2y,b2z-a2z): >rot:=[seq(seq(cat(rot1,i,j)=rotmat1[i,j],i=1..3),j=1..3),seq(seq(cat(rot2,i,j)=rotmat2[i,j],i=1..3),j=1..3)]: >GeometryOutput(main=world,states=[x1,y1,z1,x2,y2,z2,theta11,theta12,theta13,theta21,theta22,theta23],parameters=[a1x=-.5,a1y=-.75,a1z=-.25,b1x=.5,b1y=.75,b1z=-.25,a2x=0,a2y=0,a2z=0,b2x=.5,b2y=.75,b2z=-.25,l1=1,l2=1.5,l3=.5,marker=0.1],anims=[c11=cos(theta11),c12=cos(theta12),s11=sin(theta11),s12=sin(theta12),c21=cos(theta21),c22=cos(theta22),s21=sin(theta21),s22=sin(theta22),codegen:-optimize(rot)],checktree,checkargs,filename="block.geo"); >MotionOutput(ode={x1t=u1,y1t=u2,z1t=u3,x2t=-u1,y2t=-u2,z2t=-u3,theta11t=u4,theta12t=u5,theta13t=u6,theta21t=u4,theta22t=u5,theta23t=u6},states=[x1,y1,z1,x2,y2,z2,theta11,theta12,theta13,theta21,theta22,theta23],parameters=[a1x=-.5,a1y=-.75,a1z=-.25,b1x=.5,b1y=.75,b1z=-.25,a2x=0,a2y=0,a2z=0,b2x=.5,b2y=.75,b2z=-.25,l1=1,l2=1.5,l3=.5,marker=0.1],insignals=[u1=.5,u2=0,u3=.1,u4=0,u5=0,u6=.5],anims=[c11=cos(theta11),c12=cos(theta12),s11=sin(theta11),s12=sin(theta12),c21=cos(theta21),c22=cos(theta22),s21=sin(theta21),s22=sin(theta22),codegen:-optimize(rot)],checksings,checkargs,filename="block.dyn"); |
©2004-2017 Harry Dankowicz Mechanical Science and Engineering University of Illinois at Urbana-Champaign | Home Toolbox functions Sample projects Tutorials Downloads |