read_game_log.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/python
  2. # -*-coding: utf-8 -*-
  3. import ctypes
  4. from matplotlib import pyplot as plt
  5. right_pos = (ctypes.c_int * 3)()
  6. left_pos = (ctypes.c_int * 3)()
  7. right_att = (ctypes.c_int * 3)()
  8. left_att = (ctypes.c_int * 3)()
  9. left_foot_pos = (ctypes.c_float * 3)()
  10. right_foot_pos = (ctypes.c_float * 3)()
  11. left_mag_list = []
  12. right_mag_list = []
  13. down_list = []
  14. if __name__ == '__main__':
  15. lib = ctypes.cdll.LoadLibrary("D:\Vs_projecct\gameDLL\gameDLL\\x64\Debug\gameDLL.DLL")
  16. fig, ax = plt.subplots()
  17. with open("F:\work\matlab\手机数据显示\\ios_run_1641979704.txt") as f:
  18. for line in f.readlines():
  19. line = line.strip('\n')
  20. data_str = line.split(',')
  21. data_int = list(map(int, data_str))
  22. right_mag_list.append(data_int[9:11])
  23. left_mag_list.append( data_int[21:23])
  24. print([x[0] for x in right_mag_list])
  25. ax.plot([x[0] for x in right_mag_list], label = 'right_front_mag')
  26. ax.plot([x[0] for x in left_mag_list], label = 'left_front_mag')
  27. ax.plot([x[1] for x in right_mag_list], label = 'right_back_mag')
  28. ax.plot([x[1] for x in left_mag_list], label = 'left_back_mag')
  29. ax.plot(down_list, label = 'down')
  30. ax.legend()
  31. plt.grid()
  32. plt.show()