Skip to content

Commit a8605b7

Browse files
committed
Add sim config for shared home switches
1 parent e835404 commit a8605b7

File tree

4 files changed

+238
-0
lines changed

4 files changed

+238
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This config simulates shared homing switch on joint_0 (X-Axis) and joint_2 (Z-Axis).
2+
3+
Note that the shared home switch signal (ie 'joint.0.home-sw-in', 'joint.2.home-sw-in') needs to be low in order to rehome the machine.
4+
5+
Also note that 'simulate_home_is_shared.hal' is only used to simulate the homing process and should not be used for a real machine.
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
[APPLICATIONS]
2+
APP = halshow ./simulate_home_is_shared.halshow
3+
4+
# General section -------------------------------------------------------------
5+
[EMC]
6+
7+
# Version of this INI file
8+
VERSION = 1.1
9+
10+
# Name of machine, for use with display, etc.
11+
MACHINE = LinuxCNC-HAL-SIM-AXIS
12+
13+
# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
14+
#DEBUG = 0x7FFFFFFF
15+
DEBUG = 0
16+
17+
# Sections for display options ------------------------------------------------
18+
[DISPLAY]
19+
20+
# Name of display program, e.g., axis
21+
DISPLAY = axis
22+
23+
# Cycle time, in seconds, that display will sleep between polls
24+
CYCLE_TIME = 0.100
25+
26+
# Path to help file
27+
HELP_FILE = doc/help.txt
28+
29+
# Initial display setting for position, RELATIVE or MACHINE
30+
POSITION_OFFSET = RELATIVE
31+
32+
# Initial display setting for position, COMMANDED or ACTUAL
33+
POSITION_FEEDBACK = ACTUAL
34+
35+
# Highest value that will be allowed for feed override, 1.0 = 100%
36+
MAX_FEED_OVERRIDE = 1.2
37+
MAX_SPINDLE_OVERRIDE = 1.0
38+
39+
MAX_LINEAR_VELOCITY = 5
40+
DEFAULT_LINEAR_VELOCITY = .25
41+
DEFAULT_SPINDLE_SPEED = 200
42+
# Prefix to be used
43+
PROGRAM_PREFIX = ../../nc_files/
44+
45+
# Introductory graphic
46+
INTRO_GRAPHIC = linuxcnc.gif
47+
INTRO_TIME = 5
48+
49+
#EDITOR = geany
50+
TOOL_EDITOR = tooledit
51+
52+
INCREMENTS = 1 in, 0.1 in, 10 mil, 1 mil, 1mm, .1mm, 1/8000 in
53+
54+
[FILTER]
55+
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
56+
PROGRAM_EXTENSION = .py Python Script
57+
58+
png = image-to-gcode
59+
gif = image-to-gcode
60+
jpg = image-to-gcode
61+
py = python3
62+
63+
# Task controller section -----------------------------------------------------
64+
[TASK]
65+
66+
# Name of task controller program, e.g., milltask
67+
TASK = milltask
68+
69+
# Cycle time, in seconds, that task controller will sleep between polls
70+
CYCLE_TIME = 0.001
71+
72+
# Part program interpreter section --------------------------------------------
73+
[RS274NGC]
74+
75+
# File containing interpreter variables
76+
PARAMETER_FILE = sim.var
77+
78+
# Motion control section ------------------------------------------------------
79+
[EMCMOT]
80+
81+
EMCMOT = motmod
82+
83+
# Timeout for comm to emcmot, in seconds
84+
COMM_TIMEOUT = 1.0
85+
86+
# BASE_PERIOD is unused in this configuration but specified in core_sim.hal
87+
BASE_PERIOD = 0
88+
# Servo task period, in nano-seconds
89+
SERVO_PERIOD = 1000000
90+
91+
# section for main IO controller parameters -----------------------------------
92+
[EMCIO]
93+
# tool table file
94+
TOOL_TABLE = ../sim.tbl
95+
TOOL_CHANGE_POSITION = 0 0 0
96+
TOOL_CHANGE_QUILL_UP = 1
97+
98+
# Hardware Abstraction Layer section --------------------------------------------------
99+
[HAL]
100+
HALFILE = core_sim.hal
101+
HALFILE = simulated_home_is_shared.hal
102+
HALUI = halui
103+
104+
# Trajectory planner section --------------------------------------------------
105+
[TRAJ]
106+
COORDINATES = X Y Z
107+
LINEAR_UNITS = inch
108+
ANGULAR_UNITS = degree
109+
MAX_LINEAR_VELOCITY = 4
110+
DEFAULT_LINEAR_ACCELERATION = 100
111+
MAX_LINEAR_ACCELERATION = 100
112+
POSITION_FILE = position.txt
113+
114+
[KINS]
115+
KINEMATICS = trivkins
116+
JOINTS = 3
117+
118+
# Axes sections ---------------
119+
[AXIS_X]
120+
MAX_VELOCITY = 4
121+
MAX_ACCELERATION = 100.0
122+
MIN_LIMIT = -10.0
123+
MAX_LIMIT = 10.0
124+
125+
[AXIS_Y]
126+
MAX_VELOCITY = 4
127+
MAX_ACCELERATION = 100.0
128+
MIN_LIMIT = -10.0
129+
MAX_LIMIT = 10.0
130+
131+
[AXIS_Z]
132+
MAX_VELOCITY = 4
133+
MAX_ACCELERATION = 100.0
134+
MIN_LIMIT = -8.0
135+
MAX_LIMIT = 0.12
136+
137+
# Joints sections -------------
138+
[JOINT_0]
139+
TYPE = LINEAR
140+
HOME = 0.000
141+
MAX_VELOCITY = 5
142+
MAX_ACCELERATION = 50.0
143+
BACKLASH = 0.000
144+
INPUT_SCALE = 4000
145+
OUTPUT_SCALE = 1.000
146+
FERROR = 0.050
147+
MIN_FERROR = 0.010
148+
MIN_LIMIT = -10.0
149+
MAX_LIMIT = 10.0
150+
HOME_OFFSET = 0.0
151+
HOME_SEARCH_VEL = 20.0
152+
HOME_LATCH_VEL = 20.0
153+
HOME_USE_INDEX = NO
154+
HOME_IGNORE_LIMITS = NO
155+
HOME_SEQUENCE = 1
156+
HOME_IS_SHARED = 1
157+
158+
[JOINT_1]
159+
TYPE = LINEAR
160+
HOME = 0.000
161+
MAX_VELOCITY = 5
162+
MAX_ACCELERATION = 50.0
163+
BACKLASH = 0.000
164+
INPUT_SCALE = 4000
165+
OUTPUT_SCALE = 1.000
166+
FERROR = 0.050
167+
MIN_FERROR = 0.010
168+
MIN_LIMIT = -10.0
169+
MAX_LIMIT = 10.0
170+
HOME_OFFSET = 0.0
171+
HOME_SEARCH_VEL = 20.0
172+
HOME_LATCH_VEL = 20.0
173+
HOME_USE_INDEX = NO
174+
HOME_IGNORE_LIMITS = NO
175+
HOME_SEQUENCE = 1
176+
177+
[JOINT_2]
178+
TYPE = LINEAR
179+
HOME = 0.0
180+
MAX_VELOCITY = 5
181+
MAX_ACCELERATION = 50.0
182+
BACKLASH = 0.000
183+
INPUT_SCALE = 4000
184+
OUTPUT_SCALE = 1.000
185+
MIN_LIMIT = -8.0
186+
MAX_LIMIT = 0.12
187+
FERROR = 0.050
188+
MIN_FERROR = 0.010
189+
HOME_OFFSET = 1.0
190+
HOME_SEARCH_VEL = 20.0
191+
HOME_LATCH_VEL = 20.0
192+
HOME_USE_INDEX = NO
193+
HOME_IGNORE_LIMITS = NO
194+
HOME_SEQUENCE = 0
195+
HOME_IS_SHARED = 1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pin+joint.0.home-sw-in pin+joint.1.home-sw-in pin+joint.2.home-sw-in
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This hal file simulates shared home switches
2+
loadrt or2 names=or2_0
3+
loadrt comp names=comp_x,comp_y,comp_z
4+
5+
# set fixed value for position of virtual switches (use 'in0' for positive and 'in1' for negative values)
6+
net Xhomeswpos => comp_x.in0
7+
net Yhomeswpos => comp_y.in0
8+
net Zhomeswpos => comp_z.in0
9+
10+
sets Xhomeswpos 1
11+
sets Yhomeswpos .5
12+
sets Zhomeswpos 2
13+
14+
# link current position if simulated machine to the other input of the comp functions
15+
net Xpos => comp_x.in1
16+
net Ypos => comp_y.in1
17+
net Zpos => comp_z.in1
18+
19+
# set hysteresis of virtual home switches
20+
setp comp_x.hyst .02
21+
setp comp_y.hyst .02
22+
setp comp_z.hyst .02
23+
24+
net Xhomesw <= comp_x.out
25+
net Yhomesw <= comp_y.out => joint.1.home-sw-in
26+
net Zhomesw <= comp_z.out
27+
28+
addf comp_x servo-thread
29+
addf comp_y servo-thread
30+
addf comp_z servo-thread
31+
32+
# this section is only for shared home switch signals on multiple axes
33+
net Xhomesw => or2_0.in0
34+
net Zhomesw => or2_0.in1
35+
net XZhomesw or2_0.out => joint.0.home-sw-in joint.2.home-sw-in
36+
37+
addf or2_0 servo-thread

0 commit comments

Comments
 (0)