Using PyOMD
I used Python 2.6.5, anything newer than that is unlikely to work (because of swig).
A user would follow these basic steps to use the software:
chooses a model
defines the bodies, joints, forces and integrator
integrate through time
You can look at the examples that come with the software download, and
I used Doxygen to produce some documentation for all the methods:
Doxygen Documentation
But, keep reading this guide to get some more insight into the general process.
Choose A Model
Choosing a model, in the use of OMD, means determining an approach
to modeling multi-body dynamics. Each model formulates the system of
equations differently and requires that the user define model
components such as bodies and joints differently. In the future I
would like to build a user interface that allows the user to define
everything in the same manor and then try different models
after all of the components are defined. However, that is not how it
works now, so for the time being, the model needs to be chosen to
begin with. Here are some guidelines concerning which model to
choose:
Choose Model1 if your mechanism has joints but no closed loops.
Choose Model2 if your mechanism has no joints.
Choose Model3 if your mechanism has joints with closed loops.
Once you have chosen a model defining it in python is simple:
mymodel = Model1()
or
mymodel = Model2()
or
mymodel = Model3()
Define Bodies, Joints, Forces and an Integrator
All the methods that define parts of the model are methods in the model. For example, using model1, define a body in python by calling the “addBody” method:
irf = mymodel.addBody('irf',0,eye,eye,True)
The integrators are an exception to the rule that all the parts of the model are member functions of the model. The two integrators currently available will work on any of the models, in python they are defined as follows:
integrator = IntegRK4(mymodel)
Notice that the model is passed into the integrator's constructor.
Because the models use slightly different methods to define model components each model has it's own page which documents how everything is defined.
Integrate Through Time
All the models are integrated numerically and therefore require descrete time steps and loops that move from time 0 to the end-time. In python the time integration loop looks like this:
# make the integrator
integrator = IntegRK4(mymodel)
# we have built our simple model so step forward in time
time = 0. # start time at 0
dt = 0.0005 # time step
endtime = 2 # time at which simulation stops
while time < endtime:
integrator.integrate(time,time+dt)
time = time + dt;