Skip to content

Commit 60cab25

Browse files
committed
1) Added new switchable kinematics
2) TrivKins is back to original 3) Added parameters P and Q along with G12.1 4) Added wait for interp while G12 is executed
1 parent 71aca0e commit 60cab25

29 files changed

+819
-71
lines changed

configs/sim/axis/g12.halshow

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pin+joint.0.pos-cmd pin+joint.0.pos-fb pin+joint.1.pos-cmd pin+joint.1.pos-fb pin+joint.4.pos-cmd pin+joint.4.pos-fb pin+axis.x.pos-cmd pin+axis.y.pos-cmd pin+axis.c.pos-cmd pin+axis.z.pos-cmd pin+axis.a.pos-cmd pin+joint.2.pos-cmd pin+joint.2.pos-fb pin+joint.3.pos-cmd pin+joint.3.pos-fb
Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
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+
# Version of this INI file
9+
VERSION = 1.1
10+
11+
# Name of machine, for use with display, etc.
12+
MACHINE = LinuxCNC-HAL-SIM-AXIS
13+
14+
# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
15+
# DEBUG = 0x7FFFFFFF
16+
DEBUG = 0
17+
18+
# Sections for display options ------------------------------------------------
19+
[DISPLAY]
20+
21+
# Name of display program, e.g., axis
22+
DISPLAY = axis
23+
24+
# Cycle time, in seconds, that display will sleep between polls
25+
CYCLE_TIME = 0.100
26+
27+
# Path to help file
28+
HELP_FILE = doc/help.txt
29+
30+
# Initial display setting for position, RELATIVE or MACHINE
31+
POSITION_OFFSET = RELATIVE
32+
33+
# Initial display setting for position, COMMANDED or ACTUAL
34+
POSITION_FEEDBACK = ACTUAL
35+
36+
# Highest value that will be allowed for feed override, 1.0 = 100%
37+
MAX_FEED_OVERRIDE = 1.2
38+
MAX_SPINDLE_OVERRIDE = 1.0
39+
# Prefix to be used
40+
PROGRAM_PREFIX = ../../nc_files/
41+
42+
# Introductory graphic
43+
INTRO_GRAPHIC = linuxcnc.gif
44+
INTRO_TIME = 5
45+
46+
EDITOR = gedit
47+
48+
INCREMENTS = 1 mm, .01 in, .1mm, 1 mil, .1 mil, 1/8000 in
49+
[FILTER]
50+
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
51+
PROGRAM_EXTENSION = .py Python Script
52+
53+
png = image-to-gcode
54+
gif = image-to-gcode
55+
jpg = image-to-gcode
56+
py = python
57+
58+
# Task controller section -----------------------------------------------------
59+
[TASK]
60+
61+
# Name of task controller program, e.g., milltask
62+
TASK = milltask
63+
64+
# Cycle time, in seconds, that task controller will sleep between polls
65+
CYCLE_TIME = 0.001
66+
67+
# Part program interpreter section --------------------------------------------
68+
[RS274NGC]
69+
70+
# File containing interpreter variables
71+
PARAMETER_FILE = sim_mm.var
72+
73+
# Motion control section ------------------------------------------------------
74+
[EMCMOT]
75+
76+
EMCMOT = motmod
77+
78+
# Timeout for comm to emcmot, in seconds
79+
COMM_TIMEOUT = 1.0
80+
81+
# BASE_PERIOD is unused in this configuration but specified in core_sim.hal
82+
BASE_PERIOD = 0
83+
# Servo task period, in nano-seconds
84+
SERVO_PERIOD = 1000000
85+
86+
# section for main IO controller parameters -----------------------------------
87+
[EMCIO]
88+
89+
# Name of IO controller program, e.g., io
90+
EMCIO = io
91+
92+
# cycle time, in seconds
93+
CYCLE_TIME = 0.100
94+
95+
# tool table file
96+
TOOL_TABLE = sim_mm.tbl
97+
TOOL_CHANGE_POSITION = 0 0 50.8
98+
99+
# Hardware Abstraction Layer section --------------------------------------------------
100+
[HAL]
101+
102+
# The run script first uses halcmd to execute any HALFILE
103+
# files, and then to execute any individual HALCMD commands.
104+
#
105+
106+
# list of hal config files to run through halcmd
107+
# files are executed in the order in which they appear
108+
HALFILE = core_sim_5.hal
109+
HALFILE = sim_spindle_encoder.hal
110+
HALFILE = axis_manualtoolchange.hal
111+
HALFILE = simulated_home_5.hal
112+
113+
# list of halcmd commands to execute
114+
# commands are executed in the order in which they appear
115+
#HALCMD = save neta
116+
117+
# Single file that is executed after the GUI has started. Only supported by
118+
# AXIS at this time (only AXIS creates a HAL component of its own)
119+
#POSTGUI_HALFILE = test_postgui.hal
120+
121+
HALUI = halui
122+
123+
# Trajectory planner section --------------------------------------------------
124+
[TRAJ]
125+
COORDINATES = X Y Z A C
126+
LINEAR_UNITS = mm
127+
ANGULAR_UNITS = degree
128+
DEFAULT_LINEAR_VELOCITY = 30.48
129+
DEFAULT_ANGULAR_VELOCITY = 30.48
130+
MAX_LINEAR_VELOCITY = 53.34
131+
MAX_ANGULAR_VELOCITY = 53.34
132+
DEFAULT_LINEAR_ACCEL = 508
133+
DEFAULT_ANGULAR_ACCEL = 508
134+
MAX_LINEAR_ACCEL = 508
135+
MAX_ANGULAR_ACCEL = 508
136+
POSITION_FILE = position_mm.txt
137+
138+
[KINS]
139+
KINEMATICS = switchKins
140+
JOINTS = 5
141+
142+
# Axes sections ---------------
143+
[AXIS_X]
144+
MAX_VELOCITY = 30.48
145+
MAX_ACCELERATION = 508
146+
MIN_LIMIT = -254
147+
MAX_LIMIT = 254
148+
149+
[AXIS_Y]
150+
MAX_VELOCITY = 30.48
151+
MAX_ACCELERATION = 508
152+
MIN_LIMIT = -254
153+
MAX_LIMIT = 254
154+
155+
[AXIS_Z]
156+
MAX_VELOCITY = 30.48
157+
MAX_ACCELERATION = 508
158+
MIN_LIMIT = -50.8
159+
MAX_LIMIT = 101.6
160+
161+
[AXIS_A]
162+
MAX_VELOCITY = 30.48
163+
MAX_ACCELERATION = 508
164+
MIN_LIMIT = -50.8
165+
MAX_LIMIT = 101.6
166+
167+
[AXIS_C]
168+
MAX_VELOCITY = 30.48
169+
MAX_ACCELERATION = 508
170+
MIN_LIMIT = -50.8
171+
MAX_LIMIT = 101.6
172+
173+
[AXIS_B]
174+
MAX_VELOCITY = 30.48
175+
MAX_ACCELERATION = 508
176+
MIN_LIMIT = -50.8
177+
MAX_LIMIT = 101.6
178+
179+
# Joints sections -------------
180+
[JOINT_0]
181+
TYPE = LINEAR
182+
HOME = 0.000
183+
MAX_VELOCITY = 30.48
184+
MAX_ACCELERATION = 508
185+
BACKLASH = 0.000
186+
INPUT_SCALE = 157.48
187+
OUTPUT_SCALE = 1.000
188+
MIN_LIMIT = -254
189+
MAX_LIMIT = 254
190+
FERROR = 1.27
191+
MIN_FERROR = .254
192+
HOME_OFFSET = 0.0
193+
HOME_SEARCH_VEL = 127
194+
HOME_LATCH_VEL = 25.4
195+
HOME_USE_INDEX = NO
196+
HOME_IGNORE_LIMITS = NO
197+
HOME_SEQUENCE = 1
198+
HOME_IS_SHARED = 1
199+
200+
[JOINT_1]
201+
TYPE = LINEAR
202+
HOME = 0.000
203+
MAX_VELOCITY = 30.48
204+
MAX_ACCELERATION = 508
205+
BACKLASH = 0.000
206+
INPUT_SCALE = 157.48
207+
OUTPUT_SCALE = 1.000
208+
MIN_LIMIT = -254
209+
MAX_LIMIT = 254
210+
FERROR = 1.27
211+
MIN_FERROR = .254
212+
HOME_OFFSET = 0.0
213+
HOME_SEARCH_VEL = 127
214+
HOME_LATCH_VEL = 25.4
215+
HOME_USE_INDEX = NO
216+
HOME_IGNORE_LIMITS = NO
217+
HOME_SEQUENCE = 1
218+
219+
[JOINT_2]
220+
TYPE = LINEAR
221+
HOME = 0.0
222+
MAX_VELOCITY = 30.48
223+
MAX_ACCELERATION = 508
224+
BACKLASH = 0.000
225+
INPUT_SCALE = 157.48
226+
OUTPUT_SCALE = 1.000
227+
MIN_LIMIT = -50.8
228+
MAX_LIMIT = 101.6
229+
FERROR = 1.27
230+
MIN_FERROR = .254
231+
HOME_OFFSET = 25.4
232+
HOME_SEARCH_VEL = 127
233+
HOME_LATCH_VEL = 25.4
234+
HOME_USE_INDEX = NO
235+
HOME_IGNORE_LIMITS = NO
236+
HOME_SEQUENCE = 0
237+
HOME_IS_SHARED = 1
238+
239+
[JOINT_3]
240+
TYPE = ANGULAR
241+
MAX_VELOCITY = 60
242+
MAX_ACCELERATION = 508
243+
MIN_LIMIT = -120
244+
MAX_LIMIT = 120
245+
HOME_SEARCH_VEL = 0
246+
HOME_SEQUENCE = 2
247+
248+
[JOINT_4]
249+
TYPE = ANGULAR
250+
MAX_VELOCITY = 60
251+
MAX_ACCELERATION = 508
252+
MIN_LIMIT = -36000
253+
MAX_LIMIT = 36000
254+
HOME_SEARCH_VEL = 0
255+
HOME_SEQUENCE = 2
256+
257+
[JOINT_5]
258+
TYPE = ANGULAR
259+
MAX_VELOCITY = 60
260+
MAX_ACCELERATION = 508
261+
MIN_LIMIT = -36000
262+
MAX_LIMIT = 36000
263+
HOME_SEARCH_VEL = 0
264+
HOME_SEQUENCE = 2

lib/hallib/core_sim_5.hal

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# core HAL config file for simulation
2+
3+
# first load all the RT modules that will be needed
4+
# kinematics
5+
loadrt [KINS]KINEMATICS
6+
# motion controller, get name and thread periods from ini file
7+
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
8+
# load 6 differentiators (for velocity and accel signals
9+
loadrt ddt names=ddt_x,ddt_xv,ddt_y,ddt_yv,ddt_z,ddt_zv
10+
# load additional blocks
11+
loadrt hypot names=vel_xy,vel_xyz
12+
13+
# add motion controller functions to servo thread
14+
addf motion-command-handler servo-thread
15+
addf motion-controller servo-thread
16+
# link the differentiator functions into the code
17+
addf ddt_x servo-thread
18+
addf ddt_xv servo-thread
19+
addf ddt_y servo-thread
20+
addf ddt_yv servo-thread
21+
addf ddt_z servo-thread
22+
addf ddt_zv servo-thread
23+
addf vel_xy servo-thread
24+
addf vel_xyz servo-thread
25+
26+
# create HAL signals for position commands from motion module
27+
# loop position commands back to motion module feedback
28+
net Xpos joint.0.motor-pos-cmd => joint.0.motor-pos-fb ddt_x.in
29+
net Ypos joint.1.motor-pos-cmd => joint.1.motor-pos-fb ddt_y.in
30+
net Zpos joint.2.motor-pos-cmd => joint.2.motor-pos-fb ddt_z.in
31+
32+
net Apos joint.3.motor-pos-cmd => joint.3.motor-pos-fb
33+
net Cpos joint.4.motor-pos-cmd => joint.4.motor-pos-fb
34+
35+
# send the position commands thru differentiators to
36+
# generate velocity and accel signals
37+
net Xvel ddt_x.out => ddt_xv.in vel_xy.in0
38+
net Xacc <= ddt_xv.out
39+
net Yvel ddt_y.out => ddt_yv.in vel_xy.in1
40+
net Yacc <= ddt_yv.out
41+
net Zvel ddt_z.out => ddt_zv.in vel_xyz.in0
42+
net Zacc <= ddt_zv.out
43+
44+
# Cartesian 2- and 3-axis velocities
45+
net XYvel vel_xy.out => vel_xyz.in1
46+
net XYZvel <= vel_xyz.out
47+
48+
# estop loopback
49+
net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
50+
51+
# create signals for tool loading loopback
52+
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
53+
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed
54+

lib/hallib/simulated_home_5.hal

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
loadrt or2 names=or2_0
2+
loadrt comp names=comp_x,comp_y,comp_z,comp_a,comp_b
3+
4+
net Xhomeswpos => comp_x.in0
5+
net Yhomeswpos => comp_y.in0
6+
net Zhomeswpos => comp_z.in0
7+
net Ahomeswpos => comp_a.in0
8+
net Bhomeswpos => comp_b.in0
9+
10+
sets Xhomeswpos 1
11+
sets Yhomeswpos .5
12+
sets Zhomeswpos 2
13+
sets Ahomeswpos 2
14+
sets Bhomeswpos 2
15+
16+
net Xpos => comp_x.in1
17+
net Ypos => comp_y.in1
18+
net Zpos => comp_z.in1
19+
net Apos => comp_a.in1
20+
net Bpos => comp_b.in1
21+
22+
setp comp_x.hyst .02
23+
setp comp_y.hyst .02
24+
setp comp_z.hyst .02
25+
setp comp_a.hyst .02
26+
setp comp_b.hyst .02
27+
28+
net Xhomesw <= comp_x.out
29+
net Yhomesw <= comp_y.out => joint.1.home-sw-in
30+
net Zhomesw <= comp_z.out
31+
net Ahomesw <= comp_a.out => joint.3.home-sw-in
32+
net Bhomesw <= comp_b.out => joint.4.home-sw-in
33+
34+
net Xhomesw => or2_0.in0
35+
net Zhomesw => or2_0.in1
36+
net XZhomesw or2_0.out => joint.0.home-sw-in joint.2.home-sw-in
37+
38+
addf comp_x servo-thread
39+
addf comp_y servo-thread
40+
addf comp_z servo-thread
41+
addf comp_a servo-thread
42+
addf comp_b servo-thread
43+
44+
addf or2_0 servo-thread

0 commit comments

Comments
 (0)