Import LinuxCNC source tree
This commit is contained in:
2
tests/mdi-while-queuebuster-waitflag/.gitignore
vendored
Normal file
2
tests/mdi-while-queuebuster-waitflag/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/core
|
||||
/sim.var*
|
||||
3
tests/mdi-while-queuebuster-waitflag/README
Normal file
3
tests/mdi-while-queuebuster-waitflag/README
Normal file
@@ -0,0 +1,3 @@
|
||||
This test tries to hit a race condition where an MDI command is
|
||||
executed when a queue buster is waiting to be restarted after
|
||||
INTERP_EXEC_FINISH.
|
||||
2
tests/mdi-while-queuebuster-waitflag/checkresult
Executable file
2
tests/mdi-while-queuebuster-waitflag/checkresult
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exit 0 # test failure is indicated by test.sh exit value
|
||||
65
tests/mdi-while-queuebuster-waitflag/core_sim.hal
Normal file
65
tests/mdi-while-queuebuster-waitflag/core_sim.hal
Normal file
@@ -0,0 +1,65 @@
|
||||
# core HAL config file for simulation
|
||||
|
||||
# first load all the RT modules that will be needed
|
||||
# kinematics
|
||||
loadrt [KINS]KINEMATICS
|
||||
# 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=[KINS]JOINTS
|
||||
# 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 joint.0.motor-pos-cmd => joint.0.motor-pos-fb ddt.0.in
|
||||
net Ypos joint.1.motor-pos-cmd => joint.1.motor-pos-fb ddt.2.in
|
||||
net Zpos joint.2.motor-pos-cmd => joint.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-prepare <= iocontrol.0.tool-prepare
|
||||
net tool-prepared => iocontrol.0.tool-prepared
|
||||
|
||||
net tool-change <= iocontrol.0.tool-change
|
||||
net tool-changed => iocontrol.0.tool-changed
|
||||
|
||||
net tool-number <= iocontrol.0.tool-number
|
||||
net tool-prep-number <= iocontrol.0.tool-prep-number
|
||||
net tool-prep-pocket <= iocontrol.0.tool-prep-pocket
|
||||
|
||||
# create analog in signal with fake value for m66
|
||||
net ain-0-fake => motion.analog-in-00
|
||||
sets ain-0-fake 42.13
|
||||
# create digital out signal for m62-m65
|
||||
net dout-0-fake => motion.digital-out-00
|
||||
20
tests/mdi-while-queuebuster-waitflag/remap.py
Normal file
20
tests/mdi-while-queuebuster-waitflag/remap.py
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
import linuxcnc
|
||||
import emccanon
|
||||
import interpreter
|
||||
|
||||
def init_stdglue(self):
|
||||
pass
|
||||
|
||||
def M400(self,**words):
|
||||
|
||||
self.execute("M66 E0 L0")
|
||||
# self.execute("M66 P0 L1 Q1")
|
||||
print("self.input_flag pre = %s" % self.input_flag)
|
||||
yield interpreter.INTERP_EXECUTE_FINISH
|
||||
|
||||
print("self.input_flag post = %s" % self.input_flag)
|
||||
# optionally,
|
||||
# yield interpreter.INTERP_OK
|
||||
|
||||
|
||||
3
tests/mdi-while-queuebuster-waitflag/simpockets.tbl
Normal file
3
tests/mdi-while-queuebuster-waitflag/simpockets.tbl
Normal file
@@ -0,0 +1,3 @@
|
||||
T1 P1 D0.125000 Z+1.000000 ;
|
||||
T10 P3 D0.500000 Z+3.000000 ;
|
||||
T99999 P50 Z+2.000000 ;
|
||||
26
tests/mdi-while-queuebuster-waitflag/test-ui.py
Executable file
26
tests/mdi-while-queuebuster-waitflag/test-ui.py
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import linuxcnc, hal
|
||||
import sys
|
||||
|
||||
# Initialization
|
||||
c = linuxcnc.command()
|
||||
s = linuxcnc.stat()
|
||||
c.state(linuxcnc.STATE_ESTOP_RESET)
|
||||
c.state(linuxcnc.STATE_ON)
|
||||
c.mode(linuxcnc.MODE_MDI)
|
||||
|
||||
c.mdi('(print,pre 1)')
|
||||
c.mdi('(print,pre 2)')
|
||||
c.mdi('M400')
|
||||
c.mdi('(print,post 1)')
|
||||
c.mdi('(print,post 2)')
|
||||
c.mdi('(print,post 3)')
|
||||
c.mdi('(print,post 4)')
|
||||
c.mdi('(print,post 5)')
|
||||
c.mdi('(print,post 6)')
|
||||
|
||||
# Shutdown
|
||||
c.wait_complete()
|
||||
sys.exit(0)
|
||||
|
||||
106
tests/mdi-while-queuebuster-waitflag/test.ini
Normal file
106
tests/mdi-while-queuebuster-waitflag/test.ini
Normal file
@@ -0,0 +1,106 @@
|
||||
[EMC]
|
||||
VERSION = 1.1
|
||||
LOG_LEVEL = 1000
|
||||
|
||||
[DISPLAY]
|
||||
DISPLAY = ./test-ui.py
|
||||
|
||||
[RS274NGC]
|
||||
PARAMETER_FILE = sim.var
|
||||
SUBROUTINE_PATH = .
|
||||
REMAP= M400 modalgroup=5 argspec=pelq py=M400
|
||||
LOG_LEVEL = 1000
|
||||
|
||||
[EMCMOT]
|
||||
EMCMOT = motmod
|
||||
COMM_TIMEOUT = 4.0
|
||||
BASE_PERIOD = 0
|
||||
SERVO_PERIOD = 1000000
|
||||
|
||||
[TASK]
|
||||
TASK = milltask
|
||||
CYCLE_TIME = 0.001
|
||||
|
||||
[HAL]
|
||||
HALUI = halui
|
||||
HALFILE = core_sim.hal
|
||||
|
||||
[TRAJ]
|
||||
NO_FORCE_HOMING=1
|
||||
AXES = 3
|
||||
COORDINATES = X Y Z
|
||||
HOME = 0 0 0
|
||||
LINEAR_UNITS = inch
|
||||
ANGULAR_UNITS = degree
|
||||
DEFAULT_LINEAR_VELOCITY = 1.2
|
||||
MAX_LINEAR_VELOCITY = 4
|
||||
|
||||
[EMCIO]
|
||||
TOOL_TABLE = simpockets.tbl
|
||||
TOOL_CHANGE_QUILL_UP = 1
|
||||
RANDOM_TOOLCHANGER = 0
|
||||
|
||||
[KINS]
|
||||
KINEMATICS = trivkins
|
||||
JOINTS = 3
|
||||
|
||||
[AXIS_X]
|
||||
MIN_LIMIT = -40.0
|
||||
MAX_LIMIT = 40.0
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 1000.0
|
||||
|
||||
[JOINT_0]
|
||||
TYPE = LINEAR
|
||||
HOME = 0.000
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 1000.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_Y]
|
||||
MIN_LIMIT = -40.0
|
||||
MAX_LIMIT = 40.0
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 1000.0
|
||||
|
||||
[JOINT_1]
|
||||
TYPE = LINEAR
|
||||
HOME = 0.000
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 1000.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_Z]
|
||||
MIN_LIMIT = -40.0
|
||||
MAX_LIMIT = 40.0
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 1000.0
|
||||
|
||||
[JOINT_2]
|
||||
TYPE = LINEAR
|
||||
HOME = 0.0
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 1000.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
|
||||
|
||||
[PYTHON]
|
||||
TOPLEVEL= toplevel.py
|
||||
PATH_PREPEND= .
|
||||
10
tests/mdi-while-queuebuster-waitflag/test.sh
Executable file
10
tests/mdi-while-queuebuster-waitflag/test.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# Variable 'i' is unused, just a loop count
|
||||
# shellcheck disable=SC2034
|
||||
for i in $(seq 20); do
|
||||
linuxcnc -r test.ini
|
||||
if grep -q '^[^+].*Segmentation fault' stderr; then
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
5
tests/mdi-while-queuebuster-waitflag/toplevel.py
Executable file
5
tests/mdi-while-queuebuster-waitflag/toplevel.py
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import remap
|
||||
|
||||
def __init__(self):
|
||||
remap.init_stdglue(self)
|
||||
Reference in New Issue
Block a user