10 import matplotlib.pyplot
as plt
18 main_data = pd.read_csv(file_path, skipinitialspace=
True)
19 print(f
"Main data loaded from {file_path}")
20 except Exception
as e:
21 print(f
"Error reading {file_path}: {e}")
25 base_name = file_path.replace(
"pose.log",
"")
26 wheel_files = [f
"{base_name}wheel{i}.log" for i
in range(1, 5)]
30 for i, wheel_file
in enumerate(wheel_files, start=1):
32 wheel_data[i] = pd.read_csv(wheel_file, skipinitialspace=
True)
33 print(f
"Wheel {i} data loaded from {wheel_file}")
34 except Exception
as e:
35 print(f
"Error reading {wheel_file}: {e}")
46 """Create plots for the main file data."""
47 plt.figure(figsize=(12, 8))
50 ts = data[
'Timestamp'].to_numpy()
54 plt.plot(ts, data[
'qx'].to_numpy(), label=
'qx')
55 plt.plot(ts, data[
'qy'].to_numpy(), label=
'qy')
56 plt.plot(ts, data[
'qz'].to_numpy(), label=
'qz')
57 plt.xlabel(
'Timestamp')
58 plt.ylabel(
'Position')
59 plt.title(
'Position (qx, qy, qz) vs Time')
66 data[
'qpitch'].to_numpy(), label=
'qpitch')
68 data[
'qroll'].to_numpy(), label=
'qroll')
70 data[
'qyaw'].to_numpy(), label=
'qyaw')
71 plt.xlabel(
'Timestamp')
72 plt.ylabel(
'Orientation')
73 plt.title(
'Orientation Angles vs Time')
79 plt.plot(ts, data[
'dqx'].to_numpy(), label=
'dqx', color=
'red')
80 plt.plot(ts, data[
'dqy'].to_numpy(), label=
'dqy', color=
'green')
81 plt.plot(ts, data[
'dqz'].to_numpy(), label=
'dqz', color=
'blue')
82 plt.xlabel(
'Timestamp')
83 plt.ylabel(
'Velocity')
84 plt.title(
'Velocity components')
93 """Create plots for the wheel data."""
94 plt.figure(figsize=(12, 12))
97 variables = [
'friction_x',
'friction_y',
98 'velocity_x',
'velocity_y',
100 wheel_names = [
'LR',
'RR',
'LF',
'RF']
102 for i, var
in enumerate(variables, start=1):
104 for wheel, data
in wheel_data.items():
105 ts = data[
'Timestamp'].to_numpy()
107 data[var].to_numpy(), label=f
'{wheel_names[wheel-1]} wheel')
108 plt.xlabel(
'Timestamp')
110 plt.title(f
'{var.capitalize()} vs Time')
115 plt.show(block=
False)
118 if __name__ ==
"__main__":
120 if len(sys.argv) != 2:
121 print(
"Usage: python3 script.py </path/to/session1-mvsim_r1_logger_pose.log>")
124 file_path = sys.argv[1]