Skip to content

Commit

Permalink
Updated MATLAB code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehul Damani committed Jan 19, 2020
1 parent 15d954f commit ba287e3
Show file tree
Hide file tree
Showing 3 changed files with 584 additions and 1,450 deletions.
29 changes: 23 additions & 6 deletions draft3NUS.asv → backend.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@
j =1 ;
o=[];
while (i>0)
if ( mod(i,20) ==0 )
[status,timestamp] = readCalibrationStatus(BNO055Sensor) ;
if ( status.Accelerometer == 'uncalibrated' )
writeDigitalPin(a, 'D10', 0) ;
writeDigitalPin(a, 'D11', 1)
else
writeDigitalPin(a, 'D11', 0) ;
writeDigitalPin(a, 'D10', 1)
end

if ( status.Gyroscope == 'uncalibrated' )
writeDigitalPin(a, 'D9', 1) ;
writeDigitalPin(a, 'D6', 0)
else
writeDigitalPin(a, 'D6', 1) ;
writeDigitalPin(a, 'D9', 0)
end
end


try
[data,timestamp] = readAcceleration(BNO055Sensor) ;
k(i,1) = round(data(1),2) ; k(i,2) = round(data(2),2) ; k(i,3) = round(data(3),2) ;
Expand All @@ -20,14 +40,11 @@
catch
o(j,1)= 0 ; o(j,2) = 0 ; o(j,3) = 9.8 ;
end
end



end
try
[data,timestamp] = readAngularVelocity(BNO055Sensor) ;
k(i,4) = round(data(1),2) ; k(i,5) = round(data(2),2) ; k(i,6) = round(data(3),2) ;
o(j,4) = round(data(1),2) ; o(j,5) = round(data(2),2) ; o(j,6) = round(data(3),2) ;
k(i,4) = round(data(1),2) *(180/pi) ; k(i,5) = round(data(2),2)*(180/pi) ; k(i,6) = round(data(3),2)*(180/pi) ;
o(j,4) = round(data(1),2)*(180/pi) ; o(j,5) = round(data(2),2)*(180/pi) ; o(j,6) = round(data(3),2)*(180/pi) ;
catch
errorcountergyro = errorcountergyro + 1 ;
k(i,4) = k((i-1),4) ; k(i,5) = k((i-1),5) ; k(i,6) = k((i-1),6) ;
Expand Down
5 changes: 1 addition & 4 deletions draft3NUS.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
catch
o(j,1)= 0 ; o(j,2) = 0 ; o(j,3) = 9.8 ;
end
end



end
try
[data,timestamp] = readAngularVelocity(BNO055Sensor) ;
k(i,4) = round(data(1),2) *(180/pi) ; k(i,5) = round(data(2),2)*(180/pi) ; k(i,6) = round(data(3),2)*(180/pi) ;
Expand Down
Loading

0 comments on commit ba287e3

Please sign in to comment.