'P:/Motiv/1030_Robotics_Development_IRAD/02_Engineering/IRAD Actuator/Single_Axis_Testing/Testing_Data/Weighted_Testing_PosvsStrain/07272017_/' + load_amt + '/' + load_amt + '_125_0Hz_' + load_case + '_wTorque.csv', delimiter=',', skip_header=True) filtered_wave = adjust_load(load_wave, calibration_wave=cal_wave, width=w, sigma=sig) torque_wave = np.genfromtxt( 'P:/Motiv/1030_Robotics_Development_IRAD/02_Engineering/IRAD Actuator/Single_Axis_Testing/Testing_Data/Weighted_Testing_PosvsStrain/07272017_/' + load_amt + '/' + load_amt + '_125_0Hz_' + load_case + '_wTorque.csv', delimiter=',', skip_header=True) torque_wave = torque_wave[:, [0, 2]] torque_wave[:, 1] = torque_wave[:, 1] * (144.15 / 2048) smooth_wave = moving_avg(filtered_wave) #waves = [filtered_wave, smooth_wave, torque_wave] #labels = ['23.5Nm_filtered', '23.5Nm_moving_average', 'Torque_Sensor'] #markers = ['bo', 'ro', 'g1'] #scaling = [False, False, False] # #plot_num += 1 # #plot_wave(waves, labels, markers, plot_num, scaling) # #waves = [torque_wave] #labels = [ 'Torque_Sensor'] #markers = ['g1'] #scaling = [False] #
for i in range(0, np.size(pos)): torque_wave[i] = delta_amp * np.sin( (np.pi / load_phase) + (2 * np.pi / pos_num) * pos[i]) + np.random.randint( delta_low, delta_high) torque_wave = np.column_stack((pos, torque_wave)) #plot raw loaded wave plt.figure(3) plt.plot(pos, load_sin, 'b1') #build 2-D array for loaded wave load_wave = np.column_stack((pos, load_sin)) #generate filtered wave from calibration wave filtered_wave = adjust_load(wave=load_wave, calibration_wave=cal_wave, width=w_, sigma=sig_) #generate moving average from filtered wave smooth_wave = moving_avg(filtered_wave, win_len=wl_) plt.figure(4) plt.plot(torque_wave[:, 0], torque_wave[:, 1], 'r1') plt.figure(5) plt.plot(filtered_wave[:, 0], filtered_wave[:, 1], 'r1') plt.plot(torque_wave[:, 0], torque_wave[:, 1], 'y1') plt.plot(smooth_wave[:, 0], smooth_wave[:, 1], 'g1')
corr_100_100 = np.corrcoef(calib_100[:, 1], calib_100[:, 1]) print('30_30', corr_30_30) print('30_45', corr_30_45) print('30_100', corr_30_100) print('45_45', corr_45_45) print('45_100', corr_45_100) print('100_100', corr_100_100) #Use new calibration curve to generate a filtered curve new_30 = adjust_load(f_load_30, calib_100) new_45 = adjust_load(f_load_45, calib_100) new_100 = adjust_load(f_load_100, calib_100) #Get moving average smooth_30 = moving_avg(new_30) smooth_45 = moving_avg(new_45) smooth_100 = moving_avg(new_100) #Plot curves #30ks curves waves = [new_30, smooth_30] labels = ['30ks_adjusted', '30ks_moving_average'] markers = ['b1', 'r1'] scale = [True, True] plot_num += 1 plot_wave(waves, labels, markers, plot_num, scale) print_min_max(smooth_30) #45ks curves