import numpy as np import matplotlib.pyplot as plt from scipy.signal import savgol_filter # Ban scientific notation in results np.set_printoptions(precision=2, suppress=True) # TODO Data path cls = "Cup" idx = ["A"] #idx = ["A", "B", "C"] def plot_time_series(data, title = "Time Series Data"): n_ch = data.shape[1] plt.figure(figsize=(12, 7)) for i in range(n_ch): plt.subplot(n_ch, 1, 1+i) plt.plot(data[:, i], label=f'Channel {i+1}') plt.suptitle(title) plt.tight_layout() plt.show() for id in idx: # Load the raw data path = f'data/Simulation/Pick & Place - Ur5/Simulation_Ur5_{cls}_{id}.npy' data = np.load(path) print(f"Loaded data from {path} with shape: {data.shape}") # Slice the data joint_pos = data[:, 0:6] joint_vel = data[:, 6:12] joint_tor = data[:, 12:18] ft_readings = data[:, 18:21] timestamp = data[:, 21] # ----- 1. Joint Position ----- plot_time_series(joint_pos, title="Joint Position (6 channels)") # ----- 2. Joint Velocity ----- plot_time_series(joint_vel, title="Joint Velocity (6 channels)") # ----- 3. Joint Torque ----- plot_time_series(joint_tor, title="Joint Torque (6 channels)")