MAMBO logo MAMBO & the MAMBO Toolbox MAMBO logo

Sample project - Switching Constraints

To illustrate the use of Boolean expressions to switch between different configuration or motion constraints.

This Mambo project contains a non-stationary block. The non-stationary block may be repositioned and reoriented relative to the world observer in two independent steps, namely
  1. Position the block relative to the world observer.
  2. Orient the block relative to the world observer.
The motion of the block is constrained so as to switch between keeping a point P1 or a point P2 fixed relative to the world observer.

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

p11, p12, and p13: coordinates of the point P1 on the block relative to a coordinate system with origin at the center of the block and axes parallel to the edges of the block.

p21, p22, and p23: coordinates of the point P2 on the 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 two spheres placed at the points P1 and P2 on the block.

T: periodicity of the switching between keeping P1 or P2 fixed.

q1, q2, and q3: coordinates of the center of the block relative to 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 corresponding to the orientation of the block relative to the reference triad of the world observer.

  • Use the default locations for the points P1 and P2 on the block and experiment with different boolean expressions for the switch condition in the insignals block of the switching.dyn file.
  • Experiment with different choices for the points P1 and P2 and different values for the period of the switching.

switching.zip (zip file, 15 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(W,B):
>DeclarePoints(W,B,P1,P2,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,P1,b,p11,p12,p13],[B,P2,b,p21,p22,p23]):
>DefinePoints([B,E11,b,0,l2/2,l3/2],[B,E12,b,0,l2/2,-l3/2],[B,E13,b,0,-l2/2,-l3/2],[B,E14,b,0,-l2/2,l3/2],[B,E21,b,l1/2,0,l3/2],[B,E22,b,l1/2,0,-l3/2],[B,E23,b,-l1/2,0,-l3/2],[B,E24,b,-l1/2,0,l3/2],[B,E31,b,l1/2,l2/2,0],[B,E32,b,l1/2,-l2/2,0],[B,E33,b,-l1/2,-l2/2,0],[B,E34,b,-l1/2,l2/2,0]):
>DefineTriads(w,b,[q4,3],[q5,1],[q6,3]):
>DefineNeighbors(W,B):

Click here to expand/contract!
>DefineObjects(
   seq([B,'Block',point=cat(E,1,j),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30],j=1..4),
   seq([B,'Block',point=cat(E,2,j),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30],j=1..4),
   seq([B,'Block',point=cat(E,3,j),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3],j=1..4)):
>DefineObjects([B,'Sphere',point=P1,radius=marker,color=red],[B,'Sphere',point=P2,radius=marker,color=blue]):

Click here to expand/contract!
>DeclareStates(q1,q2,q3,q4,q5,q6):
>kde:={seq(((k &** LinearVelocity(W,P1)) &++ ((1-k) &** LinearVelocity(W,P2))) &oo MakeTranslations(w,i)=0,i=1..3),seq(AngularVelocity(w,b) &oo MakeTranslations(b,i)=cat(u,i),i=1..3)}:

Click here to expand/contract!
>GeometryOutput(main=W,parameters=[l1,l2,l3,marker,p11,p12,p13,p21,p22,p23],states=[q1,q2,q3,q4,q5=.01,q6],checktree,checkargs,filename="switching.geo"):
>MotionOutput(ode=kde,states=[q1,q2,q3,q4,q5=.01,q6],parameters=[l1=1,l2=.5,l3=.25,marker=.1,p11=.5,p12=.25,p13=.125,p21=-.5,p22=-.25,p23=-.125,T=3,Pi=3.1416],insignals=[u1=cos(t),u2=-1,u3=0,k=(sin(2*Pi*t/T)&>=0)],checksings,checkargs,filename="switching.dyn");

Sample projects