tools/param_est/import_logdata.m
function [tick, gyro_roll, gyro_pitch, gyro_yaw, ...
         cmd_thrust, cmd_roll, cmd_pitch, cmd_yaw,...
         accelz] = import_logdata(filename)

%% Import data from text file
% Script for importing data from the following text file:
%
%    filename: /home/evgheniivolodscoi/LRZ Sync+Share/TUM/Master_AS_RCI/Semester_3/Semesterarbeit/code/param_est/csv_data/data_1901.csv
%
% Auto-generated by MATLAB on 20-Jan-2020 01:14:14

%% Setup the Import Options
opts = delimitedTextImportOptions("NumVariables", 9);

% Specify range and delimiter
opts.DataLines = [2, Inf];
opts.Delimiter = ",";

% Specify column names and types
opts.VariableNames = ["tick", "controllerr_roll", "controllerr_pitch", "controllerr_yaw", "controllercmd_thrust", "controllercmd_roll", "controllercmd_pitch", "controllercmd_yaw", "controlleraccelz"];
opts.VariableTypes = ["double", "double", "double", "double", "double", "double", "double", "double", "double"];
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";

% Import the data
tbl = readtable(filename, opts);

%% Convert to output type
tick = tbl.tick;
gyro_roll = tbl.controllerr_roll;
gyro_pitch = tbl.controllerr_pitch;
gyro_yaw = tbl.controllerr_yaw;
cmd_thrust = tbl.controllercmd_thrust;
cmd_roll = tbl.controllercmd_roll;
cmd_pitch = tbl.controllercmd_pitch;
cmd_yaw = tbl.controllercmd_yaw;
accelz = tbl.controlleraccelz;

%% Clear temporary variables
clear opts tbl

end