modify some unused utils such as log record

This commit is contained in:
TJU_Lu
2024-12-08 10:30:47 +08:00
parent 38f37fd7a2
commit 73908cc899
4 changed files with 71 additions and 86 deletions

View File

@@ -1,18 +1,17 @@
import numpy as np
import matplotlib.pyplot as plt
import os
if __name__ == '__main__':
file_path = "/home/lu/flightmare/flightmare/run/utils/dist.csv"
temp = np.loadtxt(file_path, dtype=float, delimiter=",")
file_path = "/home/lu/flightmare/flightmare/run/utils/dist_x.csv"
tempX = np.loadtxt(file_path, dtype=float, delimiter=",")
plt.plot(tempX, temp)
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])
plt.show()
print("dist min:", np.min(temp))
file_path = "/home/lu/flightmare/flightmare/run/utils/ctrl_log.csv"
print("dist min:", np.min(dist_log[:, 2]))
file_path = os.environ["FLIGHTMARE_PATH"] + "/run/utils/ctrl_log.csv"
ctrl_log = np.loadtxt(file_path, dtype=float, delimiter=",")
v_total = np.sqrt(
ctrl_log[:, 3] * ctrl_log[:, 3] + ctrl_log[:, 4] * ctrl_log[:, 4] + ctrl_log[:, 5] * ctrl_log[:, 5])
v_total = np.sqrt(ctrl_log[:, 3] * ctrl_log[:, 3] + ctrl_log[:, 4] * ctrl_log[:, 4] + ctrl_log[:, 5] * ctrl_log[:, 5])
print("v max: ", np.max(v_total))
plt.plot(ctrl_log[:, 3], label='vx')
plt.plot(ctrl_log[:, 4], label='vy')