Created
August 3, 2020 23:45
-
-
Save ahmedazizkhelifi/26c15e330055121fd64cf64d33385838 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g = 9.8 #G force | |
M1 = 2 #bar 1 mass in kg | |
M2 = 1 #bar 2 mass in kg | |
d = 0.05 # thickness of each bar | |
gap = 2*d # distance between two parts of upper, U-shaped assembly | |
L1 = 0.5 # physical length of upper assembly; distance between axles | |
L1display = L1+d # show upper assembly a bit longer than physical, to overlap axle | |
L2 = 1 # physical length of lower bar | |
L2display = L2+d/2 # show lower bar a bit longer than physical, to overlap axle | |
# Coefficients used in Lagrangian calculation | |
# https://en.wikipedia.org/wiki/Lagrangian_mechanics#Two-body_central_force_problem | |
A = (1/4)*M1*L1**2+(1/12)*M1*L1**2+M2*L1**2 | |
B = (1/2)*M2*L1*L2 | |
C = g*L1*(M1/2+M2) | |
D = M2*L1*L2/2 | |
E = (1/12)*M2*L2**2+(1/4)*M2*L2**2 | |
F = g*L2*M2/2 | |
hpedestal = 1.3*(L1+L2) # height of pedestal | |
wpedestal = 0.1 # width of pedestal | |
tbase = 0.05 # thickness of base | |
wbase = 8*gap # width of base | |
offset = 2*gap # from center of pedestal to center of U-shaped upper assembly | |
pedestal_top = vec(0,hpedestal/2,0) # top of inner bar of U-shaped upper assembly | |
theta1 = 1.3*pi/2 # initial upper angle (from vertical) | |
theta1dot = 0 # initial rate of change of theta1 | |
theta2 = 0 # initial lower angle (from vertical) | |
theta2dot = 0 # initial rate of change of theta2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment