add some MDI queueing tests
This commit is contained in:
parent
b5bca20c2c
commit
1775f4f9cb
18 changed files with 372 additions and 0 deletions
6
tests/mdi-queue/.gitignore
vendored
Normal file
6
tests/mdi-queue/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
dump.rdb
|
||||
expected-gcode-output
|
||||
lots-of-gcode
|
||||
gcode-output
|
||||
sim.var
|
||||
sim.var.bak
|
||||
53
tests/mdi-queue/core_sim.hal
Normal file
53
tests/mdi-queue/core_sim.hal
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# core HAL config file for simulation
|
||||
|
||||
# first load all the RT modules that will be needed
|
||||
# kinematics
|
||||
loadrt trivkins
|
||||
# motion controller, get name and thread periods from ini file
|
||||
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
|
||||
# load 6 differentiators (for velocity and accel signals
|
||||
loadrt ddt count=6
|
||||
# load additional blocks
|
||||
loadrt hypot count=2
|
||||
loadrt comp count=3
|
||||
loadrt or2 count=1
|
||||
|
||||
# add motion controller functions to servo thread
|
||||
addf motion-command-handler servo-thread
|
||||
addf motion-controller servo-thread
|
||||
# link the differentiator functions into the code
|
||||
addf ddt.0 servo-thread
|
||||
addf ddt.1 servo-thread
|
||||
addf ddt.2 servo-thread
|
||||
addf ddt.3 servo-thread
|
||||
addf ddt.4 servo-thread
|
||||
addf ddt.5 servo-thread
|
||||
addf hypot.0 servo-thread
|
||||
addf hypot.1 servo-thread
|
||||
|
||||
# create HAL signals for position commands from motion module
|
||||
# loop position commands back to motion module feedback
|
||||
net Xpos axis.0.motor-pos-cmd => axis.0.motor-pos-fb ddt.0.in
|
||||
net Ypos axis.1.motor-pos-cmd => axis.1.motor-pos-fb ddt.2.in
|
||||
net Zpos axis.2.motor-pos-cmd => axis.2.motor-pos-fb ddt.4.in
|
||||
|
||||
# send the position commands thru differentiators to
|
||||
# generate velocity and accel signals
|
||||
net Xvel ddt.0.out => ddt.1.in hypot.0.in0
|
||||
net Xacc <= ddt.1.out
|
||||
net Yvel ddt.2.out => ddt.3.in hypot.0.in1
|
||||
net Yacc <= ddt.3.out
|
||||
net Zvel ddt.4.out => ddt.5.in hypot.1.in0
|
||||
net Zacc <= ddt.5.out
|
||||
|
||||
# Cartesian 2- and 3-axis velocities
|
||||
net XYvel hypot.0.out => hypot.1.in1
|
||||
net XYZvel <= hypot.1.out
|
||||
|
||||
# estop loopback
|
||||
net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
|
||||
|
||||
# create signals for tool loading loopback
|
||||
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
|
||||
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed
|
||||
|
||||
81
tests/mdi-queue/linuxcncrsh-test.ini
Normal file
81
tests/mdi-queue/linuxcncrsh-test.ini
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
[EMC]
|
||||
DEBUG = 0x7FFFFFFF
|
||||
#DEBUG = 0
|
||||
|
||||
[DISPLAY]
|
||||
DISPLAY = linuxcncrsh --path=./
|
||||
|
||||
[TASK]
|
||||
TASK = milltask
|
||||
CYCLE_TIME = 0.001
|
||||
|
||||
[RS274NGC]
|
||||
PARAMETER_FILE = sim.var
|
||||
USER_M_PATH = ../subs
|
||||
SUBROUTINE_PATH = ../subs
|
||||
#LOG_LEVEL = 99999999
|
||||
|
||||
[EMCMOT]
|
||||
EMCMOT = motmod
|
||||
COMM_TIMEOUT = 1.0
|
||||
COMM_WAIT = 0.010
|
||||
BASE_PERIOD = 0
|
||||
SERVO_PERIOD = 1000000
|
||||
|
||||
[HAL]
|
||||
HALFILE = core_sim.hal
|
||||
|
||||
[TRAJ]
|
||||
AXES = 3
|
||||
COORDINATES = X Y Z
|
||||
HOME = 0 0 0
|
||||
LINEAR_UNITS = inch
|
||||
ANGULAR_UNITS = degree
|
||||
CYCLE_TIME = 0.010
|
||||
DEFAULT_VELOCITY = 1.2
|
||||
MAX_LINEAR_VELOCITY = 4
|
||||
|
||||
[AXIS_0]
|
||||
TYPE = LINEAR
|
||||
HOME = 0.000
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 100.0
|
||||
BACKLASH = 0.000
|
||||
INPUT_SCALE = 4000
|
||||
OUTPUT_SCALE = 1.000
|
||||
MIN_LIMIT = -40.0
|
||||
MAX_LIMIT = 40.0
|
||||
FERROR = 0.050
|
||||
MIN_FERROR = 0.010
|
||||
|
||||
[AXIS_1]
|
||||
TYPE = LINEAR
|
||||
HOME = 0.000
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 100.0
|
||||
BACKLASH = 0.000
|
||||
INPUT_SCALE = 4000
|
||||
OUTPUT_SCALE = 1.000
|
||||
MIN_LIMIT = -40.0
|
||||
MAX_LIMIT = 40.0
|
||||
FERROR = 0.050
|
||||
MIN_FERROR = 0.010
|
||||
|
||||
[AXIS_2]
|
||||
TYPE = LINEAR
|
||||
HOME = 0.0
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 100.0
|
||||
BACKLASH = 0.000
|
||||
INPUT_SCALE = 4000
|
||||
OUTPUT_SCALE = 1.000
|
||||
MIN_LIMIT = -4.0
|
||||
MAX_LIMIT = 4.0
|
||||
FERROR = 0.050
|
||||
MIN_FERROR = 0.010
|
||||
|
||||
[EMCIO]
|
||||
EMCIO = io
|
||||
CYCLE_TIME = 0.100
|
||||
TOOL_TABLE = tool.tbl
|
||||
|
||||
1
tests/mdi-queue/oword-queue-buster/checkresult
Symbolic link
1
tests/mdi-queue/oword-queue-buster/checkresult
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../shared-checkresult
|
||||
1
tests/mdi-queue/oword-queue-buster/core_sim.hal
Symbolic link
1
tests/mdi-queue/oword-queue-buster/core_sim.hal
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../core_sim.hal
|
||||
5
tests/mdi-queue/oword-queue-buster/dummy.ngc
Normal file
5
tests/mdi-queue/oword-queue-buster/dummy.ngc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
g53 g0 x0 y0 z0
|
||||
|
||||
m2
|
||||
|
||||
1
tests/mdi-queue/oword-queue-buster/linuxcncrsh-test.ini
Symbolic link
1
tests/mdi-queue/oword-queue-buster/linuxcncrsh-test.ini
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../linuxcncrsh-test.ini
|
||||
93
tests/mdi-queue/oword-queue-buster/test.sh
Executable file
93
tests/mdi-queue/oword-queue-buster/test.sh
Executable file
|
|
@ -0,0 +1,93 @@
|
|||
#!/bin/bash
|
||||
|
||||
rm -f gcode-output
|
||||
|
||||
linuxcnc -v -d linuxcncrsh-test.ini &
|
||||
|
||||
|
||||
# let linuxcnc come up
|
||||
TOGO=80
|
||||
while [ $TOGO -gt 0 ]; do
|
||||
echo trying to connect to linuxcncrsh TOGO=$TOGO
|
||||
if nc -z localhost 5007; then
|
||||
# there's apparently a bug somewhere, which makes it so linuxcncrsh
|
||||
# is not ready to talk to clients when it creates its listening
|
||||
# socket
|
||||
sleep 2
|
||||
break
|
||||
fi
|
||||
sleep 0.25
|
||||
TOGO=$(($TOGO - 1))
|
||||
done
|
||||
if [ $TOGO -eq 0 ]; then
|
||||
echo connection to linuxcncrsh timed out
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# switch back and forth between tool 1 and tool 2 every few MDI calls
|
||||
rm -f expected-gcode-output lots-of-gcode
|
||||
printf "P is %.6f\n" -100 >> expected-gcode-output
|
||||
NUM_MDIS=1
|
||||
NUM_MDIS_LEFT=$NUM_MDIS
|
||||
TOOL=1
|
||||
for i in $(seq 0 1000); do
|
||||
NUM_MDIS_LEFT=$(($NUM_MDIS_LEFT - 1))
|
||||
if [ $NUM_MDIS_LEFT -eq 0 ]; then
|
||||
echo "set mdi o<queue-buster> call [$TOOL]" >> lots-of-gcode
|
||||
printf "P is 12345.000000\n" >> expected-gcode-output
|
||||
printf "P is %.6f\n" $((-1 * $TOOL)) >> expected-gcode-output
|
||||
printf "P is 54321.000000\n" >> expected-gcode-output
|
||||
|
||||
if [ $TOOL -eq 1 ]; then
|
||||
TOOL=2
|
||||
else
|
||||
TOOL=1
|
||||
fi
|
||||
|
||||
NUM_MDIS=$(($NUM_MDIS + 1))
|
||||
if [ $NUM_MDIS -gt 10 ]; then
|
||||
NUM_MDIS=1
|
||||
fi
|
||||
|
||||
NUM_MDIS_LEFT=$NUM_MDIS
|
||||
fi
|
||||
echo "set mdi m100 p$i" >> lots-of-gcode
|
||||
printf "P is %.6f\n" $i >> expected-gcode-output
|
||||
done
|
||||
printf "P is %.6f\n" -200 >> expected-gcode-output
|
||||
|
||||
(
|
||||
echo hello EMC mt 1.0
|
||||
echo set enable EMCTOO
|
||||
|
||||
echo set mode manual
|
||||
echo set estop off
|
||||
echo set machine on
|
||||
|
||||
echo set home 0
|
||||
echo set home 1
|
||||
echo set home 2
|
||||
sleep 2
|
||||
|
||||
echo set mode auto
|
||||
echo set open dummy.ngc
|
||||
|
||||
echo set mode mdi
|
||||
echo set mdi m100 p-100
|
||||
echo set wait done
|
||||
|
||||
# here comes a big blob
|
||||
dd bs=4096 if=lots-of-gcode
|
||||
|
||||
echo set mdi m100 p-200
|
||||
echo set wait done
|
||||
|
||||
echo shutdown
|
||||
) | nc localhost 5007
|
||||
|
||||
|
||||
# wait for linuxcnc to finish
|
||||
wait
|
||||
|
||||
exit 0
|
||||
|
||||
1
tests/mdi-queue/oword-queue-buster/tool.tbl
Symbolic link
1
tests/mdi-queue/oword-queue-buster/tool.tbl
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../tool.tbl
|
||||
6
tests/mdi-queue/shared-checkresult
Executable file
6
tests/mdi-queue/shared-checkresult
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
TEST_DIR=$(dirname $1)
|
||||
cd $TEST_DIR
|
||||
|
||||
diff -u expected-gcode-output gcode-output
|
||||
1
tests/mdi-queue/simple-queue-buster/checkresult
Symbolic link
1
tests/mdi-queue/simple-queue-buster/checkresult
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../shared-checkresult
|
||||
1
tests/mdi-queue/simple-queue-buster/core_sim.hal
Symbolic link
1
tests/mdi-queue/simple-queue-buster/core_sim.hal
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../core_sim.hal
|
||||
1
tests/mdi-queue/simple-queue-buster/linuxcncrsh-test.ini
Symbolic link
1
tests/mdi-queue/simple-queue-buster/linuxcncrsh-test.ini
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../linuxcncrsh-test.ini
|
||||
90
tests/mdi-queue/simple-queue-buster/test.sh
Executable file
90
tests/mdi-queue/simple-queue-buster/test.sh
Executable file
|
|
@ -0,0 +1,90 @@
|
|||
#!/bin/bash
|
||||
|
||||
rm -f gcode-output
|
||||
|
||||
linuxcnc -v -d linuxcncrsh-test.ini &
|
||||
|
||||
|
||||
# let linuxcnc come up
|
||||
TOGO=80
|
||||
while [ $TOGO -gt 0 ]; do
|
||||
echo trying to connect to linuxcncrsh TOGO=$TOGO
|
||||
if nc -z localhost 5007; then
|
||||
# there's apparently a bug somewhere, which makes it so linuxcncrsh
|
||||
# is not ready to talk to clients when it creates its listening
|
||||
# socket
|
||||
sleep 2
|
||||
break
|
||||
fi
|
||||
sleep 0.25
|
||||
TOGO=$(($TOGO - 1))
|
||||
done
|
||||
if [ $TOGO -eq 0 ]; then
|
||||
echo connection to linuxcncrsh timed out
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# switch back and forth between tool 1 and tool 2 every few MDI calls
|
||||
rm -f expected-gcode-output lots-of-gcode
|
||||
printf "P is %.6f\n" -1 >> expected-gcode-output
|
||||
NUM_MDIS=1
|
||||
NUM_MDIS_LEFT=$NUM_MDIS
|
||||
TOOL=1
|
||||
for i in $(seq 0 1000); do
|
||||
NUM_MDIS_LEFT=$(($NUM_MDIS_LEFT - 1))
|
||||
if [ $NUM_MDIS_LEFT -eq 0 ]; then
|
||||
echo "set mdi t$TOOL m6" >> lots-of-gcode
|
||||
if [ $TOOL -eq 1 ]; then
|
||||
TOOL=2
|
||||
else
|
||||
TOOL=1
|
||||
fi
|
||||
|
||||
NUM_MDIS=$(($NUM_MDIS + 1))
|
||||
if [ $NUM_MDIS -gt 10 ]; then
|
||||
NUM_MDIS=1
|
||||
fi
|
||||
|
||||
NUM_MDIS_LEFT=$NUM_MDIS
|
||||
fi
|
||||
echo "set mdi m100 p$i" >> lots-of-gcode
|
||||
printf "P is %.6f\n" $i >> expected-gcode-output
|
||||
done
|
||||
printf "P is %.6f\n" -2 >> expected-gcode-output
|
||||
|
||||
(
|
||||
echo hello EMC mt 1.0
|
||||
echo set enable EMCTOO
|
||||
|
||||
# ask linuxcncrsh to not read the next command until it's done running
|
||||
# the current one
|
||||
#echo set set_wait done
|
||||
|
||||
echo set mode manual
|
||||
echo set estop off
|
||||
echo set machine on
|
||||
|
||||
echo set home 0
|
||||
echo set home 1
|
||||
echo set home 2
|
||||
sleep 2
|
||||
|
||||
echo set mode mdi
|
||||
echo set mdi m100 p-1
|
||||
echo set wait done
|
||||
|
||||
# here comes a big blob
|
||||
dd bs=4096 if=lots-of-gcode
|
||||
|
||||
echo set mdi m100 p-2
|
||||
echo set wait done
|
||||
|
||||
echo shutdown
|
||||
) | nc localhost 5007
|
||||
|
||||
|
||||
# wait for linuxcnc to finish
|
||||
wait
|
||||
|
||||
exit 0
|
||||
|
||||
1
tests/mdi-queue/simple-queue-buster/tool.tbl
Symbolic link
1
tests/mdi-queue/simple-queue-buster/tool.tbl
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../tool.tbl
|
||||
17
tests/mdi-queue/subs/M100
Executable file
17
tests/mdi-queue/subs/M100
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# This script (M100) is called to append an integer to a log file,
|
||||
# for testing purposes
|
||||
#
|
||||
# Put this in your .ini to use:
|
||||
#
|
||||
# [RS274NGC]USER_M_PATH = ./subs
|
||||
#
|
||||
|
||||
TEST_DIR=$(dirname INI_FILE_NAME)
|
||||
OUT_FILE=$TEST_DIR/gcode-output
|
||||
|
||||
P=$1
|
||||
|
||||
echo P is $P >> $OUT_FILE
|
||||
|
||||
11
tests/mdi-queue/subs/queue-buster.ngc
Normal file
11
tests/mdi-queue/subs/queue-buster.ngc
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
o<queue-buster> sub
|
||||
m100 p12345
|
||||
|
||||
t#1
|
||||
m6
|
||||
|
||||
m100 p-#5400 ; current tool
|
||||
m100 p54321
|
||||
o<queue-buster> endsub
|
||||
|
||||
2
tests/mdi-queue/tool.tbl
Normal file
2
tests/mdi-queue/tool.tbl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
T1 P1 D0.125000 Z+1.000000 ;
|
||||
T2 P2 ;
|
||||
Loading…
Reference in a new issue