Skip to content

Commit 842feee

Browse files
committed
axis sinm -add a sim test for halui messages
1 parent d5a83aa commit 842feee

4 files changed

Lines changed: 680 additions & 0 deletions

File tree

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
# EMC controller parameters for a simulated machine.
2+
3+
# General note: Comments can either be preceded with a # or ; - either is
4+
# acceptable, although # is in keeping with most linux config files.
5+
6+
# General section -------------------------------------------------------------
7+
[EMC]
8+
9+
# Version of this INI file
10+
VERSION = 1.1
11+
12+
# Name of machine, for use with display, etc.
13+
MACHINE = LinuxCNC-HAL-SIM-AXIS
14+
15+
# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
16+
#DEBUG = 0x7FFFFFFF
17+
DEBUG = 0
18+
19+
# Sections for display options ------------------------------------------------
20+
[DISPLAY]
21+
22+
# Name of display program, e.g., axis
23+
DISPLAY = axis
24+
25+
# Cycle time, in seconds, that display will sleep between polls
26+
CYCLE_TIME = 0.100
27+
28+
# Path to help file
29+
HELP_FILE = doc/help.txt
30+
31+
# Initial display setting for position, RELATIVE or MACHINE
32+
POSITION_OFFSET = RELATIVE
33+
34+
# Initial display setting for position, COMMANDED or ACTUAL
35+
POSITION_FEEDBACK = ACTUAL
36+
37+
# Highest value that will be allowed for feed override, 1.0 = 100%
38+
MAX_FEED_OVERRIDE = 1.2
39+
MAX_SPINDLE_OVERRIDE = 1.0
40+
41+
MAX_LINEAR_VELOCITY = 5
42+
DEFAULT_LINEAR_VELOCITY = .25
43+
DEFAULT_SPINDLE_SPEED = 200
44+
# Prefix to be used
45+
PROGRAM_PREFIX = ../../nc_files/
46+
47+
# Introductory graphic
48+
INTRO_GRAPHIC = linuxcnc.gif
49+
INTRO_TIME = 5
50+
51+
#EDITOR = geany
52+
TOOL_EDITOR = tooledit
53+
54+
INCREMENTS = 1 in, 0.1 in, 10 mil, 1 mil, 1mm, .1mm, 1/8000 in
55+
56+
USER_COMMAND_FILE=gstatmessages.py
57+
58+
[FILTER]
59+
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
60+
PROGRAM_EXTENSION = .py Python Script
61+
62+
png = image-to-gcode
63+
gif = image-to-gcode
64+
jpg = image-to-gcode
65+
py = python3
66+
67+
# Task controller section -----------------------------------------------------
68+
[TASK]
69+
70+
# Name of task controller program, e.g., milltask
71+
TASK = milltask
72+
73+
# Cycle time, in seconds, that task controller will sleep between polls
74+
CYCLE_TIME = 0.001
75+
76+
# Part program interpreter section --------------------------------------------
77+
[RS274NGC]
78+
79+
# File containing interpreter variables
80+
PARAMETER_FILE = sim.var
81+
82+
# Motion control section ------------------------------------------------------
83+
[EMCMOT]
84+
85+
EMCMOT = motmod
86+
87+
# Timeout for comm to emcmot, in seconds
88+
COMM_TIMEOUT = 1.0
89+
90+
# BASE_PERIOD is unused in this configuration but specified in core_sim.hal
91+
BASE_PERIOD = 0
92+
# Servo task period, in nano-seconds
93+
SERVO_PERIOD = 1000000
94+
95+
# section for main IO controller parameters -----------------------------------
96+
[EMCIO]
97+
# tool table file
98+
TOOL_TABLE = sim.tbl
99+
TOOL_CHANGE_POSITION = 0 0 0
100+
TOOL_CHANGE_QUILL_UP = 1
101+
102+
# Hardware Abstraction Layer section --------------------------------------------------
103+
[HAL]
104+
105+
# The run script first uses halcmd to execute any HALFILE
106+
# files, and then to execute any individual HALCMD commands.
107+
#
108+
109+
# list of hal config files to run through halcmd
110+
# files are executed in the order in which they appear
111+
HALFILE = core_sim.hal
112+
HALFILE = sim_spindle_encoder.hal
113+
HALFILE = axis_manualtoolchange.hal
114+
HALFILE = simulated_home.hal
115+
HALFILE = check_xyz_constraints.hal
116+
HALFILE = cooling.hal
117+
118+
# list of halcmd commands to execute
119+
# commands are executed in the order in which they appear
120+
#HALCMD = save neta
121+
122+
# Single file that is executed after the GUI has started. Only supported by
123+
# AXIS at this time (only AXIS creates a HAL component of its own)
124+
#POSTGUI_HALFILE = test_postgui.hal
125+
POSTGUI_HALCMD = loadusr qtvcp -a -H panel.hal panel
126+
127+
HALUI = halui
128+
129+
# Trajectory planner section --------------------------------------------------
130+
[TRAJ]
131+
COORDINATES = X Y Z
132+
LINEAR_UNITS = inch
133+
ANGULAR_UNITS = degree
134+
MAX_LINEAR_VELOCITY = 4
135+
DEFAULT_LINEAR_ACCELERATION = 100
136+
MAX_LINEAR_ACCELERATION = 100
137+
POSITION_FILE = position.txt
138+
139+
[KINS]
140+
KINEMATICS = trivkins
141+
JOINTS = 3
142+
143+
# Axes sections ---------------
144+
[AXIS_X]
145+
MAX_VELOCITY = 4
146+
MAX_ACCELERATION = 100.0
147+
MIN_LIMIT = -10.0
148+
MAX_LIMIT = 10.0
149+
150+
[AXIS_Y]
151+
MAX_VELOCITY = 4
152+
MAX_ACCELERATION = 100.0
153+
MIN_LIMIT = -10.0
154+
MAX_LIMIT = 10.0
155+
156+
[AXIS_Z]
157+
MAX_VELOCITY = 4
158+
MAX_ACCELERATION = 100.0
159+
MIN_LIMIT = -8.0
160+
MAX_LIMIT = 0.12
161+
162+
# Joints sections -------------
163+
[JOINT_0]
164+
TYPE = LINEAR
165+
HOME = 0.000
166+
MAX_VELOCITY = 5
167+
MAX_ACCELERATION = 50.0
168+
BACKLASH = 0.000
169+
INPUT_SCALE = 4000
170+
OUTPUT_SCALE = 1.000
171+
FERROR = 0.050
172+
MIN_FERROR = 0.010
173+
MIN_LIMIT = -10.0
174+
MAX_LIMIT = 10.0
175+
HOME_OFFSET = 0.0
176+
HOME_SEARCH_VEL = 20.0
177+
HOME_LATCH_VEL = 20.0
178+
HOME_USE_INDEX = NO
179+
HOME_IGNORE_LIMITS = NO
180+
HOME_SEQUENCE = 1
181+
HOME_IS_SHARED = 1
182+
183+
[JOINT_1]
184+
TYPE = LINEAR
185+
HOME = 0.000
186+
MAX_VELOCITY = 5
187+
MAX_ACCELERATION = 50.0
188+
BACKLASH = 0.000
189+
INPUT_SCALE = 4000
190+
OUTPUT_SCALE = 1.000
191+
FERROR = 0.050
192+
MIN_FERROR = 0.010
193+
MIN_LIMIT = -10.0
194+
MAX_LIMIT = 10.0
195+
HOME_OFFSET = 0.0
196+
HOME_SEARCH_VEL = 20.0
197+
HOME_LATCH_VEL = 20.0
198+
HOME_USE_INDEX = NO
199+
HOME_IGNORE_LIMITS = NO
200+
HOME_SEQUENCE = 1
201+
202+
[JOINT_2]
203+
TYPE = LINEAR
204+
HOME = 0.0
205+
MAX_VELOCITY = 5
206+
MAX_ACCELERATION = 50.0
207+
BACKLASH = 0.000
208+
INPUT_SCALE = 4000
209+
OUTPUT_SCALE = 1.000
210+
MIN_LIMIT = -8.0
211+
212+
# Normally the Z max should be 0.000!
213+
# The only reason it's greater than 0 here is so that the splash screen
214+
# gcode will run.
215+
MAX_LIMIT = 0.12
216+
217+
FERROR = 0.050
218+
MIN_FERROR = 0.010
219+
HOME_OFFSET = 1.0
220+
HOME_SEARCH_VEL = 20.0
221+
HOME_LATCH_VEL = 20.0
222+
HOME_USE_INDEX = NO
223+
HOME_IGNORE_LIMITS = NO
224+
HOME_SEQUENCE = 0
225+
HOME_IS_SHARED = 1

configs/sim/axis/gstatmessages.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
2+
from hal_glib import GStat
3+
GSTAT = GStat()
4+
GSTAT.forced_update()
5+
GSTAT.connect('jograte-changed', lambda w, data: vars.jog_speed.set(data))
6+
GSTAT.connect('axis-selection-changed', lambda w,data: select_axis(data))
7+
GSTAT.connect('cycle-start-request', lambda w, state : cycle_start_request(state))
8+
GSTAT.connect('cycle-pause-request', lambda w, state: pause_request(state))
9+
GSTAT.connect('ok-request', lambda w, state: dialog_ext_control(w,1,1))
10+
GSTAT.connect('cancel-request', lambda w, state: dialog_ext_control(w,1,0))
11+
GSTAT.connect('macro-call-request', lambda w, name: request_macro_call(name))
12+
def user_live_update():
13+
GSTAT.run_iteration()
14+
15+
def select_axis(data):
16+
if data is None: return
17+
widget = getattr(widgets, "axis_%s" % data.lower())
18+
widget.focus()
19+
widget.invoke()
20+
21+
def cycle_start_request(state):
22+
print('cycle start',state)
23+
commands.task_run(None)
24+
25+
def pause_request(state):
26+
print('cycle pause',state)
27+
commands.task_pauseresume(None)
28+
29+
def dialog_ext_control(widget,t,state):
30+
print('dialog control',widget,state)
31+
32+
flag = False
33+
for child in root_window.winfo_children():
34+
#print(child)
35+
if isinstance(child, Tkinter.Toplevel):
36+
#print(f"Found a Toplevel window: {child}")
37+
if '.!toplevel' in str(child):
38+
#print('sending command:',child)
39+
for child2 in child.winfo_children():
40+
#print(child2)
41+
if isinstance(child2, Tkinter.Frame):
42+
for child3 in child2.winfo_children():
43+
#print(child3)
44+
if isinstance(child3, Tkinter.Button):
45+
#print(dir(child3))
46+
txt = child3.cget("text")
47+
if txt.lower() == 'ok' and state:
48+
#print('Ok')
49+
child3.invoke()
50+
flag = True
51+
break
52+
elif txt.lower() == 'cancel' and not state:
53+
#print('Cancel')
54+
child3.invoke()
55+
flag = True
56+
break
57+
if flag: break
58+
if flag: break
59+
else:
60+
#print('No window')
61+
# remove one error message
62+
if state == 0:
63+
notifications.clear_one()
64+
65+
def request_macro_call(name):
66+
print('request macro:',name)

configs/sim/axis/panel.hal

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
net rate halui.axis.jog-speed panel.jog-rate
2+
3+
net sx halui.axis.x.select panel.axis-x
4+
net sy halui.axis.y.select panel.axis-y
5+
net sz halui.axis.z.select panel.axis-z
6+
7+
net jog-p halui.axis.selected.plus panel.jog-pos
8+
net jog-m halui.axis.selected.minus panel.jog-neg
9+
10+
#net m0 halui.gui.mdi-command-MACRO0 panel.mdi-0
11+
#net m1 halui.gui.mdi-command-MACRO1 panel.mdi-1
12+
#net m2 halui.gui.mdi-command-0 panel.mdi-2
13+
14+
net man panel.manual-mode halui.mode.manual
15+
net mdi panel.mdi-mode halui.mode.mdi
16+
net auto panel.auto-mode halui.mode.auto
17+
18+
net pause halui.cycle.start panel.cycle-start
19+
net start halui.cycle.pause panel.cycle-pause
20+
net abort halui.abort panel.cycle-abort
21+
22+
net cancel halui.gui.cancel panel.cancel
23+
net ok halui.gui.ok panel.ok
24+

0 commit comments

Comments
 (0)