Skip to content

Instantly share code, notes, and snippets.

@moorepants
Created July 21, 2011 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moorepants/1098315 to your computer and use it in GitHub Desktop.
Save moorepants/1098315 to your computer and use it in GitHub Desktop.
Aurelia's pydy code
from sympy import *
from sympy.physics.mechanics import *
theta, phi, omega, alpha = dynamicsymbols('theta phi omega alpha')
thetad, phid, omegad, alphad = dynamicsymbols('theta phi omega alpha', 1)
gravity = symbols('gravity')
m, l = symbols('m l')
I1, I2, I3 = symbols('I1, I2, I3')
n = ReferenceFrame('n')
a = n.orientnew('a', 'Simple', theta, 3)
b = a.orientnew('b', 'Simple', phi, 2)
a.set_ang_vel(n, omega * n.z)
a.set_ang_acc(n, a.ang_vel_in(n).dt(n))
b.set_ang_vel(a, alpha * a.y)
b.set_ang_acc(a, b.ang_vel_in(a).dt(a))
B = Point('B')
N = Point('N')
N.set_vel(n, 0)
B.set_pos(N, -l*a.y)
B.set_vel(n, omega*l*a.x)
B.a2pt(N, n, b)
I = intertia(b, I1, I2, I3)
kd = [omega-thetad, alpha-phid]
forcelist = [(B, -n.y*gravity*m)]
plate = RigidBody()
plate.mc = B
plate.inertia = (I, B)
plate.frame = B
print b.dcm(n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment