MAMBO logo MAMBO & the MAMBO Toolbox MAMBO logo

Sample project - Hinge

To illustrate the use of auxiliary observers to represent linked mechanisms.

This Mambo project contains two non-stationary blocks and a non-stationary cylinder. The non-stationary blocks are constrained to coincide at one end with the non-stationary cylinder. The cylinder is fixed relative to one of the blocks. The linked mechanism may be positioned and oriented relative to the world observer in three independent steps, namely
  1. Specify a position of the cylinder.
  2. Specify an orientation of the cylinder.
  3. Specify a rotation of the second block about the cylinder.

l1, l2, and l3: lengths of the sides of the blocks.

radius: radius of the cylinder.

q1, q2, and q3: coordinates of the center of the cylinder 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-2-1 sequence of Euler angles representing the orientation of the first block relative to the reference triad of the world observer.

theta: angle of the rotation of the second block about the joint.

hinge.zip (zip file, 7 kb, December 30, 2012)
This zip archive contains MAMBO and the MAMBO toolbox source files to visualize the MAMBO project and regenerate visualization files using maple 16, mupad 5.6.0 (matlab R2011a), and mathematica 8.0 versions of the code found below.


Click here to expand/contract!
>Restart():

Click here to expand/contract!
>DeclareObservers(world,auxiliary_observer_A1,auxiliary_observer_A2,rod1,rod2):
>DeclarePoints(W,Joint,Rod1,Rod2):
>DeclareTriads(w,a1,a2):
>DefineObservers([world,W,w],[auxiliary_observer_A1,Joint,a1],[auxiliary_observer_A2,Joint,a2],[rod1,Rod1,a1],[rod2,Rod2,a2]):
>DefinePoints([W,Joint,w,q1,q2,q3],[Joint,Rod1,a1,l1/2,0,0],[Joint,Rod2,a2,-l1/2,0,0]):
>DefineTriads([w,a1,[q4,3],[q5,1],[q6,3]],[a1,a2,theta,2]):
>DefineNeighbors([world,auxiliary_observer_A1],[auxiliary_observer_A1,rod1],[auxiliary_observer_A1,auxiliary_observer_A2],[auxiliary_observer_A2,rod2]):

Click here to expand/contract!
>DefineObjects(
   [rod1,'Block',point=MakeTranslations(a1,0,l2/2,l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow],
   [rod1,'Block',point=MakeTranslations(a1,0,l2/2,-l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow],
   [rod1,'Block',point=MakeTranslations(a1,0,-l2/2,-l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow],
   [rod1,'Block',point=MakeTranslations(a1,0,-l2/2,l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow],
   [rod1,'Block',point=MakeTranslations(a1,l1/2,0,l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow],
   [rod1,'Block',point=MakeTranslations(a1,l1/2,0,-l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow],
   [rod1,'Block',point=MakeTranslations(a1,-l1/2,0,-l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow],
   [rod1,'Block',point=MakeTranslations(a1,-l1/2,0,l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow],
   [rod1,'Block',point=MakeTranslations(a1,l1/2,l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow],
   [rod1,'Block',point=MakeTranslations(a1,l1/2,-l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow],
   [rod1,'Block',point=MakeTranslations(a1,-l1/2,-l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow],
   [rod1,'Block',point=MakeTranslations(a1,-l1/2,l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow]):
>DefineObjects(
   [rod2,'Block',point=MakeTranslations(a2,0,l2/2,l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow],
   [rod2,'Block',point=MakeTranslations(a2,0,l2/2,-l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow],
   [rod2,'Block',point=MakeTranslations(a2,0,-l2/2,-l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow],
   [rod2,'Block',point=MakeTranslations(a2,0,-l2/2,l3/2),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30,color=yellow],
   [rod2,'Block',point=MakeTranslations(a2,l1/2,0,l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow],
   [rod2,'Block',point=MakeTranslations(a2,l1/2,0,-l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow],
   [rod2,'Block',point=MakeTranslations(a2,-l1/2,0,-l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow],
   [rod2,'Block',point=MakeTranslations(a2,-l1/2,0,l3/2),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30,color=yellow],
   [rod2,'Block',point=MakeTranslations(a2,l1/2,l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow],
   [rod2,'Block',point=MakeTranslations(a2,l1/2,-l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow],
   [rod2,'Block',point=MakeTranslations(a2,-l1/2,-l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow],
   [rod2,'Block',point=MakeTranslations(a2,-l1/2,l2/2,0),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3,color=yellow]):
>DefineObjects([auxiliary_observer_A1,'Cylinder',orient=MakeRotations(Pi/2,1),length=l2+.1,radius=2*l3/3*radius,color=red]):

Click here to expand/contract!
>GeometryOutput(main=world,parameters=[l1,l2,l3,radius],states=[q1,q2,q3,q4,q5,q6,theta],anims=[c4=cos(q4),c5=cos(q5),c6=cos(q6),s4=sin(q4),s5=sin(q5),s6=sin(q6)],checktree,checkargs,filename="hinge.geo");
>MotionOutput(ode={q1t=u1,q2t=u2,q3t=u3,q4t=u4,q5t=u5,q6t=u6,thetat=u7},states=[q1,q2,q3,q4,q5,q6,theta],parameters=[l1=2,l2=.25,l3=.05,radius=1.2],anims=[c4=cos(q4),c5=cos(q5),c6=cos(q6),s4=sin(q4),s5=sin(q5),s6=sin(q6)],insignals=[u1=(t&>0)*(t&<1)*cos(6.28*t),u2=(t&>1)*(t&<2)*cos(6.28*t),u3=(t&>2)*(t&<3)*cos(6.28*t),u4=(t&>3)*(t&<4)*cos(6.28*t),u5=(t&>4)*(t&<5)*cos(6.28*t),u6=(t&>5)*(t&<6)*cos(6.28*t),u7=(t&>6)*(t&<8)*cos(6.28*t)+(t&>8)*t],checksings,checkargs,filename="hinge.dyn");

Sample projects