Can't get lathe to Feed
25 Apr 2021 12:49 #207004
by rider-83
Can't get lathe to Feed was created by rider-83
Please have a look at the sample Lathe program below. Can anyone tell me why it can't get the machine to feed in G01?
The spindle starts, and the axis move to position in rapid (G0), but then it just sits there and waits!
I think maybe its something to do with G17 and G18.
G18 is in the header of the program, but it swaps back to G17 after I press Start.
If I type G18 in MDI it changes as required. But as soon as I press Cycle Start in Auto, we are back to G17 !
Help. This is very silly & frustrating.
G0 G7 G18 G21 G40 G49 G54 G64 G90 G91.1 G95 G97 G99
G97S2500M4
G0X30.Z0.
G1X0.F500
G0Z2.
X26.
G0X12.
G1Z0.
X14.
G3X24.Z-5.R5.
G1Z-15.
G0X30.
X40.Z40.
M30
The spindle starts, and the axis move to position in rapid (G0), but then it just sits there and waits!
I think maybe its something to do with G17 and G18.
G18 is in the header of the program, but it swaps back to G17 after I press Start.
If I type G18 in MDI it changes as required. But as soon as I press Cycle Start in Auto, we are back to G17 !
Help. This is very silly & frustrating.
G0 G7 G18 G21 G40 G49 G54 G64 G90 G91.1 G95 G97 G99
G97S2500M4
G0X30.Z0.
G1X0.F500
G0Z2.
X26.
G0X12.
G1Z0.
X14.
G3X24.Z-5.R5.
G1Z-15.
G0X30.
X40.Z40.
M30
Please Log in or Create an account to join the conversation.
25 Apr 2021 13:07 #207005
by PCW
Replied by PCW on topic Can't get lathe to Feed
Usually this means that spindle-at -speed is not true, from the motion manual page:
spindle.M.at-speed IN BIT
Motion will pause until this pin is TRUE, under the following conditions: before the first
feed move after each spindle start or speed change; before the start of every chain of spin‐
dle-synchronized moves; and if in CSS mode, at every rapid->feed transition.
spindle.M.at-speed IN BIT
Motion will pause until this pin is TRUE, under the following conditions: before the first
feed move after each spindle start or speed change; before the start of every chain of spin‐
dle-synchronized moves; and if in CSS mode, at every rapid->feed transition.
Please Log in or Create an account to join the conversation.
25 Apr 2021 13:16 #207006
by rider-83
Replied by rider-83 on topic Can't get lathe to Feed
Are you saying its waiting for a feed back signal from the spindle?
Please Log in or Create an account to join the conversation.
25 Apr 2021 13:20 - 25 Apr 2021 13:20 #207007
by PCW
Replied by PCW on topic Can't get lathe to Feed
Yes, that's the usual issue.
On very simple setups,, spindle-at-speed can simply be set true,
but normally it is seup in hal so its only true when the actual
spindle speed is close to the commanded speed, so cutting will
not start until the spindle is at the correct speed.
On very simple setups,, spindle-at-speed can simply be set true,
but normally it is seup in hal so its only true when the actual
spindle speed is close to the commanded speed, so cutting will
not start until the spindle is at the correct speed.
Last edit: 25 Apr 2021 13:20 by PCW.
Please Log in or Create an account to join the conversation.
25 Apr 2021 13:35 #207008
by rider-83
Replied by rider-83 on topic Can't get lathe to Feed
I get the same result from my test system which is not connected to a machine.
I fail to inform you that I have upgraded from 2.7 to 2.8, and I'm testing both live on the machine and at my test pc (neither have loop back from the spindle)
Any ideas ?
I fail to inform you that I have upgraded from 2.7 to 2.8, and I'm testing both live on the machine and at my test pc (neither have loop back from the spindle)
Any ideas ?
Please Log in or Create an account to join the conversation.
25 Apr 2021 14:34 #207011
by PCW
Replied by PCW on topic Can't get lathe to Feed
If you have no spindle speed feedback you would need to set spindle-at-speed
true in your hal file
true in your hal file
Please Log in or Create an account to join the conversation.
25 Apr 2021 14:46 #207013
by andypugh
Replied by andypugh on topic Can't get lathe to Feed
This shouldn't be necesssary:
github.com/LinuxCNC/linuxcnc/blob/43ac97...motion/motion.c#L599
The pin defaults to true if not connected.
So it is probably a misconfigured HAL file. Can you attach the HAL file?
github.com/LinuxCNC/linuxcnc/blob/43ac97...motion/motion.c#L599
The pin defaults to true if not connected.
So it is probably a misconfigured HAL file. Can you attach the HAL file?
Please Log in or Create an account to join the conversation.
25 Apr 2021 14:49 #207014
by andypugh
The program will run in G18. The status shows the interpreter status, and this runs ahead of the actual execution.
The reason that it goes back to G17 is the M30 at the end.
linuxcnc.org/docs/2.8/html/gcode/m-code.html#mcode:m2-m30
If you put % at the start and end and remove the M30 you will see the status remain in G17.
Replied by andypugh on topic Can't get lathe to Feed
If I type G18 in MDI it changes as required. But as soon as I press Cycle Start in Auto, we are back to G17 !
The program will run in G18. The status shows the interpreter status, and this runs ahead of the actual execution.
The reason that it goes back to G17 is the M30 at the end.
linuxcnc.org/docs/2.8/html/gcode/m-code.html#mcode:m2-m30
If you put % at the start and end and remove the M30 you will see the status remain in G17.
Please Log in or Create an account to join the conversation.
25 Apr 2021 15:00 - 25 Apr 2021 15:04 #207016
by rider-83
Replied by rider-83 on topic Can't get lathe to Feed
Adding % at both header & footer worked nicely.
We still have the feed holding though.
Experimental HAL File:
We still have the feed holding though.
Experimental HAL File:
###############################################################
# BOXFORD B160TCL WITH ATC #
###############################################################
loadrt [KINS]KINEMATICS
#autoconverted trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hal_parport cfg="0 out"
setp parport.0.reset-time 200
loadrt stepgen step_type=0,0,0,0
loadrt pwmgen output_type=1
addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf pwmgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
addf pwmgen.update servo-thread
############################################################
# DEFINE SPINDLE #
############################################################
net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 1500.0
setp pwmgen.0.scale 2269.23076923
setp pwmgen.0.offset -0.0220338983051
setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-at-speed => spindle.0.at-speed
net spindle-cw <= spindle.0.forward
net coolant-flood <= iocontrol.0.coolant-flood
###########################################
# DEFINE D25 PINS #
###########################################
net coolant-flood => parport.0.pin-01-out
setp parport.0.pin-01-out-invert 1
net xstep => parport.0.pin-02-out
net xdir => parport.0.pin-03-out
setp parport.0.pin-02-out-reset 1
net ystep => parport.0.pin-04-out
net ydir => parport.0.pin-05-out
setp parport.0.pin-04-out-reset 1
net zstep => parport.0.pin-06-out
net zdir => parport.0.pin-07-out
setp parport.0.pin-06-out-reset 1
net astep => parport.0.pin-08-out
net adir => parport.0.pin-09-out
setp parport.0.pin-08-out-reset 1
net spindle-pwm => parport.0.pin-14-out
net spindle-on => parport.0.pin-16-out
net spindle-cw => parport.0.pin-17-out
setp parport.0.pin-16-out-invert 1
############################################################
# EMERGENCY STOP #
############################################################
net estop-ext <= parport.0.pin-10-in-not
net estop-out <= iocontrol.0.user-enable-out
net estop-ext => iocontrol.0.emc-enable-in
###################################################################
# SET UP HOME & LIMITS #
###################################################################
net min-home-x joint.0.neg-lim-sw-in <= parport.0.pin-11-in-not
net min-home-x => joint.0.home-sw-in <= parport.0.pin-11-in-not
net min-home-z joint.2.neg-lim-sw-in <= parport.0.pin-12-in-not
net min-home-z => joint.2.home-sw-in <= parport.0.pin-12-in-not
#SET UP EXTERNAL HOME BUTTON#
net home-all halui.home-all <= parport.0.pin-13-in
###################################################################
###################################################################
# SET UP EXTERNAL CYCLESTART BUTTON #
net cycle-start-btn halui.program.run <= parport.0.pin-15-in
###################################################################
############################################################
# DEFINE AXIS #
############################################################
##########
# X-AXIS #
##########
setp stepgen.0.position-scale [JOINT_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 34000
setp stepgen.0.dirsetup 34000
setp stepgen.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL
net xpos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => joint.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable joint.0.amp-enable-out => stepgen.0.enable
##########
# Y-AXIS #
##########
setp stepgen.1.position-scale [JOINT_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 34000
setp stepgen.1.dirsetup 34000
setp stepgen.1.maxaccel [JOINT_0]STEPGEN_MAXACCEL
net ypos-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => joint.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable joint.1.amp-enable-out => stepgen.1.enable
##########
# Z-AXIS #
##########
setp stepgen.2.position-scale [JOINT_2]SCALE
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 34000
setp stepgen.2.dirsetup 34000
setp stepgen.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL
net zpos-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => joint.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable joint.2.amp-enable-out => stepgen.2.enable
##########
# A-AXIS #
##########
setp stepgen.3.position-scale [JOINT_3]SCALE
setp stepgen.3.steplen 1
setp stepgen.3.stepspace 0
setp stepgen.3.dirhold 34000
setp stepgen.3.dirsetup 34000
setp stepgen.3.maxaccel [JOINT_3]STEPGEN_MAXACCEL
net apos-cmd joint.3.motor-pos-cmd => stepgen.3.position-cmd
net apos-fb stepgen.3.position-fb => joint.3.motor-pos-fb
net astep <= stepgen.3.step
net adir <= stepgen.3.dir
net aenable joint.3.amp-enable-out => stepgen.3.enable
#################################################################################
# TOOL CHANGE SECTION #
#################################################################################
#MY ADAPTATION OF ATC
#net tool-number <= iocontrol.0.tool-prep-number
#net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
#net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed
#################################################################################
#################################################################################
#MANUAL CHANGE
#loadusr -W hal_manualtoolchange
#net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
#net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
#net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
#net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
#################################################################################
#################################################################################
#AUTOMATIC
#loadrt toolchanger
#addf toolchanger servo-thread
#net tool-change iocontrol.0.tool-change => toolchanger.toolchange
#net tool-changed iocontrol.0.tool-changed <= toolchanger.toolchanged
#net tool-number iocontrol.0.tool-prep-number => toolchanger.toolnumber
#net tool-oldnumber iocontrol.0.tool-number => toolchanger.currenttoolnumber
#net apos-cmd toolchanger.position-cmd => stepgen.3.position-cmd
#net ahomed joint.3.homed => toolchanger.ishomed
#net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
##################################################################################
Last edit: 25 Apr 2021 15:04 by andypugh.
Please Log in or Create an account to join the conversation.
25 Apr 2021 15:09 #207018
by andypugh
Replied by andypugh on topic Can't get lathe to Feed
You could try adding a "sets" to set spindle-at-speed true, but it shouldn't be necessary and I am suspecting that the problem is something else.
Is it possible that the feed-override is set to 0% ?
net spindle-at-speed => spindle.0.at-speed
sets spindle-at-speed 1
Is it possible that the feed-override is set to 0% ?
Please Log in or Create an account to join the conversation.
Time to create page: 0.084 seconds