MAMBO logo MAMBO & the MAMBO Toolbox MAMBO logo

Sample project - Motion Along a Line

To illustrate
  • the selection of constraints using Mambo parameters;
  • the significance of using initial conditions that satisfy the configuration constraints;
  • the possibility of everywhere singular kinematic differential equations.

This Mambo project contains a non-stationary blocks and a stationary line. The non-stationary block may be positioned and oriented relative to the world observer in two independent steps, namely
  1. Specify the location of a reference point B on the block.
  2. Specify a position of the point B.
  3. Specify an orientation of the block about the point B.
The motion of the block is constrained in such a way that the point B moves parallel to the line if a direction parallel to the line has been specified. If the parallel direction has not been specified the constraint is turned off.

lx, ly, and lz: lengths of the sides of the blocks.

L and radius: length and radius of the cylinder representing the line.

Bx, By, and Bz: coordinates of the point B in a coordinates system with origin at the center of the block and axes parallel to the edges of the block.

marker: radius of a sphere at the point B.

p1, p2, and p3: coordinates relative to the world reference triad of a vector parallel to the line. If they all equal zero, the direction parallel to the line is unspecified.

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

  • Use the default position of the point B and experiment with different values for the parameters specifying the direction parallel to the line. In particular, set them all equal to zero and compare.
  • Use initial conditions that do not satisfy the configuration constraint and explain the resulting motion.
  • Switch p1 and p2 in the definitions of case2 and case3 in the insignals block of the MAMBO motion description and explain the behavior of the system when p1 and p3 or p2 and p3 both equal zero.

toline.zip (zip file, 12 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,BlockCenter,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,BlockCenter,b,Bx,By,Bz],[BlockCenter,E11,b,0,ly/2,lz/2],[BlockCenter,E12,b,0,ly/2,-lz/2],[BlockCenter,E13,b,0,-ly/2,-lz/2],[BlockCenter,E14,b,0,-ly/2,lz/2],[BlockCenter,E21,b,lx/2,0,lz/2],[BlockCenter,E22,b,lx/2,0,-lz/2],[BlockCenter,E23,b,-lx/2,0,-lz/2],[BlockCenter,E24,b,-lx/2,0,lz/2],[BlockCenter,E31,b,lx/2,ly/2,0],[BlockCenter,E32,b,lx/2,-ly/2,0],[BlockCenter,E33,b,-lx/2,-ly/2,0],[BlockCenter,E34,b,-lx/2,ly/2,0]):
>DefineTriads(w,b,[q4,3],[q5,1],[q6,3]):
>DefineNeighbors([W,B]):
>assume(p1,real):assume(p2,real):assume(p3,real):
>p:=MakeTranslations(w,p1,p2,p3):
>t3:=(1/VectorLength(p)) &** p:
>t1:=(1/VectorLength(t3 &xx MakeTranslations(w,0,-((p1^2+p2^2)&==0),((p1^2+p2^2)&!=0)))) &** (t3 &xx MakeTranslations(w,0,-((p1^2+p2^2)&==0),((p1^2+p2^2)&!=0))):
>t2:=t3 &xx t1:
>rot:=[seq(seq(cat(r,i,j)=simplify(MakeTranslations(w,i) &oo cat(t,j)),i=1..3),j=1..3)]:

Click here to expand/contract!
>DefineObjects(
   seq([B,'Block',point=cat(E,1,j),xlength=lx,ylength=(lx+ly+lz)/30,zlength=(lx+ly+lz)/30,color=yellow],j=1..4),
   seq([B,'Block',point=cat(E,2,j),xlength=(lx+ly+lz)/30,ylength=ly,zlength=(lx+ly+lz)/30,color=yellow],j=1..4),
   seq([B,'Block',point=cat(E,3,j),xlength=(lx+ly+lz)/30,ylength=(lx+ly+lz)/30,zlength=lz,color=yellow],j=1..4),
   [B,'Sphere',radius=marker,color=red],
   [W,'Cylinder',orient=Matrix(3,3,(i,j)->cat(r,i,j)),length=L,radius=radius,color=green]):

Click here to expand/contract!
>DeclareStates(q1,q2,q3,q4,q5,q6):
>linvel:=LinearVelocity(W,B):
>angvel:=AngularVelocity(w,b):
>kde:={case1*linvel &oo MakeTranslations(w,3)+case2*linvel &oo MakeTranslations(w,2)+(case3+case4)*linvel &oo MakeTranslations(w,1)=u1,
   seq(angvel &oo MakeTranslations(b,i)=cat(u,i+3),i=1..3),
   (case1+case2)*(linvel &xx p) &oo MakeTranslations(w,1)+case3*(linvel &xx p) &oo MakeTranslations(w,2)+case4*(linvel &oo MakeTranslations(w,2)-u2)=0,
   case1*(linvel &xx p) &oo MakeTranslations(w,2)+(case2+case3)*(linvel &xx p) &oo MakeTranslations(w,3)+case4*(linvel &oo MakeTranslations(w,3)-u3)=0}:

Click here to expand/contract!
>GeometryOutput(main=W,states=[q1,q2,q3,q4,q5,q6],anims=[codegen:-optimize(rot)],parameters=[L,radius,Bx,By,Bz,lx,ly,lz,marker],checkargs,checktree,filename="toline.geo"):
>MotionOutput(ode=kde,states=[q1,q2,q3,q4=2,q5=2.2,q6=1.5],parameters=[L=5,radius=.03,lx=.25,ly=.5,lz=1,Bx=0.125,By=.25,Bz=.5,marker=.1,p1=1,p2,p3],insignals=[u1=-cos(2*t),u2=-cos(t),u3=sin(t),u4=cos(2*t),u5=0.1,u6=sin(t),case1=(p3&!=0),case2=(p3&==0)*(p2&!=0),case3=(p3&==0)*(p2&==0)*(p1&!=0),case4=(p3&==0)*(p2&==0)*(p1&==0)],anims=[codegen:-optimize(rot)],checkargs,checksings,filename="toline.dyn");

Sample projects