Created
April 20, 2019 16:18
-
-
Save cdiener1/34098f5d9afea601003bc22ca0e93061 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
from math import sin, cos, atan, asin, sqrt, radians | |
w = 1.2 #wheelbase | |
v = 6 #speed in meters/sec of bike | |
g = 9.8 #constant of gravity in meters/sec | |
r = 10000000000 #radius of the turn | |
height = 0.75 #height of the center of mass | |
h = .5 #half of the length of the handlebar | |
t = 0.035 #half of the width of the tire | |
l = 0.8381 #length of the body of the actuator + 1.5 of the length of the fully extended actuator | |
c = 72 #caster angle in degrees | |
rate = 0.22987 #rate of motor | |
cel = 0.8381 #current extention length of actuator | |
c = radians(c) | |
angle = (w*cos(atan(v**2/g*r)+asin(t*(sin(c)/(height-t)))))/r*cos(c) #needed steer angle of bike for desired turn | |
print(angle) | |
rawdist = (sqrt((l+h*sin(angle))**2+((h-h*cos(angle))**2))) #distance that the actuator must travel | |
print(rawdist) | |
rawdist = float('{:.3f}'.format(rawdist)) | |
print(rawdist) | |
dist = rawdist-cel #total distance from actuator mount to new place to move | |
print(dist) | |
sec = dist/rate #number of seconds for the motors to run to make the needed changes to the bike handle bar poss | |
print(sec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment