DDA:testing steps

start the simulation with ./parse_clean xyz, where 'xyz' can be anything to name the created files.

in the end you will get 3 pictures.
swan-reference-xyz.png how it should looks like.
swan-current-xyz.png how it will looks now.
swan-diff-xyz.png is the difference.

This 3 pictures show only the X-axis.

you will get also a forth file. pp-xyz.asc. you can open this file for example with meshlab and you can see that current model in 3d.

If you want to use your own gcode, please do the following:
Create a normal gcode. Delete any M116 (temp waitings). Maybe you want also deleting comments.
Then add M114 for every x line.
I do this with the swan-test.gcode:
sed '1~2 s/$/\nM114/g' < swan.gcode > swan-test.gcode
This commit is contained in:
Nico Tonnhofer 2017-01-04 00:18:19 +01:00
parent c441548c37
commit e52b1d2a69
3 changed files with 205480 additions and 0 deletions

20
testcases/parse_clean.sh Executable file
View File

@ -0,0 +1,20 @@
name=${1:-000}
cd ..
make -f Makefile-SIM clean
make -f Makefile-SIM USER_CONFIG=./testcases/config.regtest-ramps.h
cd testcases
../sim -t0 -g swan-test.gcode -o
python3 parse_datalog.py 'datalog.out' 'swan.log' "swan-${name}.asc"
gnuplot <<__EOF
set term png size 1024,768
set output "swan-diff-${name}.png"
plot 'swan.log' u 1:4 with lines
set yrange [80:120]
set output "swan-reference-${name}.png"
plot 'swan.log' u 1:2 with lines
set output "swan-current-${name}.png"
plot 'swan.log' u 1:3 with lines
__EOF

View File

@ -0,0 +1,64 @@
import sys
import linecache
in_file = sys.argv[1]
out_file = sys.argv[2]
pp_file = sys.argv[3]
diff_list = list()
pseudo_print = list()
#define STEPS_PER_M_X 40000
#define STEPS_PER_M_Y 40000
#define STEPS_PER_M_Z 320000
def parse_stepper_position(line):
s_line = line.split()
X = float(s_line[1]) / 40. # X-axis
Y = float(s_line[2]) / 40. # Y-axis
Z = float(s_line[3]) / 320. # Z-axis
return X, Y, Z
def parse_m114_position(line):
s_line = line.split(',')
X = float(s_line[0][4:])
Y = float(s_line[1][2:])
Z = float(s_line[2][2:])
return X, Y, Z
with open(in_file, 'r') as file:
start_with_line = 50
found_m114 = False
for _ in range(start_with_line - 1):
next(file)
for i, line in enumerate(file, start_with_line):
if found_m114: # we found a M114 before, so next line is the result
found_m114 = False
x1, y1, z1 = parse_m114_position(line)
x = x2 - x1
diff_list.append('{}\t\t\t{}\t\t\t{}\t\t\t{}\n'.format(i, x1, x2, x))
pseudo_print.append('{}\t\t\t{}\t\t\t{}\n'.format(x2, y2, z2))
if line[0] == '#':
if line[2:6] == 'M114':
found_m114 = True
# find the line with stepping positions before the M114
# print(linecache.getline(in_file, i))
for x in range(i - 1, i-20, -1):
pre_m114_line = linecache.getline(in_file, x)
if len(pre_m114_line.split()) == 21:
break
x2, y2, z2 = parse_stepper_position(pre_m114_line)
with open(out_file, 'w') as file:
file.writelines(diff_list)
with open(pp_file, 'w') as file:
file.writelines(pseudo_print)

205396
testcases/swan-test.gcode Normal file

File diff suppressed because it is too large Load Diff