Creating Constraints in Sim TK Peter Eastman Sim

  • Slides: 6
Download presentation
Creating Constraints in Sim. TK Peter Eastman Sim. TK Workshop, March 20, 2008

Creating Constraints in Sim. TK Peter Eastman Sim. TK Workshop, March 20, 2008

A Constrained System (Example. Gears. cpp) int main() { // Create the system. Multibody.

A Constrained System (Example. Gears. cpp) int main() { // Create the system. Multibody. System system; Simbody. Matter. Subsystem matter(system); Body: : Rigid gear. Body(Mass. Properties(1. 0, Vec 3(0), Inertia(1))); gear. Body. add. Decoration(Transform(Rotation(0. 5*Pi, Coordinate. Axis: : XCoordinate. Axis())), Decorative. Cylinder(1. 0, 0. 1)); Mobilized. Body: : Pin gear 1(matter. upd. Ground(), Transform(Vec 3(1, 0, 0)), gear. Body, Transform()); Mobilized. Body: : Pin gear 2(matter. upd. Ground(), Transform(Vec 3(-1, 0, 0)), gear. Body, Transform()); Body: : Rigid rod. Body(Mass. Properties(1. 0, Vec 3(0), Inertia(1))); rod. Body. add. Decoration(Transform(Vec 3(0, 1, 0)), Decorative. Cylinder(0. 05, 1. 0)); Mobilized. Body: : Pin rod(gear 2, Transform(Vec 3(0, 0. 8, 0. 1)), rod. Body, Transform()); Constraint: : Constant. Speed(gear 1, 0. 1); Constraint: : No. Slip 1 D(matter. upd. Ground(), Vec 3(0), Unit. Vec 3(0, 1, 0), gear 1, gear 2); Constraint: : Point. On. Line(matter. upd. Ground(), Unit. Vec 3(0, 1, 0), Vec 3(0, 0, 0. 1), rod, Vec 3(0, 2, 0)); system. upd. Default. Subsystem(). add. Event. Reporter(new VTKEvent. Reporter(system, 0. 05)); // Initialize the system and state. system. realize. Topology(); State state = system. get. Default. State(); // Simulate it. Verlet. Integrator integ(system); Time. Stepper ts(system, integ); ts. initialize(state); ts. step. To(1000. 0); } 2

Constant. Speed Constraint: : Constant. Speed(gear 1, 0. 1); • Applies to a single

Constant. Speed Constraint: : Constant. Speed(gear 1, 0. 1); • Applies to a single generalized speed • Forces it to have a constant value 3

No. Slip 1 D Constraint: : No. Slip 1 D(matter. upd. Ground(), Vec 3(0),

No. Slip 1 D Constraint: : No. Slip 1 D(matter. upd. Ground(), Vec 3(0), Unit. Vec 3(0, 1, 0), gear 1, gear 2); • Useful for rolling bodies • Both bodies must have equal velocity at a point in space in a particular direction Parent Body 1 4 Body 2

Point. On. Line Constraint: : Point. On. Line(matter. upd. Ground(), Unit. Vec 3(0, 1,

Point. On. Line Constraint: : Point. On. Line(matter. upd. Ground(), Unit. Vec 3(0, 1, 0), Vec 3(0, 0, 0. 1), rod, Vec 3(0, 2, 0)); • Requires a point in one body’s frame to remain on a line in another body’s frame Point in Body 1’s frame Body 1 Line in Body 2’s frame Body 2 5

Exercises • Increase the rotation speed to 0. 2 radians/sec • Constrain the end

Exercises • Increase the rotation speed to 0. 2 radians/sec • Constrain the end of the rod to lie on the line x=-1, z=0. 1 6