Home Toolbox functions Sample projects Tutorials Downloads |
|
Reference: Chapter 4 in Multibody Mechanics and Visualization by Harry Dankowicz, published by Springer Verlag UK, 2004.
To illustrate a complete Mambo project using only translations.
This Mambo project contains a non-stationary bead and a stationary wireframe representation of a block. The non-stationary block may be positioned relative to the world observer by imposing an arbitrary translation.
l1, l2, and l3: lengths of the sides of the block.
q1, q2, and q3: Cartesian coordinates of the center of the bead relative to a coordinate system based at the center of the block with coordinate axes parallel to the edges of the block.
Modify the Mambo project so that the bead visits every corner of the block and briefly flashes red when a corner is reached.
beadonblock.zip (zip file, 6 kb, December 30, 2012) >Restart(): >DeclareObservers(W,A): >DeclarePoints(W,A,seq(seq(cat(E,i,j),i=1..3),j=1..4)): >DeclareTriads(w): >DefineObservers([W,W,w],[A,A,w]): >DefinePoints([W,A,w,q1,q2,q3],[W,E11,w,0,l2/2,l3/2],[W,E12,w,0,l2/2,-l3/2],[W,E13,w,0,-l2/2,-l3/2],[W,E14,w,0,-l2/2,l3/2],[W,E21,w,l1/2,0,l3/2],[W,E22,w,l1/2,0,-l3/2],[W,E23,w,-l1/2,0,-l3/2],[W,E24,w,-l1/2,0,l3/2],[W,E31,w,l1/2,l2/2,0],[W,E32,w,l1/2,-l2/2,0],[W,E33,w,-l1/2,-l2/2,0],[W,E34,w,-l1/2,l2/2,0]): >DefineNeighbors([W,A]): >DefineObjects( seq([W,'Block',point=cat(E,1,j),xlength=l1,ylength=(l1+l2+l3)/30,zlength=(l1+l2+l3)/30],j=1..4), seq([W,'Block',point=cat(E,2,j),xlength=(l1+l2+l3)/30,ylength=l2,zlength=(l1+l2+l3)/30],j=1..4), seq([W,'Block',point=cat(E,3,j),xlength=(l1+l2+l3)/30,ylength=(l1+l2+l3)/30,zlength=l3],j=1..4)): >DefineObjects([A,'Sphere',radius=(l1+l2+l3)/20,color=red]): >GeometryOutput(main=W,parameters=[l1,l2,l3],states=[q1,q2,q3],checktree,checkargs,filename="beadonblock.geo"): >MotionOutput(ode={q1t=u1,q2t=u2,q3t=u3},states=[q1=-.5,q2=-.25,q3=-.125],parameters=[l1=1,l2=.5,l3=.25],insignals=[u1=l1*((t&>=0)*(t&<1)-(t&>=4)*(t&<5)),u2=l2*((t&>=1)*(t&<2)-(t&>=3)*(t&<4)),u3=l3*((t&>=2)*(t&<3)-(t&>=5)*(t&<6))],checksings,checkargs,filename="beadonblock.dyn"): |
©2004-2017 Harry Dankowicz Mechanical Science and Engineering University of Illinois at Urbana-Champaign | Home Toolbox functions Sample projects Tutorials Downloads |