Import LinuxCNC source tree
This commit is contained in:
1
tests/statbuffer-g5x-abort/.gitignore
vendored
Normal file
1
tests/statbuffer-g5x-abort/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/sim.var*
|
||||
16
tests/statbuffer-g5x-abort/README
Normal file
16
tests/statbuffer-g5x-abort/README
Normal file
@@ -0,0 +1,16 @@
|
||||
Interp runs ahead of motion. This test checks various state after
|
||||
aborting a program that switches coordinate systems within the program.
|
||||
|
||||
Interp's state must be synched from the status channel after an abort.
|
||||
If this breaks, MDI command motion, mode line settings and system
|
||||
parameters will follow interp's idea of state, which is probably that
|
||||
where the program had run to a queue buster or to exit, whichever
|
||||
comes first, whereas preview DROs and origin will match the status
|
||||
channel's idea of state, which is that of the running program just
|
||||
prior to the abort.
|
||||
|
||||
This test runs a program that starts in G55 and aborts during a slow
|
||||
move; were the program to continue, it would switch to G56 before
|
||||
hitting a queue buster. Before program run, coordinate systems are
|
||||
given distinct settings so that after aborting, status channel and
|
||||
interp offsets can be checked in various ways.
|
||||
2
tests/statbuffer-g5x-abort/checkresult
Executable file
2
tests/statbuffer-g5x-abort/checkresult
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exit 0 # test failure is indicated by test.sh exit value
|
||||
61
tests/statbuffer-g5x-abort/core_sim.hal
Normal file
61
tests/statbuffer-g5x-abort/core_sim.hal
Normal file
@@ -0,0 +1,61 @@
|
||||
# core HAL config file for simulation
|
||||
|
||||
# first load all the RT modules that will be needed
|
||||
# kinematics
|
||||
loadrt [KINS]KINEMATICS
|
||||
#autoconverted 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=[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
|
||||
|
||||
3
tests/statbuffer-g5x-abort/simpockets.tbl
Normal file
3
tests/statbuffer-g5x-abort/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 ;
|
||||
105
tests/statbuffer-g5x-abort/test-ui.py
Executable file
105
tests/statbuffer-g5x-abort/test-ui.py
Executable file
@@ -0,0 +1,105 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import linuxcnc
|
||||
import hal
|
||||
|
||||
import math
|
||||
import time
|
||||
import sys
|
||||
import subprocess
|
||||
import os
|
||||
import signal
|
||||
import glob
|
||||
import re
|
||||
|
||||
|
||||
retval = 0
|
||||
|
||||
|
||||
c = linuxcnc.command()
|
||||
s = linuxcnc.stat()
|
||||
e = linuxcnc.error_channel()
|
||||
|
||||
c.state(linuxcnc.STATE_ESTOP_RESET)
|
||||
c.state(linuxcnc.STATE_ON)
|
||||
|
||||
c.mode(linuxcnc.MODE_AUTO)
|
||||
c.program_open('test.ngc')
|
||||
|
||||
c.mode(linuxcnc.MODE_MDI)
|
||||
c.mdi('G10 L2 P1 X0 Y0 Z-4 (Set G54)')
|
||||
c.mdi('G10 L2 P2 X0 Y0 Z-5 (Set G55)')
|
||||
c.mdi('G10 L2 P3 X0 Y0 Z-6 (Set G56)')
|
||||
c.mdi('G54 (Use G54)')
|
||||
c.mdi('G0 X0 Y0 Z0 (Move to 0,0,0)')
|
||||
c.wait_complete()
|
||||
|
||||
# FIXME: this is lame
|
||||
time.sleep(1)
|
||||
|
||||
c.mode(linuxcnc.MODE_AUTO)
|
||||
c.auto(linuxcnc.AUTO_RUN, 0)
|
||||
|
||||
# FIXME: this is lame
|
||||
time.sleep(1)
|
||||
|
||||
c.abort()
|
||||
|
||||
c.wait_complete()
|
||||
s.poll()
|
||||
|
||||
# The program was aborted in g55; check
|
||||
if not 550 in s.gcodes:
|
||||
print("Current coordinate system is G%d, not G55" % \
|
||||
([i/10 for i in s.gcodes if i >= 540 and i < 600] + [None])[0])
|
||||
retval = 1
|
||||
else:
|
||||
print("Current coordinate system is G55")
|
||||
|
||||
# MDI G0 takes us to the programmed location in G54
|
||||
c.mode(linuxcnc.MODE_MDI)
|
||||
c.mdi('G0 X0 Y0 Z0 (Move to 0,0,0)')
|
||||
c.wait_complete()
|
||||
s.poll()
|
||||
|
||||
if math.fabs(s.position[0]) > 0.000001:
|
||||
print("'G0 X0 Y0 Z0' took us to X=%.6f, should be 0" % s.position[0])
|
||||
retval = 1
|
||||
|
||||
if math.fabs(s.position[1]) > 0.000001:
|
||||
print("'G0 X0 Y0 Z0' took us to Y=%.6f, should be 0" % s.position[1])
|
||||
retval = 1
|
||||
|
||||
if math.fabs(s.position[2] + 5) > 0.000001:
|
||||
print("'G0 X0 Y0 Z0' took us to Z=%.6f, should be -5" % s.position[2])
|
||||
retval = 1
|
||||
|
||||
c.mdi('(debug,G53+#5220 ?= G55; Z#5422 ?= Z0.0)')
|
||||
c.wait_complete()
|
||||
err = e.poll()
|
||||
print(err)
|
||||
|
||||
s.poll()
|
||||
if s.g5x_index != 2:
|
||||
print("status has wrong g5x index: %d (expected 2)" % s.g5x_index)
|
||||
retval = 1
|
||||
else:
|
||||
print("status has correct g5x index: 2")
|
||||
|
||||
if math.fabs(s.g5x_offset[0]) > 0.000001:
|
||||
print("g5x_offset.x is %.6f, should be 0" % s.g5x_offset[0])
|
||||
retval = 1
|
||||
|
||||
if math.fabs(s.g5x_offset[1]) > 0.000001:
|
||||
print("g5x_offset.y is %.6f, should be 0" % s.g5x_offset[1])
|
||||
retval = 1
|
||||
|
||||
if math.fabs(s.g5x_offset[2] + 5) > 0.000001:
|
||||
print("g5x_offset.z is %.6f, should be -5" % s.g5x_offset[2])
|
||||
retval = 1
|
||||
|
||||
if retval == 0:
|
||||
print("Everything ok!")
|
||||
|
||||
sys.exit(retval)
|
||||
|
||||
116
tests/statbuffer-g5x-abort/test.ini
Normal file
116
tests/statbuffer-g5x-abort/test.ini
Normal file
@@ -0,0 +1,116 @@
|
||||
# This config file was created 2016-06-17 10:27:05.976381 by the update_ini script
|
||||
# The original config files may be found in the /data/s/linuxcnc-dev/tests/statbuffer-g5x-abort/test.old directory
|
||||
|
||||
[EMC]
|
||||
# The version string for this INI file.
|
||||
VERSION = 1.1
|
||||
|
||||
DEBUG = 0x0
|
||||
|
||||
[DISPLAY]
|
||||
DISPLAY = ./test-ui.py
|
||||
|
||||
[FILTER]
|
||||
#No Content
|
||||
|
||||
[RS274NGC]
|
||||
PARAMETER_FILE = sim.var
|
||||
USER_M_PATH = ./subs
|
||||
|
||||
[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
|
||||
|
||||
[HALUI]
|
||||
#No Content
|
||||
|
||||
[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
|
||||
#This is a best-guess at the number of joints, it should be checked
|
||||
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
|
||||
16
tests/statbuffer-g5x-abort/test.ngc
Normal file
16
tests/statbuffer-g5x-abort/test.ngc
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
%
|
||||
; 1. Set G55 offset
|
||||
G55
|
||||
|
||||
; 2. Make some moves; execution should be aborted in this section
|
||||
G0 X0 Y0 Z0
|
||||
G1 X5 Y-5 F1
|
||||
|
||||
; 3. Interp will read ahead: set G56 offset and throw a queue buster;
|
||||
; execution will never reach this point
|
||||
G56
|
||||
M66 P0 L0 (queue buster)
|
||||
|
||||
%
|
||||
|
||||
4
tests/statbuffer-g5x-abort/test.sh
Executable file
4
tests/statbuffer-g5x-abort/test.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
linuxcnc -r test.ini
|
||||
|
||||
Reference in New Issue
Block a user