Establishing Motion Equations Automatically
Introduction

Example of motion equations 
Blender Game Engine (BGE) provides us with the great physics simulation of not only rigid bodies but also softbodies. However, sometimes we want to get exact motion equations to analyze its motion and behavior using equations or to design controllers like PID.
What I'm going to introduce you here is a script which generates motion equations for multibody dynamics which is the motion of several rigid bodies. It was written in Python and Sympy which calculates expressions in symbolic form. If you give the script some information of masses, positions, injected forces, etc, it will return motion equations explicitly, for example, Newton's second law, Euler's equations, robot motion equation, etc.
If you get interested, please download the script and give it a try. You need to install Python and Sympy in this order first, and please see section "Requirements" below for the details.
First of all, what is this?
This is a script which generates motion equations for multibody dynamics by giving some information of masses, positions, injected forces, etc. You can get equations, for example, Newton's second law, Euler's equations of rigid body, robot motion equation, etc.
The name of the latest version
MoEqGen_Kane v0.1
The released date of the latest version
2009/05/10
Download
MoEqGen_Kane_v0_1.zip
Main features
This script generates motion equations by using Kane's method. It handles multibody dynamics, which means a dynamic behavior created with several rigid bodies that are interconnected, for instance, double pendulum, robot arms, crank mechanism, etc. The script allows you to get the equation easily by setting some information of masses, positions, forces, etc.
How to use the script easily
To run the test code and to get the sample equation immediately:
+1. 
Download and install Python and Sympy in this order first. See section "Requirements" below for the details. 
+2. 
Download file “MoEqGen_Kane_v0_1.zip” at here. Then unzip it and make sure files “motionequation.py” and "sample.py" were created. 

(the main code can be seen in “motionequation.py” and the test code in "sample.py".) 
+3. 
To get the equation, run file "sample.py" on Python. 

(If you use Windows, type the following in the command prompt. %Address% represents the address to file "sample.py". You will get the equation in text file "result.txt":
cd %Address%
python sample.py > result.txt) 
+4. 
式の結果を見せる■ 
Please modify the test code and use MoEqGen_Kane script for your own project. テストコードを見せる、変更方法を解説■
Requirements
This script works with Python 2.5.x and Sympy installed. I confirmed it worked well with Python 2.5.2 and Sympy 0.6.4. Please visit each link on the name above for the installation.
Threads to discuss
You can discuss the script on this thread in sympy mailing list.
