MAMBO logo MAMBO & the MAMBO Toolbox MAMBO logo

Sample project - Puck

To illustrate the hierarchical structure representing a single moving rigid body.

This Mambo project contains a non-stationary puck and one stationary ice rink. The non-stationary puck may be repositioned and reoriented relative to the world observer in two independent steps, namely
  1. Specify the location of the puck's center on a plane parallel to the rink.
  2. Specify the rotation of the puck about an axis through the center of the puck and perpendicular to the plane of the rink.
The motion is governed by an elastic restoring force during collisions between the puck and the edges of the rink.

k: elastic property of the rink and puck during collisions.

q1 and q2: coordinates of the projection of the center of the puck on the surface of the rink relative to a coordinate system with origin at the center of the rink and axes parallel and perpendicular to the straight sides of the rink and the surface of the rink, respectively.

q3: angle of rotation of the puck about an axis through the center of the puck and perpendicular to the plane of the rink.

u1, u2, and u3: time derivatives of the state variables q1, q2, and q3, respectively.

Study the hiearchical representation in the Mambo geometry view and draw tree representations including the rink components.

puck.zip (zip file, 10 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(N,A,B):
>DeclareTriads(n,b):
>DeclarePoints(N,B):
>DefineObservers([N,N,n],[A,B,n],[B,B,b]):
>DefineTriads(n,b,q3,3):
>DefinePoints(N,B,n,q1,q2,.06):
>DefineNeighbors([N,A],[A,B]):

Click here to expand/contract!
>DefineObjects([B,'Cylinder',radius=.2,length=.12,color=blue]): #Puck
>icegray:="{.8,.8,.8}":
>DefineObjects(
   [N,'Block',point=MakeTranslations(n,0,0,-.025),xlength=5,ylength=5,zlength=.05,color=icegray],
   [N,'Cylinder',point=MakeTranslations(n,2.5,0,-.025),radius=2.5,length=.05,color=icegray],
   [N,'Cylinder',point=MakeTranslations(n,-2.5,0,-.025),radius=2.5,length=.05,color=icegray],
   [N,'Cylinder',radius=.5,length=.02,color=red],
   [N,'Cylinder',radius=.45,length=.021,color=icegray],
   [N,'Block',xlength=.05,ylength=5,zlength=.02,color=blue],
   [N,'Block',point=MakeTranslations(n,2.5,0,0),xlength=.05,ylength=5,zlength=.02,color=red],
   [N,'Block',point=MakeTranslations(n,-2.5,0,0),xlength=.05,ylength=5,zlength=.02,color=red]): #Ice
>rinkgreen:="{0,.8,.8}":
>elements:=20:
>DefineObjects(
   [N,'Block',point=MakeTranslations(n,0,2.525,.2),xlength=5,ylength=.05,zlength=.5,color=rinkgreen],
   [N,'Block',point=MakeTranslations(n,0,-2.525,.2),xlength=5,ylength=.05,zlength=.5,color=rinkgreen],
   seq([N,'Block',point=MakeTranslations(n,2.5+2.525*sin((i-1)/elements*Pi),2.525*cos((i-1)/elements*Pi),.2),orient=MakeRotations(-(i-1)/elements*Pi,3),xlength=2.525*Pi/elements,ylength=.05,zlength=.5,color=rinkgreen],i=1..elements+1),
   seq([N,'Block',point=MakeTranslations(n,-2.5-2.525*sin((i-1)/elements*Pi),-2.525*cos((i-1)/elements*Pi),.2),orient=MakeRotations(-(i-1)/elements*Pi,3),xlength=2.525*Pi/elements,ylength=.05,zlength=.5,color=rinkgreen],i=1..elements+1)): #Rink

Click here to expand/contract!
>DeclareStates(q1,q2,q3,u1,u2,u3):
>kde:={q1t=u1,q2t=u2,q3t=u3}:
>p:=subs(kde,LinearMomentum(N,B)):
>h:=subs(kde,Inertia13=0,Inertia23=0,AngularMomentum(N,b)):
>force1:=MakeTranslations(n,0,-k*(q2-2.3),0):
>force2:=MakeTranslations(n,0,-k*(q2+2.3),0):
>force3:=(-k*(VectorLength(MakeTranslations(n,q1-2.3,q2,0))-2.3)/VectorLength(MakeTranslations(n,q1-2.3,q2,0))) &** MakeTranslations(n,q1-2.3,q2,0):
>force4:=(-k*(VectorLength(MakeTranslations(n,q1+2.3,q2,0))-2.3)/VectorLength(MakeTranslations(n,q1+2.3,q2,0))) &** MakeTranslations(n,q1+2.3,q2,0):
>dde:={seq((DiffTime(p,n) &-- (k1 &** force1) &-- (k2 &** force2) &-- (k3 &** force3) &-- (k4 &** force4)) &oo MakeTranslations(n,i),i=1..2),DiffTime(h,n) &oo MakeTranslations(n,3)}:

Click here to expand/contract!
>GeometryOutput(main=N,parameters=[M,Inertia33,Pi,k],states=[q1,q2,q3,u1,u2,u3],checktree,checkargs,filename="puck.geo");
>MotionOutput(ode=kde union dde,states=[q1,q2,q3,u1=5,u2=10,u3=1],parameters=[M=1,Inertia33=1,Pi=3.1416,k=10000],insignals=[k1=(q2&>2.3)*(abs(q1)&<2.5),k2=(q2&<(-2.3))*(abs(q1)&<2.5),k3=(q1&>2.5)*(((q1-2.3)^2+q2^2)&>6.25),k4=(q1&<(-2.5))*(((q1+2.3)^2+q2^2)&>6.25)],checksings,checkargs,filename="puck.dyn");

Sample projects