Skip to content

Commit 784db03

Browse files
committed
External Offsets: Axis coordinate offset hal pins
rebased to master at: 0cab365 Thu Oct 18 22:56:02 2018 +0100 Note: eoffset_pid additions moved to a separate branch dgarr/eoffset_pid Docs: docs/src/motion/external-offsets.txt Hal pins (input interface is similar to wheel jogging pins): axis.L.eoffset-enable Input (bit): enable axis.L.eoffset-scale Input (float): scale factor axis.L.eoffset-counts Input (s32): request is accumulated counts*scale axis.L.eoffset-clear Input (bit): clear request axis.L.eoffset Output (float): current external offset axis.L.eoffset-request Output (float): requested external offset (debug pin) motion.eoffset-active Output (bit): non-zero external offsets applied motion.eoffset-limited Output (bit): limited by soft limit Hal components: eoffset_per_angle.comp Sim configs (configs/sim/axis/external_offsets/) eoffset_demo.ini (XYZ ext offsets) jwp_z.ini (jog-while-pause Z) dynamic_offsets.ini (dynamic Z) opa.ini (X ext offset per C angle) Notes: 1) see docs/src/motion/external_offsets.txt for usage restrictions man updated: motion.9 new manpage: offset_per_angle.9 (auto by halcompile) 2) In canon.hh, option: #undef STOP_ON_SYNCH_IF_EXTERNAL_OFFSETS #define STOP_ON_SYNCH_IF_EXTERNAL_OFFSETS forces a stop on any synch() if non-zero external offsets. 3) In command.c, using ALT_EOFFSET_BEHAVIOR for cont/incr jogs Squash notes: a) eliminate synch() restrictions Prior synch() restrictions are eliminated by changing the way that external offsets are removed from the current position information used by the interpreter. Stopping on synch() with external offset applied may be enabled at compile-time using an option defined in nml_intf/canon.cc: #define STOP_ON_SYNCH_IF_EXTERNAL_OFFSETS This option will be removed in the future. b) eoffset_per_angle.comp: support multiple instances
1 parent 0cab365 commit 784db03

56 files changed

Lines changed: 3262 additions & 104 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
halcmd setp axisui.notifications-clear-info 1
3+
sleep .1
4+
halcmd setp axisui.notifications-clear-info 0
5+
exit 0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eoffset_demo.ini ----- Basic demo (XYZ)
2+
jwp_z.ini ------------ Jog while paused (Z) demo
3+
dynamic_offsets.ini -- Z offset waveforms demo
4+
opa.ini -------------- Offset per Angle (XZC) demo
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
(info: Multiple circles at radius R, use 0 for current val)
2+
;Notes:
3+
; 1) z axis not altered (remains at current z)
4+
; 2) for inside polygon cutting (fnum==0):
5+
; start with rfraction negative
6+
; and gradually increase rfraction to zero as program runs
7+
; multiple circles
8+
; 3) for outside polygon cutting (fnum==1):
9+
; start with rfraction positive
10+
; and gradually decrease to zero as program runs multiple
11+
; circles
12+
;
13+
; Alternate method for polygons:
14+
; 1) use #<radius>=0 and jog to safe starting position
15+
; 2) use #<revs>=1, run progam for one revolution
16+
; 3) Run program repeatedly and manually jog x (radius)
17+
; before each program start to increase/decrease
18+
; current radius for inside/outside polygon respectively
19+
20+
o<circles> sub
21+
#<radius> = #1 (= 1 R 0==>current)
22+
#<aspeed> = #2 (= 8 aspeed: RPM)
23+
#<lspeed> = #3 (= 10 lspeed: units/sec)
24+
#<revs> = #4 (= 1 +/- Revolutions)
25+
26+
#<c> = #<_c> ;starting value
27+
#<ctarget> = [#<c> + #<revs> * 360]
28+
#<arate> = [#<aspeed> * 360]
29+
30+
m111 ;clear prior info messages
31+
o<if1> if [#<radius> EQ 0]
32+
#<ref_radius> = #<_x> ;use current x
33+
o<if1> else
34+
#<ref_radius> = #<radius>
35+
f#<lspeed> g1 x#<ref_radius>
36+
o<if1> endif
37+
(debug, ref_radius=#<ref_radius>)
38+
39+
m68 e0 q#<ref_radius> ; set ref_radius for eoffsets
40+
41+
f#<arate> g1 c#<ctarget> ; circles at arate
42+
43+
o<circles> endsub
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#<xmax> = 9
2+
#<ymax> = 4
3+
#<zmax> = 3
4+
#<rct> = 100
5+
#<feed> = 100
6+
7+
#<x1> = #<xmax>
8+
#<y1> = 0
9+
#<z1> = [#<zmax> * 0.5]
10+
11+
#<x2> = #<xmax>
12+
#<y2> = #<ymax>
13+
#<z2> = 0
14+
15+
#<x3> = 0
16+
#<y3> = #<ymax>
17+
#<z3> = #<zmax>
18+
19+
m111 ;clear notifications
20+
g61
21+
g0 x0 y0 z0
22+
23+
o<rpt> repeat [#<rct>]
24+
f #<feed>
25+
g0 x 0 y 0 z 0
26+
g1 x #<x1> y #<y1> z #<z1>
27+
g1 x #<x2> y #<y2> z #<z2>
28+
g1 x #<x3> y #<y3> z #<z3>
29+
g1 x 0 y 0 z 0
30+
o<rpt> endrepeat
31+
32+
m111 ;clear notifications
33+
m2
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
THREAD servo-thread
2+
MAXCHAN 8
3+
HMULT 4
4+
HZOOM 1
5+
HPOS 5.186916e-01
6+
CHAN 1
7+
SIG E:z-offset
8+
VSCALE -1
9+
VPOS 0.398564
10+
VOFF 0.000000e+00
11+
CHAN 2
12+
SIG G:waveform
13+
VSCALE -1
14+
VPOS 0.398564
15+
VOFF 0.000000e+00
16+
CHAN 4
17+
SIG G:reset
18+
VSCALE 2
19+
VPOS 0.961120
20+
VOFF 0.000000e+00
21+
CHAN 3
22+
PIN joint.2.motor-pos-cmd
23+
VSCALE 0
24+
VPOS 0.900000
25+
VOFF 0.000000e+00
26+
TMODE 0
27+
RMODE 0
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
[APPLICATIONS]
2+
# delay because some items are done in postgui
3+
DELAY = 5
4+
APP = halscope -i dynamic_offsets.halscope
5+
6+
[HAL]
7+
HALUI = halui
8+
HALFILE = LIB:basic_sim.tcl
9+
POSTGUI_HALFILE = dynamic_offsets_panel.hal
10+
11+
[EMC]
12+
MACHINE = Dynamic External Offsets
13+
VERSION = 1.1
14+
15+
[DISPLAY]
16+
PYVCP = dynamic_offsets_panel.xml
17+
DISPLAY = axis
18+
POSITION_OFFSET = RELATIVE
19+
POSITION_FEEDBACK = ACTUAL
20+
MAX_LINEAR_VELOCITY = 2
21+
OPEN_FILE = ./dyn_demo.ngc
22+
23+
[TASK]
24+
TASK = milltask
25+
CYCLE_TIME = 0.001
26+
27+
[RS274NGC]
28+
USER_M_PATH = .
29+
PARAMETER_FILE = sim.var
30+
31+
[EMCIO]
32+
EMCIO = io
33+
CYCLE_TIME = 0.100
34+
35+
[EMCMOT]
36+
EMCMOT = motmod
37+
SERVO_PERIOD = 1000000
38+
39+
[TRAJ]
40+
COORDINATES = XYZ
41+
LINEAR_UNITS = inch
42+
ANGULAR_UNITS = degree
43+
44+
[KINS]
45+
JOINTS = 3
46+
KINEMATICS = trivkins coordinates=XYZ
47+
48+
[AXIS_X]
49+
MAX_VELOCITY = 2
50+
MAX_ACCELERATION = 20
51+
MIN_LIMIT = -1
52+
MAX_LIMIT = 10
53+
54+
[AXIS_Y]
55+
MAX_VELOCITY = 2
56+
MAX_ACCELERATION = 20
57+
MIN_LIMIT = -1
58+
MAX_LIMIT = 10
59+
60+
[AXIS_Z]
61+
# Note:give half to external_offsets:
62+
OFFSET_AV_RATIO = 0.5
63+
64+
# Note: modified in pyvcp panel:
65+
MAX_VELOCITY = 2
66+
MAX_ACCELERATION = 50
67+
68+
MIN_LIMIT = -5
69+
MAX_LIMIT = 5
70+
71+
[JOINT_0]
72+
TYPE = LINEAR
73+
HOME_SEQUENCE = 0
74+
MAX_VELOCITY = 2
75+
MAX_ACCELERATION = 20
76+
77+
[JOINT_1]
78+
TYPE = LINEAR
79+
HOME_SEQUENCE = 0
80+
MAX_VELOCITY = 2
81+
MAX_ACCELERATION = 20
82+
83+
[JOINT_2]
84+
TYPE = LINEAR
85+
HOME_SEQUENCE = 0
86+
MAX_VELOCITY = 2
87+
MAX_ACCELERATION = 50
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
dynamic_offsets
2+
3+
A sinewave is applied to the Z coordinate external offset
4+
5+
The waveform amplitdude and frequency are set by pyvcp panel spinboxes.
6+
7+
The Z coordinate max acceleration and max velocity settings (from the ini file) can be modified with pyvcp panel spinboxes.
8+
9+
Usage:
10+
1) Estop OFF (F1)
11+
2) Machine ON (F2)
12+
3) HOME All (Ctrl-Home)
13+
4) A halscope application is started to
14+
show the offset waveforms and the
15+
z coordinate response
16+
5) Enable the dynamic offset waveform
17+
with the panel 'Z enable' checkbox
18+
5) Use the panel to adjust:
19+
Waveform: amplitude, frequency
20+
Z Coordinate: max accel, max vel
21+
22+
Notes:
23+
The dynamic waveform is applied with and without
24+
running a program.
25+
26+
MDI cannot be started with non-zero external
27+
offsets -- disable the Z offsets and toggle
28+
the machine On/Off to zero offsets.
29+
30+
Changes to the Z max accel, max vel are not
31+
made while a program or mdi move is in progress.
32+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
loadrt siggen names=gen
2+
loadrt scale names=scalea
3+
loadrt conv_float_s32 names=cvt
4+
loadrt not names=nota
5+
loadrt or2 names=or2a
6+
7+
addf gen.update servo-thread
8+
addf scalea servo-thread
9+
addf cvt servo-thread
10+
addf nota servo-thread
11+
addf or2a servo-thread
12+
13+
setp gen.offset 0.0
14+
15+
# scaling -----------------------------------------------------------
16+
# these should be reciprocals:
17+
# 1 unit (inch) --> 10000 counts
18+
setp axis.z.eoffset-scale 0.0001
19+
setp scalea.gain 10000
20+
21+
net E:amplitude <= pyvcp.gen-amplitude => gen.amplitude
22+
net E:frequency <= pyvcp.gen-frequency => gen.frequency
23+
24+
# can also use sawtooth (others inappropriate on a reset)
25+
net G:waveform <= gen.sine => scalea.in
26+
net G:swaveform <= scalea.out => cvt.in
27+
net G:counts <= cvt.out => axis.z.eoffset-counts
28+
29+
net E:enable <= pyvcp.z-enable => axis.z.eoffset-enable
30+
net E:enable => nota.in
31+
32+
net E:disable <= nota.out => or2a.in1
33+
34+
net E:z-offset <= axis.z.eoffset => pyvcp.z-offset-f
35+
36+
net E:limited <= motion.eoffset-limited => pyvcp.eoffset-limited
37+
38+
net E:active <= motion.eoffset-active => pyvcp.eoffset-active
39+
40+
net E:reset <= pyvcp.reset => or2a.in0
41+
42+
net E:ini-accel <= pyvcp.ini-accel => ini.z.max_acceleration
43+
net E:ini-vel <= pyvcp.ini-vel => ini.z.max_velocity
44+
45+
net G:reset <= or2a.out => axis.z.eoffset-clear
46+
net G:reset => gen.reset

0 commit comments

Comments
 (0)