test_DOWN.asv 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. clear all;
  2. close all;
  3. load imu_data1;
  4. gyr_data = imu_data(1:3,:);
  5. press_raw_data = imu_data(4,:);
  6. press_data = (imu_data(4,:)-9000000*ones(1,size(gyr_data,2)))*0.0000005;
  7. last_move_index = 0;
  8. zupt = zeros(1,size(gyr_data,2));
  9. press_zupt = 0;
  10. mutex_up = 0;
  11. mutex_down =0;
  12. press_index = 0;
  13. down_pass1 = 0;
  14. down_pass2 = 0;
  15. for i = 1:size(gyr_data,2)
  16. if(norm(gyr_data(:,i)) > 1.0)
  17. last_move_index = i;
  18. end
  19. if(i> 6 && press_raw_data(1, i) - min(press_raw_data(1, i-6:i-1)) > 100000 )
  20. press_zupt = 1;
  21. zupt(i) = 1;
  22. press_index = i;
  23. if()
  24. if(abs(gyr_data(2,i)) > 1.5)
  25. down_pass1 = 1;
  26. end
  27. elseif(i> 6 && press_raw_data(1, i) - max(press_raw_data(1, i-6:i-1)) < -100000)
  28. zupt(i) = 2;
  29. if(abs(gyr_data(2,i)) > 1.5)
  30. down_pass2 = 1;
  31. end
  32. elseif(i > 1 && zupt(i-1)== 2 )
  33. if(down_pass1 == 0 && down_pass2 == 0 )
  34. zupt(i) = 3;
  35. end
  36. down_pass1 = 2 ;
  37. down_pass2 = 2 ;
  38. end
  39. end
  40. index = find(zupt ==1);
  41. figure;
  42. hold on
  43. plot(gyr_data(1,:),'r-')
  44. plot(gyr_data(2,:),'g-')
  45. plot(gyr_data(3,:),'b-')
  46. plot(press_data(1,:),'m-')
  47. plot(index,press_data(1,index),'ko')
  48. index = find(zupt == 2);
  49. plot(index,press_data(1,index),'ro')
  50. index = find(zupt == 3);
  51. plot(index,press_data(1,index),'k*')
  52. grid on
  53. axis on
  54. figure
  55. hold on
  56. plot(press_data(1,:),'r-')
  57. grid on
  58. axis on