Skip to content

Instantly share code, notes, and snippets.

@jackokaiser
Created July 14, 2015 10:34
Show Gist options
  • Save jackokaiser/8237c105bea58b91aa42 to your computer and use it in GitHub Desktop.
Save jackokaiser/8237c105bea58b91aa42 to your computer and use it in GitHub Desktop.
function [bag_data] = sensor_message_imu_extract(filename, initialTime)
fid = fopen(filename);
formatString = strcat('%n%n%n',...
repmat('%n',1,14),...
'%n%n%n',...
repmat('%n',1,9),...
'%n%n%n',...
repmat('%n',1,9));
C = textscan(fid, ...
formatString,...
'delimiter',',', ...
'headerLines', 1);
fclose(fid);
bag_data = struct(...
'angular_velocity', [C{18}, C{19}, C{20}]', ...
'time', C{3} *10^-9 - initialTime, ...
'linear_acceleration', [C{30}, C{31}, C{32}]');
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment