Import LinuxCNC source tree
This commit is contained in:
6
tests/interp/subroutine-return/.gitignore
vendored
Normal file
6
tests/interp/subroutine-return/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
moved-test.ngc
|
||||
sim.var
|
||||
sim.var.bak
|
||||
subs/sub.ngc
|
||||
emc_log
|
||||
test.ngc
|
||||
2
tests/interp/subroutine-return/checkresult
Executable file
2
tests/interp/subroutine-return/checkresult
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exit 0 # test failure is indicated by test.sh exit value
|
||||
104
tests/interp/subroutine-return/interp.ini
Normal file
104
tests/interp/subroutine-return/interp.ini
Normal file
@@ -0,0 +1,104 @@
|
||||
[EMC]
|
||||
DEBUG = 0xffffffff
|
||||
VERSION = 1.1
|
||||
|
||||
[DISPLAY]
|
||||
DISPLAY = ./test-ui.py
|
||||
|
||||
[TASK]
|
||||
TASK = milltask
|
||||
CYCLE_TIME = 0.001
|
||||
MDI_QUEUED_COMMANDS=10000
|
||||
|
||||
[RS274NGC]
|
||||
PARAMETER_FILE = sim.var
|
||||
SUBROUTINE_PATH = ./subs
|
||||
LOG_LEVEL = 999
|
||||
|
||||
[EMCMOT]
|
||||
EMCMOT = motmod
|
||||
COMM_TIMEOUT = 4.0
|
||||
BASE_PERIOD = 0
|
||||
SERVO_PERIOD = 1000000
|
||||
|
||||
[HAL]
|
||||
HALUI = halui
|
||||
HALFILE = LIB:core_sim.hal
|
||||
POSTGUI_HALFILE = postgui.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
|
||||
|
||||
[KINS]
|
||||
JOINTS = 3
|
||||
KINEMATICS = trivkins
|
||||
|
||||
[AXIS_X]
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 1000.0
|
||||
MIN_LIMIT = -40.0
|
||||
MAX_LIMIT = 40.0
|
||||
|
||||
[AXIS_Y]
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 1000.0
|
||||
MIN_LIMIT = -40.0
|
||||
MAX_LIMIT = 40.0
|
||||
|
||||
[AXIS_Z]
|
||||
MAX_VELOCITY = 4
|
||||
MAX_ACCELERATION = 1000.0
|
||||
MIN_LIMIT = -4.0
|
||||
MAX_LIMIT = 4.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
|
||||
|
||||
[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
|
||||
|
||||
[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 = -4.0
|
||||
MAX_LIMIT = 4.0
|
||||
FERROR = 0.050
|
||||
MIN_FERROR = 0.010
|
||||
|
||||
[EMCIO]
|
||||
TOOL_CHANGE_QUILL_UP = 1
|
||||
RANDOM_TOOLCHANGER = 0
|
||||
TOOL_TABLE = simpockets.tbl
|
||||
|
||||
5
tests/interp/subroutine-return/orig.ngc
Normal file
5
tests/interp/subroutine-return/orig.ngc
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
o<sub> call [1]
|
||||
o<sub> call [10]
|
||||
m2
|
||||
|
||||
3
tests/interp/subroutine-return/simpockets.tbl
Normal file
3
tests/interp/subroutine-return/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 ;
|
||||
10
tests/interp/subroutine-return/subs/orig-sub.ngc
Normal file
10
tests/interp/subroutine-return/subs/orig-sub.ngc
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
o<sub> sub
|
||||
g91
|
||||
g0 x0.001
|
||||
g4 p0.5
|
||||
t#1 m6
|
||||
o<sub> endsub
|
||||
|
||||
m2
|
||||
|
||||
74
tests/interp/subroutine-return/test-ui.py
Executable file
74
tests/interp/subroutine-return/test-ui.py
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import linuxcnc
|
||||
import linuxcnc_util
|
||||
import hal
|
||||
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
# this is how long we wait for linuxcnc to do our bidding
|
||||
timeout = 1.0
|
||||
|
||||
|
||||
#
|
||||
# set up pins
|
||||
# shell out to halcmd to net our pins to where they need to go
|
||||
#
|
||||
|
||||
h = hal.component("python-ui")
|
||||
h.ready()
|
||||
|
||||
|
||||
#
|
||||
# connect to LinuxCNC
|
||||
#
|
||||
|
||||
c = linuxcnc.command()
|
||||
s = linuxcnc.stat()
|
||||
e = linuxcnc.error_channel()
|
||||
|
||||
l = linuxcnc_util.LinuxCNC(command=c, status=s, error=e)
|
||||
|
||||
c.state(linuxcnc.STATE_ESTOP_RESET)
|
||||
c.state(linuxcnc.STATE_ON)
|
||||
c.home(0)
|
||||
c.home(1)
|
||||
c.home(2)
|
||||
l.wait_for_home([1, 1, 1, 0, 0, 0, 0, 0, 0])
|
||||
|
||||
c.mode(linuxcnc.MODE_AUTO)
|
||||
|
||||
c.program_open("test.ngc")
|
||||
c.auto(linuxcnc.AUTO_RUN, 1)
|
||||
|
||||
# wait for the interpreter to start running the test.ngc program
|
||||
start_time = time.time()
|
||||
while (time.time() - start_time) < 2.0:
|
||||
s.poll()
|
||||
if s.interp_state != linuxcnc.INTERP_IDLE:
|
||||
break
|
||||
time.sleep(0.001)
|
||||
|
||||
if s.interp_state == linuxcnc.INTERP_IDLE:
|
||||
print("failed to start interpreter, interp_state is {}".format(e.s.interp_state))
|
||||
sys.exit(1)
|
||||
|
||||
# tee hee!
|
||||
os.rename('test.ngc', 'moved-test.ngc')
|
||||
#os.rename('subs/sub.ngc', 'subs/moved-sub.ngc')
|
||||
|
||||
l.wait_for_interp_state(linuxcnc.INTERP_IDLE)
|
||||
|
||||
# ok fine, have it back
|
||||
os.rename('moved-test.ngc', 'test.ngc')
|
||||
#os.rename('subs/moved-sub.ngc', 'subs/sub.ngc')
|
||||
|
||||
|
||||
print("done! it all worked")
|
||||
|
||||
# if we get here it all worked!
|
||||
sys.exit(0)
|
||||
|
||||
6
tests/interp/subroutine-return/test.sh
Executable file
6
tests/interp/subroutine-return/test.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp -f orig.ngc test.ngc
|
||||
cp -f subs/orig-sub.ngc subs/sub.ngc
|
||||
|
||||
exec linuxcnc -r interp.ini
|
||||
Reference in New Issue
Block a user