2024-10-20 17:01:07 +08:00
|
|
|
import numpy as np
|
|
|
|
|
import matplotlib.pyplot as plt
|
2024-12-08 10:30:47 +08:00
|
|
|
import os
|
2024-10-20 17:01:07 +08:00
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2024-12-08 10:30:47 +08:00
|
|
|
file_path = os.environ["FLIGHTMARE_PATH"] + "/run/utils/dist_log.csv"
|
|
|
|
|
dist_log = np.loadtxt(file_path, dtype=float, delimiter=",")
|
|
|
|
|
plt.plot(dist_log[:, 0], dist_log[:, 2])
|
2024-10-20 17:01:07 +08:00
|
|
|
plt.show()
|
2024-12-08 10:30:47 +08:00
|
|
|
print("dist min:", np.min(dist_log[:, 2]))
|
|
|
|
|
|
|
|
|
|
file_path = os.environ["FLIGHTMARE_PATH"] + "/run/utils/ctrl_log.csv"
|
2024-10-20 17:01:07 +08:00
|
|
|
ctrl_log = np.loadtxt(file_path, dtype=float, delimiter=",")
|
2024-12-08 10:30:47 +08:00
|
|
|
v_total = np.sqrt(ctrl_log[:, 3] * ctrl_log[:, 3] + ctrl_log[:, 4] * ctrl_log[:, 4] + ctrl_log[:, 5] * ctrl_log[:, 5])
|
2024-10-20 17:01:07 +08:00
|
|
|
print("v max: ", np.max(v_total))
|
|
|
|
|
plt.plot(ctrl_log[:, 3], label='vx')
|
|
|
|
|
plt.plot(ctrl_log[:, 4], label='vy')
|
|
|
|
|
plt.plot(ctrl_log[:, 5], label='vz')
|
|
|
|
|
plt.plot(v_total, label='v_total')
|
|
|
|
|
plt.plot(ctrl_log[:, 6], label='ax')
|
|
|
|
|
plt.plot(ctrl_log[:, 7], label='ay')
|
|
|
|
|
plt.plot(ctrl_log[:, 8], label='az')
|
|
|
|
|
plt.legend()
|
|
|
|
|
plt.show()
|