Skip to content

Commit

Permalink
[Motor Test][script] add function to print max thrust and polynomial …
Browse files Browse the repository at this point in the history
…coefficients
  • Loading branch information
Li-Jinjie committed Feb 1, 2024
1 parent deee56b commit b94b64d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aerial_robot_nerve/motor_test/scripts/analyze_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def analyze_data(folder_path, file_name, has_telemetry, set_voltage):
coeffs_PWM_ratio_fz = np.polyfit(PWM_ratio, fz, 2)
fit_eq_PWM_ratio_fz = f"fz = {coeffs_PWM_ratio_fz[0]:.4e} * PWM_Ratio_%^2 + {coeffs_PWM_ratio_fz[1]:.4e} * PWM_Ratio_% + {coeffs_PWM_ratio_fz[2]:.4f}"
print(f"Fitting Equation (x:PWM_Ratio_% y:fz): {fit_eq_PWM_ratio_fz}")
print(f"max fz: {np.max(fz):.4f} N")
print(f"polynominal2(10x): {10 * coeffs_PWM_ratio_fz[0]:.5f}")
print(f"polynominal1(10x): {10 * coeffs_PWM_ratio_fz[1]:.5f}")
print(f"polynominal0: {coeffs_PWM_ratio_fz[2]:.5f}")

# Create 2x2 subplots
fig, axs = plt.subplots(2, 2, figsize=(12, 12))
Expand Down

0 comments on commit b94b64d

Please sign in to comment.