Last active
January 3, 2016 21:29
-
-
Save ibanezmatt13/8521632 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
motor_thrust = [10,20,33.5,45.55,30.55,20.12,9.776,2.22] # array of motor thrust values in newtons at different times | |
motor_times = [0.049, 0.097, 0.153, 0.264, 0.335, 0.469, 0.555, 0.746] # array of times at which the above thrusts occur | |
time_step = 0.01 # common time step | |
min_thrust = 0 | |
max_thrust = 0 | |
current_time = 0 | |
# function to find min and max thrust based on current time and calculate estimated thrust value based on that | |
def estimate_thrust(current_time): | |
for i in range(0, len(motor_times)): | |
if motor_times[i] >= current_time: | |
min_thrust = motor_thrust[i-1] | |
max_thrust = motor_thrust[i] | |
break | |
estimated_thrust = (max_thrust + min_thrust) / 2 | |
return estimated_thrust | |
for counter in range(0, 100): | |
current_time = current_time + time_step | |
if current_time <= float(motor_times[len(motor_times)-1]): | |
estimated_thrust = estimate_thrust(current_time) | |
print current_time, estimated_thrust | |
else: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment