|
@@ -2,7 +2,7 @@ clear all;
|
|
|
close all;
|
|
|
instrreset;
|
|
|
disp('Press Ctrl+C to stop collecting data!')
|
|
|
-s=serial('com19','baudrate',115200) ;fopen(s) ;%Open Com Port 请将COM19换成电脑识别到的COM口,波特率115000换成传感器对应的波特率
|
|
|
+s=serial('/dev/ttyUSB0','baudrate',115200) ;fopen(s) ;
|
|
|
f = 20;%DataFrequce
|
|
|
t=0;
|
|
|
cnt = 1;
|
|
@@ -30,10 +30,10 @@ while(1)
|
|
|
ww = [ww;w'];
|
|
|
AA = [AA;A'];
|
|
|
tt = [tt;t];
|
|
|
- if (cnt>(f/5)) %Plot in low frequce,
|
|
|
+ if (cnt>(2)) %Plot in low frequce,
|
|
|
subplot(3,1,1);plot(tt,aa);title(['Acceleration = ' num2str(a') 'm2/s']);ylabel('m2/s');
|
|
|
- subplot(3,1,2);plot(tt,ww);title(['Gyro = ' num2str(w') '°/s']);ylabel('°/s');
|
|
|
- subplot(3,1,3);plot(tt,AA);title(['Angle = ' num2str(A') '°']);ylabel('°');
|
|
|
+ subplot(3,1,2);plot(tt,ww);title(['Gyro = ' num2str(w') '掳/s']);ylabel('掳/s');
|
|
|
+ subplot(3,1,3);plot(tt,AA);title(['Angle = ' num2str(A') '掳']);ylabel('掳');
|
|
|
cnt=0;
|
|
|
drawnow;
|
|
|
if (size(aa,1)>5*f)%clear history data
|