0. save to the bag files
rosbag record -O [topic name group]
1. save csv files
rostopic echo -b [bag_name].bag -p [topic_name] > [csv_name].csv
2. read the csv files in Matlab
% filename =
cd …
currentPath = pwd;
filename =strcat(strcat(currentPath,’’), ‘leaderPosition_new.csv’);
% aaa = csvread(filename);
T = readtable(filename);
plot(T.field_pose_position_x, T.field_pose_position_y, ‘r-’);
% axis equal
clc
num2str(T.x_time-T.x_time(1))
hold on
plot(T.x_time-T.x_time(1), T.field_pose_position_x);
3. ros timestamp
ros time
nsec
should * 10^(-9)