No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

find_bad_data.py 796B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python
  2. import os
  3. import numpy as np
  4. file_list = os.listdir('/raw_data')
  5. for file_name in file_list:
  6. if file_name.endswith('.npy'):
  7. file_location = "/raw_data/" + file_name
  8. loaded_data = np.load(file_location)
  9. for data in loaded_data:
  10. # change the can data (HEX) to numerical data
  11. tmp = data[1]
  12. hex_data = tmp[-23:-21] + tmp[-20:-18]
  13. hex_decimal = tmp[-3:-1]
  14. int_data = int(hex_data, 16)
  15. int_decimal = int(hex_decimal, 16) / 256
  16. # if the steering wheel angle in in right to the center
  17. if(int_data > 550):
  18. int_data = int_data - 4096
  19. int_decimal = 1 - int_decimal
  20. # put the int and the decimal together
  21. final_data = int_data + int_decimal
  22. if final_data > 20 or final_data < -20:
  23. print("Bad data : ", file_name)
  24. break