Commit b898f63c authored by Claudio Mandrioli's avatar Claudio Mandrioli
Browse files

removed scripts for reading data from app and manipulating them, not needed anymore

parent b910413f
%% split betwen different sensors
% load('cycling_data')
%
% % %trying to figure out the unit of measure of the time stamps
% % %total_time=time_stamps(length(time_stamps))-time_stamps(1) ;
% % %real_total_time=(6*60+15)*60; %about 6 hours and 15 min expressed in seconds
% % %time_unit=real_total_time/total_time
%
% time_stamps=(time_stamps-time_stamps(1))/1.0;
%
% acc=[0,0,0,0];
% gyr=[0,0,0,0];
% gps=[0,0,0,0];
%
% for k=1:length(time_stamps)
%
% if strcmp(sensor(k),'ACC')
% acc=[acc;
% time_stamps(k),a(k),b(k),c(k)];
% end
%
% if strcmp(sensor(k),'GYR')
% gyr=[gyr;
% time_stamps(k),a(k),b(k),c(k)];
% end
%
% if strcmp(sensor(k),'GPS')
% gps=[gps;
% time_stamps(k),a(k),b(k),c(k)];
% end
%
% end
%
% acc=acc(2:length(acc),:);
% gyr=gyr(2:length(gyr),:);
% gps=gps(2:length(gps),:);
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load('cycling_data_sensors')
% Input struct:
% in_data.GNSS.pos_ned GNSS-receiver position estimates in NED
% coordinates [m]
% in_data.GNSS.t Time of GNSS measurements [s]
% (in_data.GNSS.HDOP GNSS Horizontal Dilution of Precision [-])
% (in_data.GNSS.VDOP GNSS Vertical Dilution of Precision [-])
% in_data.IMU.acc Accelerometer measurements [m/s^2]
% in_data.IMU.gyro Gyroscope measurements [rad/s]
% in_data.IMU.t Time of IMU measurements [s]
%from geodetic to cartesian GPS coordinates
% spheroid = referenceEllipsoid('GRS 80')
% [xNorth,yEast,zDown] = geodetic2ned(gps(5:length(gps),2),gps(5:length(gps),3),gps(5:length(gps),4),gps(4,2),gps(4,3),gps(4,4),spheroid)
% in_data.GNSS.pos_ned = [xNorth,yEast,zDown];
% in_data.GNSS.t=gps(5:length(gps),1)
%synchronize accelerometer and gyro data
% Gyr=gyr(1,2:4);
% Acc=acc(1,2:4);
% t=0;
% j=1; % to cycle over the gyro
% for i=1:length(acc) %cycle over the accelerometer
% while gyr(j,1)<=acc(i,1)
% %if the data are available and synchr then store them (with time)
% if gyr(j,1)==acc(i,1)
% Gyr=[Gyr;
% gyr(j,2:4)];
% Acc=[Acc;
% acc(i,2:4)];
% t=[t;gyr(j,1)];
% end
% j=j+1;
% end
%
% %checkpoint for verifying progress
% if ~mod(i,100000)
% %display('sono arrivato al tempo:')
% %t(j-1)
% display('sono alla seguente riga delle accelerazioni(totale di 1901808):')
% i
% end
% end
% in_data.IMU.acc = Acc';
% in_data.IMU.gyro = Gyr';
% in_data.IMU.t = t;
% in_data.GNSS.pos_ned = Gps;
% in_data.GNSS.t = t_Gps;
close all
clear all
% import data from sensor fusion app and translate them in some matlab
% format
datafile = fopen('sensorLog_20180925T113201.csv');
%read data from datalog
temp = textscan(datafile,'%d %s %f %f %f');
time = cell2mat(temp(1));
sens = temp{2};
data = cell2mat(temp(3:5));
fclose(datafile);
%inizializzazioni varie
h=1;
j=1;
time_acc=0;
time_gps=0;
acc=rand(1,3);
gps=[0.0,0.0,0.0,0.0];
%cycle over the data
%for k=1:length(time)
for k=1:300
% if the datum comes from the accelerometer
if strcmp(sens(k),'ACC')
time_acc=[time_acc;time(k)];
acc=[ acc ;
[data(k,1),data(k,2),data(k,3)] ];
h = h+1;
end
% if the datum comes from the gps
if strcmp(sens(k),'GPS')
time_gps=[time_gps;time(k)];
gps=[ gps ;
[data(k,1),data(k,2),data(k,3)] ];
j = j+1;
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment