WH-17 - Added a script for analysing wheel alignment errors

This commit is contained in:
gianmarcogirau 2019-08-01 14:45:07 +01:00
commit 49a8262c6c
2 changed files with 204 additions and 0 deletions

View file

@ -0,0 +1,76 @@
# HMB log file
< 2019_07_30_h09:39:37 > Loading Configuration file ./config/default.cfg
< 2019_07_30_h09:39:37 > Encoder Resolution = 20.0000000000
< 2019_07_30_h09:39:37 > Print-Head Resolution type = dpi
< 2019_07_30_h09:39:37 > Print-Head Resolution = 1200.0000000000
< 2019_07_30_h09:39:37 > Encoder Source = 0
< 2019_07_30_h09:39:37 > Internal Encoder Frequency = 5000.0000000000
< 2019_07_30_h09:39:37 > Encoder Phase = 1
< 2019_07_30_h09:39:37 > Encoder Edge = 2
< 2019_07_30_h09:39:37 > Encoder Directionality = 0
< 2019_07_30_h09:39:37 > PD Source = 3
< 2019_07_30_h09:39:37 > PD Edge = 0
< 2019_07_30_h09:39:37 > Print-Mode = Continuous
< 2019_07_30_h09:39:37 > PD-Type = None
< 2019_07_30_h09:39:37 > Image Length = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Gap Length = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Print-Head Width = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Forward-Pass Pre-Print Buffer Length = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Swathe Length = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Reverse-Pass Offset = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Pre-Print Additional Movement = 0.0000000000 mm
< 2019_07_30_h09:39:37 > Daisy-Chain Enable = 1
< 2019_07_30_h09:39:37 > Daisy-Chain Position = 1
< 2019_07_30_h09:39:37 > Daisy-Chain Length = 1
< 2019_07_30_h09:39:37 > Configuration file loaded.
< 2019_07_30_h09:39:37 > Make sure to be connected to the EMB Server and press the button 'Apply' to configure the EMB
< 2019_07_30_h09:39:37 > Starting Remote-Server on port 6124
< 2019_07_30_h09:39:46 > ERROR: Unable to connect to the EMB-server on IP address 192.168.79.139
< 2019_07_30_h09:40:21 > Opened connection to IP 192.168.79.139, Port 6121
< 2019_07_30_h09:40:21 > show server.version
< 2019_07_30_h09:40:21 > hmb_remote_server version 1.10016.0.5356
< 2019_07_30_h09:40:21 > show fpm_ctrl.fw_info
< 2019_07_30_h09:40:21 > GIS-HMB Board - Firmware version is F003
< 2019_07_30_h09:40:23 > set diag.pd_watchdog_enable 0 0.1
< 2019_07_30_h09:40:23 > set diag.polling 7 200
< 2019_07_30_h09:42:49 > show print.force_all_zeros
< 2019_07_30_h09:42:49 > 0
< 2019_07_30_h09:43:05 > set pg.wh_wheel_corr 1 4827
< 2019_07_30_h09:43:05 > W&H - Wheel Correction Enabled
< 2019_07_30_h09:43:30 > <Detected-PD> Event-Number #1, Time = 500.092 s, Positition = 101.540000 mm (abs_pos = 20308)
< 2019_07_30_h09:43:37 > <Wheel-Correction> - Rotation Count = 1, Position Error = -2.000, Division-Ratio Correction = -0.00331500
< 2019_07_30_h09:43:37 > <Detected-PD> Event-Number #2, Time = 506.773 s, Positition = 198.080000 mm (abs_pos = 39616)
< 2019_07_30_h09:43:44 > <Wheel-Correction> - Rotation Count = 2, Position Error = 1.000, Division-Ratio Correction = -0.00000000
< 2019_07_30_h09:43:44 > <Detected-PD> Event-Number #3, Time = 513.464 s, Positition = 294.620000 mm (abs_pos = 58924)
< 2019_07_30_h09:43:46 > <Detected-PD> Event-Number #4, Time = 515.962 s, Positition = 391.160000 mm (abs_pos = 78232)
< 2019_07_30_h09:43:47 > <Wheel-Correction> - Rotation Count = 3, Position Error = 2.000, Division-Ratio Correction = 0.00248600
< 2019_07_30_h09:43:49 > <Wheel-Correction> - Rotation Count = 4, Position Error = -1.000, Division-Ratio Correction = -0.00082900
< 2019_07_30_h09:43:49 > <Detected-PD> Event-Number #5, Time = 518.668 s, Positition = 487.700000 mm (abs_pos = 97540)
< 2019_07_30_h09:43:51 > <Detected-PD> Event-Number #6, Time = 520.496 s, Positition = 584.240000 mm (abs_pos = 116848)
< 2019_07_30_h09:43:51 > <Wheel-Correction> - Rotation Count = 5, Position Error = 0.000, Division-Ratio Correction = -0.00000000
< 2019_07_30_h09:43:52 > <Detected-PD> Event-Number #7, Time = 522.121 s, Positition = 680.780000 mm (abs_pos = 136156)
< 2019_07_30_h09:43:53 > <Wheel-Correction> - Rotation Count = 6, Position Error = 0.000, Division-Ratio Correction = -0.00000000
< 2019_07_30_h09:43:54 > <Detected-PD> Event-Number #8, Time = 523.475 s, Positition = 777.320000 mm (abs_pos = 155464)
< 2019_07_30_h09:43:54 > <Wheel-Correction> - Rotation Count = 7, Position Error = 0.000, Division-Ratio Correction = -0.00000000
< 2019_07_30_h09:44:12 > <Detected-PD> Event-Number #9, Time = 542.085 s, Positition = 872.320000 mm (abs_pos = 174464)
< 2019_07_30_h09:44:14 > <Wheel-Correction> - Rotation Count = 8, Position Error = -1.000, Division-Ratio Correction = -0.51046200
< 2019_07_30_h09:44:15 > <Detected-PD> Event-Number #10, Time = 544.155 s, Positition = 967.320000 mm (abs_pos = 193464)
< 2019_07_30_h09:44:15 > <Wheel-Correction> - Rotation Count = 9, Position Error = -1.000, Division-Ratio Correction = -0.25688900
< 2019_07_30_h09:44:17 > <Wheel-Correction> - Rotation Count = 10, Position Error = 2.000, Division-Ratio Correction = -0.25274600
< 2019_07_30_h09:44:17 > <Detected-PD> Event-Number #11, Time = 546.342 s, Positition = 1062.320000 mm (abs_pos = 212464)
< 2019_07_30_h09:44:19 > <Detected-PD> Event-Number #12, Time = 548.990 s, Positition = 1157.320000 mm (abs_pos = 231464)
< 2019_07_30_h09:44:20 > <Wheel-Correction> - Rotation Count = 11, Position Error = -1.000, Division-Ratio Correction = -0.25606000
< 2019_07_30_h09:44:22 > <Detected-PD> Event-Number #13, Time = 551.806 s, Positition = 1252.320000 mm (abs_pos = 250464)
< 2019_07_30_h09:44:22 > <Wheel-Correction> - Rotation Count = 12, Position Error = 0.000, Division-Ratio Correction = -0.25523200
< 2019_07_30_h09:44:24 > <Detected-PD> Event-Number #14, Time = 553.494 s, Positition = 1347.320000 mm (abs_pos = 269464)
< 2019_07_30_h09:44:24 > <Wheel-Correction> - Rotation Count = 13, Position Error = 0.000, Division-Ratio Correction = -0.25523200
< 2019_07_30_h09:44:25 > <Wheel-Correction> - Rotation Count = 14, Position Error = 0.000, Division-Ratio Correction = -0.25523200
< 2019_07_30_h09:44:25 > <Detected-PD> Event-Number #15, Time = 554.990 s, Positition = 1442.320000 mm (abs_pos = 288464)
< 2019_07_30_h09:59:11 > set diag.polling 0 200
< 2019_07_30_h09:59:11 > set server.disconnect
< 2019_07_30_h09:59:11 > Closed connection to 192.168.79.139
< 2019_07_30_h09:59:11 > <Wheel-Correction> - Rotation Count = -1, Position Error = 0.000, Division-Ratio Correction = -1.00000000
< 2019_07_30_h09:59:43 > Closing EMB Console ...

View file

@ -0,0 +1,128 @@
##/////////////////////////////////////////////////////////////////////////////
## Title : wheel_correction_analysis
##/////////////////////////////////////////////////////////////////////////////
## File : wheel_correction_analysis.py
## Author : Gianmarco Girau
## Company : GIS
## Target : HMB Console
## Dependency : none
##/////////////////////////////////////////////////////////////////////////////
## Description: Analyze misalignment error from wheel corrections
##/////////////////////////////////////////////////////////////////////////////
## Last update: 2019-05-30
##/////////////////////////////////////////////////////////////////////////////
## Revisions :
## Date Version Author Description
## 2019-05-30 01.00.0a gmg Created
##/////////////////////////////////////////////////////////////////////////////
from bokeh.plotting import figure, output_file, show
from bokeh.layouts import gridplot
rotation_idx = []
pos_err = []
pitch_corr = []
log_file_name = './hmb_log.txt'
data_file_name = './pitch_corr.csv'
plot_file_name_1 = './pitch_corr_1.html'
plot_file_name_2 = './pitch_corr_2.html'
##/////////////////////////////////////////////////////////////////////////////
## Get data from the log file
##/////////////////////////////////////////////////////////////////////////////
f_log = open(log_file_name, 'r')
for line in f_log:
target = '<Wheel-Correction> - '
idx =line.find(target)
if idx != -1:
target = 'Rotation Count = '
idx = line.find(target)
clist = line[idx+len(target):].split(None)
rotation_idx.append(int(clist[0][0:-1]))
target = 'Position Error = '
idx = line.find(target)
clist = line[idx + len(target):].split(None)
pos_err.append(float(clist[0][0:-1]))
target = 'Division-Ratio Correction = '
idx = line.find(target)
clist = line[idx + len(target):].split(None)
pitch_corr.append(float(clist[0][0:-1]))
#print("Rotation Idx = {0:d}, Position-Error = {1:f}, Pixel-Pitch-Correction = {2:f}".format(rotation_idx[-1], pos_err[-1], pitch_corr[-1]))
# Create empty lists for rotation numbers, errors, add an the corresponding item on each line
f_log.closed
# Save data on a separate CSV file
f_data = open(data_file_name, 'w')
f_data.write("Rotation index, Position Error, Pixel-Pitch Correction" + '\n')
for idx in range(0,len(rotation_idx)):
f_data.write("{0:d}, {1:f}, {2:f}".format(rotation_idx[idx], pos_err[idx], pitch_corr[idx]) + '\n')
f_data.close
##/////////////////////////////////////////////////////////////////////////////
## Plot-data
##/////////////////////////////////////////////////////////////////////////////
# output to static HTML file
output_file(plot_file_name_1)
plot_w = 500
plot_h = 500
toolset="pan,box_zoom,reset,save"
# create a new plot
s1 = figure(width=plot_w, plot_height=plot_h, title='Position Error', x_axis_label='Flexo Wheel Rotation', y_axis_label='Position Error [Encoder Steps]', tools=toolset)
s1.circle(rotation_idx, pos_err, size=5, color="navy", alpha=0.5)
s2 = figure(width=plot_w, height=plot_h, x_range=s1.x_range, y_range=s1.y_range, title='Pixel-Pitch Correction', x_axis_label='Flexo Wheel Rotation', y_axis_label='Pixel-Pitch Correction [Encoder Steps]', tools=toolset)
s2.triangle(rotation_idx, pitch_corr, size=10, color="olive", alpha=0.5)
#p = gridplot([[s1], [s2]], toolbar_location=None)
p = gridplot([[s1], [s2]])
# show the results
show(p)
# Create a second plot in um
# output to static HTML file
output_file(plot_file_name_2)
enc_res = 5
head_reas = 21.167
pos_err_um = [x*enc_res for x in pos_err]
pitch_corr_um = [x*enc_res for x in pitch_corr]
plot_w = 500
plot_h = 500
toolset="pan,box_zoom,reset,save"
# create a new plot
s1 = figure(width=plot_w, plot_height=plot_h, title='Position Error', x_axis_label='Flexo Wheel Rotation', y_axis_label='Position Error [um]', tools=toolset)
s1.circle(rotation_idx, pos_err_um, size=5, color="navy", alpha=0.5)
s2 = figure(width=plot_w, height=plot_h, x_range=s1.x_range, y_range=s1.y_range, title='Pixel-Pitch Correction', x_axis_label='Flexo Wheel Rotation', y_axis_label='Pixel-Pitch Correction [um]', tools=toolset)
s2.triangle(rotation_idx, pitch_corr_um, size=10, color="olive", alpha=0.5)
#p = gridplot([[s1], [s2]], toolbar_location=None)
p = gridplot([[s1], [s2]])
# show the results
show(p)