From 5718f0bbf7bce5bbac9196f411027800fb8d6149 Mon Sep 17 00:00:00 2001 From: electrolab Date: Thu, 20 Oct 2022 17:37:04 +0200 Subject: [PATCH] Atv-vfd connections correcting threading adding relays for hydraulics and lubrication --- atv_vfd.hal | 13 +++++++++++-- lathemacros/threading.ngc | 16 ++++++++-------- maurice.hal | 5 ++++- mb2hal.ini | 3 ++- mesa.hal | 6 +++--- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/atv_vfd.hal b/atv_vfd.hal index d5bb925..b59554d 100644 --- a/atv_vfd.hal +++ b/atv_vfd.hal @@ -1,3 +1,12 @@ +loadrt mult2 names=ATV_coef + +addf ATV_coef servo-thread + +# ---magic constant to uncompensate slip--- + +net spindle-vel-cmd-rpm ATV_coef.in0 +setp ATV_coef.in1 0.97 + # ---setup spindle control signals--- net spindle-vel-cmd-rps spindle.0.speed-out-rps @@ -16,6 +25,6 @@ net spindle-index-enable spindle.0.index-enable net state-op atv_vfd.enable net MachineIsOn atv_vfd.machine-on -net spindle-vel-cmd-rpm atv_vfd.speed-command +net ATV_correct_speed ATV_coef.out atv_vfd.speed-command net spindle-enable atv_vfd.spindle-on -net Estop atv_vfd.is-estop \ No newline at end of file +net Estop atv_vfd.is-estop diff --git a/lathemacros/threading.ngc b/lathemacros/threading.ngc index f50e888..e38a10b 100644 --- a/lathemacros/threading.ngc +++ b/lathemacros/threading.ngc @@ -36,7 +36,7 @@ G4 P2 ; Wait to reach speed # = [0.86603 * #] # = [# * 0.125] # = [# * 0.250] -# = [# * 0.625] +# = [# -0.06] ;(DEBUG,# # # #) O200 if [#<_metric>] @@ -71,14 +71,14 @@ G95 F# ; Feed-Per-Rev Mode ; cut the major diameter (DEBUG,EXTERNAL Threading thread dia-# startZ-# finishZ-# Pitch-# Tool-# MF #) G0 Z # - G0 X # - G1 X [# - #] - G1 Z # - G0 X # + G0 X [# +1] + ;G1 X [# - #] + ;G1 Z # + ;G0 X # G0 Z # - G96 D1000 S# ; limit RPM in threading mode - G4 p2 - G76 P# Z# i[-#] j# k# H3 R1.5 Q29.5 E0 L0 + ;G96 D1000 S# ; limit RPM in threading mode + G97 S1000 + G76 P# Z# i-1 j# k# H2 R1.5 Q29.5 E0 L0 G0 X [# + 0.5] O300 endif ;(DEBUG,Test4) diff --git a/maurice.hal b/maurice.hal index aa2d811..22c44f9 100644 --- a/maurice.hal +++ b/maurice.hal @@ -13,6 +13,7 @@ loadrt weighted_sum wsum_sizes=4,4,2 loadrt conv_s32_float count=3 loadrt scale names=FeedScale,RapidScale,SpindleScale loadrt and2 names=EstopAnd +loadrt not names=EstopNot loadusr atv_vfd -r 38400 -p even @@ -26,6 +27,7 @@ addf FeedScale servo-thread addf RapidScale servo-thread addf SpindleScale servo-thread addf EstopAnd servo-thread +addf EstopNot servo-thread #loadusr halui -ini maurice.ini #loadusr io @@ -35,7 +37,8 @@ addf EstopAnd servo-thread net state-op => EstopAnd.in0 net STBEstop EstopAnd.in1 -net Estop-and-out EstopAnd.out iocontrol.0.emc-enable-in +net Estop-and-out EstopAnd.out iocontrol.0.emc-enable-in EstopNot.in +net Estop EstopNot.out #========================================== diff --git a/mb2hal.ini b/mb2hal.ini index 33d4d53..31caf77 100644 --- a/mb2hal.ini +++ b/mb2hal.ini @@ -206,7 +206,8 @@ HAL_MAP_PIN=ChuckOpen, 1, bit, 5 HAL_MAP_PIN=MachineReady, 2, bit, 0 HAL_MAP_PIN=ServoPower, 2, bit, 1 -#HAL_MAP_PIN=test2, 3, bit, 0 +HAL_MAP_PIN=HydraulicPump, 3, bit, 0 +HAL_MAP_PIN=LubricationPump, 3, bit, 0 MAX_UPDATE_RATE=0.0 DEBUG=1 diff --git a/mesa.hal b/mesa.hal index 186f8ef..653feb6 100644 --- a/mesa.hal +++ b/mesa.hal @@ -5,7 +5,7 @@ loadrt mux8 names=mpg loadrt abs count=1 loadrt near names=atspeed -addf hm2_5i24.0.read servo-thread +addf hm2_5i24.0.read servo-thread addf hm2_5i24.0.write servo-thread addf mpg servo-thread addf atspeed servo-thread @@ -40,7 +40,7 @@ addf abs.0 servo-thread #net spindle-vel-cmd-rpm hm2_5i24.0.pwmgen.00.value #net spindle-enable hm2_5i24.0.pwmgen.00.enable -setp hm2_5i24.0.encoder.00.scale 4096 +setp hm2_5i24.0.encoder.00.scale 4096 net spindle-revs hm2_5i24.0.encoder.00.position net spindle-vel-fb-rps hm2_5i24.0.encoder.00.velocity net spindle-vel-fb-rpm abs.0.in hm2_5i24.0.encoder.00.velocity-rpm @@ -73,4 +73,4 @@ net JogScale mpg.out setp hm2_5i24.0.encoder.01.scale 4 net JogCount hm2_5i24.0.encoder.01.count net JogScale joint.0.jog-scale joint.2.jog-scale -net JogCount joint.0.jog-counts joint.2.jog-counts \ No newline at end of file +net JogCount joint.0.jog-counts joint.2.jog-counts -- GitLab