Spindle using torque mode servo motor
- Masa
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 8
11 Aug 2021 03:47 #217467
by Masa
Spindle using torque mode servo motor was created by Masa
Hi! I am working on Linux CNC in Japan. I will post using machine translation, so please forgive the parts that are difficult to read.
We handle 3-axis milling machines. The XYZ axes are moving. I have a problem with the spindle.
The configuration is Linux CNC + EtherCAT and uses Beckhoff-EM7004 and torque mode servo motor. The spindle is a servo motor with 300 or pm and 4000 pulses per rotation. The default spindle speed is 300 rpm. When I rotate the spindle with Axis, it rotates 300 times at full speed and stops. It will not keep spinning at the desired speed. When reversed, it will stop at the position of -300 rotations.
The INI and HAL files look like this: Is there any misconfiguration? It feels like it's being positioned.
#****** my-mill.ini *****
[EMC]
MACHINE = my-mill
DEBUG = 0
VERSION = 1.1
[DISPLAY]
DISPLAY = axis
EDITOR = gedit
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
ARCDIVISION = 64
GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in
MAX_FEED_OVERRIDE = 2.0
MIN_SPINDLE_OVERRIDE = 0.5
MAX_SPINDLE_OVERRIDE = 1.2
DEFAULT_SPINDLE_SPEED = 300
MAX_SPINDLE_SPEED = 3000
DEFAULT_LINEAR_VELOCITY = 10.
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 166.67
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/masao/linuxcnc/nc_files
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm 0.001mm
[KINS]
JOINTS = 3
#JOINTS = 1
KINEMATICS = trivkins coordinates=XYZ
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
PROGRAM_EXTENSION = .nc,.tap G-Code File
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD = 100000
SERVO_PERIOD = 1000000
[HAL]
HALFILE = my-mill.hal
HALFILE = ethercat.hal
HALFILE = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal
[TRAJ]
COORDINATES = X Y Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 8.3
MAX_LINEAR_VELOCITY = 33.333
DEFAULT_LINEAR_ACCELERATION = 833.0
MAX_LINEAR_ACCELERATION = 833.0
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
[SPINDLE_0]
OUTPUT_MAX_LIMIT = 10
OUTPUT_MIN_LIMIT = -10
[AXIS_X]
MAX_VELOCITY = 166.67
MAX_ACCELERATION = 500.0
MIN_LIMIT = -200.5
MAX_LIMIT = 0.5
[JOINT_0]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -200.5
MAX_LIMIT = 0.5
MAX_VELOCITY = 83.333
MAX_ACCELERATION = 833.0
SCALE = 1.0
FERROR = 1000
MIN_FERROR = .25
HOME_SEARCH_VEL = 5.0
HOME_OFFSET = 0
HOME_USE_INDEX = YES
HOME_LATCH_VEL = 1.0
HOME_FINAL_VEL = 3.0
INPUT_SCALE = 1000
OUTPUT_SCALE = 1
MAX_OUTPUT = 10.0
BACKLASH = 0
#PID Parameter
DEADBAND = 0.0000
P = 20.0
I = 0.02
D = 0.1
FF0 = 0.000
FF1 = 0.000
FF2 = 0.0
BIAS = 0.000
[AXIS_Y]
MAX_VELOCITY = 166.67
MAX_ACCELERATION = 500.0
MIN_LIMIT = -200.0
MAX_LIMIT = 200.0
[JOINT_1]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -200.0
MAX_LIMIT = 200.0
MAX_VELOCITY = 83.333
MAX_ACCELERATION = 833.0
#STEPGEN_MAXACCEL = 937.5
SCALE = 1.0
FERROR = 1000
MIN_FERROR = .25
HOME_SEARCH_VEL = 5.0
HOME_OFFSET = 0
HOME_USE_INDEX = YES
HOME_LATCH_VEL = 1.0
HOME_FINAL_VEL = 3.0
INPUT_SCALE = 1000
OUTPUT_SCALE = 1
MAX_OUTPUT = 10.0
BACKLASH = 0
#PID Parameter
DEADBAND = 0.0000
P = 20.0
I = 0.02
D = 0.1
FF0 = 0.000
FF1 = 0.000
FF2 = 0.0
BIAS = 0.000
[AXIS_Z]
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
MIN_LIMIT = -200.0
MAX_LIMIT = 200.0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -200.0
MAX_LIMIT = 200.0
MAX_VELOCITY = 83.333
MAX_ACCELERATION = 833.0
#STEPGEN_MAXACCEL = 937.5
SCALE = 1.0
FERROR = 1000
MIN_FERROR = .25
HOME_SEARCH_VEL = 0
HOME_OFFSET = 0
HOME_USE_INDEX = NO
HOME_LATCH_VEL = 0
HOME_FINAL_VEL = 0
INPUT_SCALE = 1000
OUTPUT_SCALE = 1
MAX_OUTPUT = 10.0
BACKLASH = 0
#PID Parameter
DEADBAND = 0.0000
P = 8.0
I = 0.01
D = 0.2
FF0 = 0.000
FF1 = 0.000
FF2 = 0.0
BIAS = 0.000
#Spindle Setting
[SPINDLE]
#PID Parameter
DEADBAND = 0.0000
P = 10.0
I = 0.01
D = 0.21
FF0 = 0.000
FF1 = 0.000
FF2 = 0.0
BIAS = 0.000
#***** my-mill.hal *****
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_spindles=1
# Add PID
loadrt pid num_chan=4
loadrt not
addf pid.0.do-pid-calcs servo-thread
addf pid.1.do-pid-calcs servo-thread
addf pid.2.do-pid-calcs servo-thread
addf pid.3.do-pid-calcs servo-thread
source sim_hardware.hal
addf sim-hardware.update servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
net estop-out <= iocontrol.0.user-enable-out
#***** ethercat.hal *****
oadusr -W /usr/share/ethercat/linuxcnc_ethercat/src/lcec_conf ethercat-conf.xml
loadrt lcec
addf lcec.read-all servo-thread
addf lcec.write-all servo-thread
# X-Axis
setp lcec.0.1.aout-0-max-dc 10
setp lcec.0.1.aout-0-min-dc -10
setp lcec.0.1.aout-0-enable 1
setp lcec.0.1.aout-0-scale 10
# Y-Axis
setp lcec.0.1.aout-1-max-dc 10
setp lcec.0.1.aout-1-min-dc -10
setp lcec.0.1.aout-1-enable 1
setp lcec.0.1.aout-1-scale -10
# Z-Axis
setp lcec.0.1.aout-2-max-dc 10
setp lcec.0.1.aout-2-min-dc -10
setp lcec.0.1.aout-2-enable 1
setp lcec.0.1.aout-2-scale 10
# W-Axis(Spindle)
setp lcec.0.1.aout-3-max-dc 10
setp lcec.0.1.aout-3-min-dc -10
setp lcec.0.1.aout-3-enable 1
setp lcec.0.1.aout-3-scale 10
net EXT_STOP iocontrol.0.emc-enable-in lcec.0.1.din-0
# PID Parameter
# X-Axis
setp pid.0.Pgain [JOINT_0]P
setp pid.0.Igain [JOINT_0]I
setp pid.0.Dgain [JOINT_0]D
setp pid.0.bias [JOINT_0]BIAS
setp pid.0.FF0 [JOINT_0]FF0
setp pid.0.FF1 [JOINT_0]FF1
setp pid.0.FF2 [JOINT_0]FF2
setp pid.0.deadband [JOINT_0]DEADBAND
setp pid.0.maxoutput [JOINT_0]MAX_OUTPUT
# Y-Axis
setp pid.1.Pgain [JOINT_1]P
setp pid.1.Igain [JOINT_1]I
setp pid.1.Dgain [JOINT_1]D
setp pid.1.bias [JOINT_1]BIAS
setp pid.1.FF0 [JOINT_1]FF0
setp pid.1.FF1 [JOINT_1]FF1
setp pid.1.FF2 [JOINT_1]FF2
setp pid.1.deadband [JOINT_1]DEADBAND
setp pid.1.maxoutput [JOINT_1]MAX_OUTPUT
# Z-Axis
setp pid.2.Pgain [JOINT_2]P
setp pid.2.Igain [JOINT_2]I
setp pid.2.Dgain [JOINT_2]D
setp pid.2.bias [JOINT_2]BIAS
setp pid.2.FF0 [JOINT_2]FF0
setp pid.2.FF1 [JOINT_2]FF1
setp pid.2.FF2 [JOINT_2]FF2
setp pid.2.deadband [JOINT_2]DEADBAND
setp pid.2.maxoutput [JOINT_2]MAX_OUTPUT
# Spindle PID Parameter
setp pid.3.Pgain [SPINDLE]P
setp pid.3.Igain [SPINDLE]I
setp pid.3.Dgain [SPINDLE]D
setp pid.3.bias [SPINDLE]BIAS
setp pid.3.FF0 [SPINDLE]FF0
setp pid.3.FF1 [SPINDLE]FF1
setp pid.3.FF2 [SPINDLE]FF2
setp pid.3.deadband [SPINDLE]DEADBAND
setp pid.3.maxoutput 10
# PID Connect Signals
# X-Axis
setp lcec.0.1.enc-0-pos-scale 4000
net PID_X_OUT pid.0.output lcec.0.1.aout-0-value
net PID_X_FB pid.0.feedback lcec.0.1.enc-0-pos
net PID_X_CMD pid.0.command joint.0.motor-pos-cmd
net PID_X_FB => joint.0.motor-pos-fb
# Y-Axis
setp lcec.0.1.enc-1-pos-scale -4000
net PID_Y_OUT pid.1.output lcec.0.1.aout-1-value
net PID_Y_FB pid.1.feedback lcec.0.1.enc-1-pos
net PID_Y_CMD pid.1.command joint.1.motor-pos-cmd
net PID_Y_FB => joint.1.motor-pos-fb
# Z-Axis
setp lcec.0.1.enc-2-pos-scale 2000
net PID_Z_OUT pid.2.output lcec.0.1.aout-2-value
net PID_Z_FB pid.2.feedback lcec.0.1.enc-2-pos
net PID_Z_CMD pid.2.command joint.2.motor-pos-cmd
net PID_Z_FB => joint.2.motor-pos-fb
# Servo Amp Ready input
net sv-ready <= motion.motion-enabled
net sv-ready => pid.0.enable
net sv-ready => pid.1.enable
net sv-ready => pid.2.enable
net sv-ready => lcec.0.1.dout-0
#net sv-ready => lcec.0.1.dout-2 #Brake Coil
# Spindle
setp lcec.0.1.enc-3-pos-scale 4000
net spindle-index-enable <=> pid.3.index-enable
net spindle-index-enable <=> lcec.0.1.enc-3-index-ext-pos-enable
net spindle-pid-fb <= lcec.0.1.enc-3-pos
net spindle-pid-fb => pid.3.feedback
net spindle-pid-fb => spindle.0.revs
#net spindle-vel-cmd-rps <= spindle.0.speed-cmd-rps
net spindle-vel-cmd-rpm <= spindle.0.speed-out
#net spindle-vel-cmd-rps => pid.3.command
net spindle-vel-cmd-rpm => pid.3.command
net spindle-pid-output <= pid.3.output
net spindle-pid-output => lcec.0.1.aout-3-value
net spindle-enable <= spindle.0.on
net spindle-enable => pid.3.enable
net spindle-enable => lcec.0.1.dout-1
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable <=> spindle.0.index-enable
#Limit SW & Homing
# X-Axis
#net x-puls-limit joint.0.pos-hard-lim lcec.0.1.din-2-not
#net x-minus-limit joint.0.neg-hard-lim lcec.0.1.din-3-not
net x-puls-limit joint.0.pos-lim-sw-in lcec.0.1.din-2-not
net x-minus-limit joint.0.neg-lim-sw-in lcec.0.1.din-3-not
net x-home-sw joint.0.home-sw-in lcec.0.1.din-1-not
net x-home-index-enable joint.0.index-enable <=> lcec.0.1.enc-0-index-ext-pos-enable
# Y-Axis
net y-puls-limit joint.1.pos-lim-sw-in lcec.0.1.din-6-not
net y-minus-limit joint.1.neg-lim-sw-in lcec.0.1.din-7-not
net y-home-sw joint.1.home-sw-in lcec.0.1.din-5-not
net y-home-index-enable joint.1.index-enable <=> lcec.0.1.enc-1-index-ext-pos-enable
# Z-Axis
net z-puls-limit joint.2.pos-lim-sw-in lcec.0.1.din-10-not
net z-minus-limit joint.2.neg-lim-sw-in lcec.0.1.din-11-not
net z-home-sw joint.2.home-sw-in lcec.0.1.din-9-not
net z-home-index-enable joint.2.index-enable <=> lcec.0.1.enc-2-index-ext-pos-enable
We handle 3-axis milling machines. The XYZ axes are moving. I have a problem with the spindle.
The configuration is Linux CNC + EtherCAT and uses Beckhoff-EM7004 and torque mode servo motor. The spindle is a servo motor with 300 or pm and 4000 pulses per rotation. The default spindle speed is 300 rpm. When I rotate the spindle with Axis, it rotates 300 times at full speed and stops. It will not keep spinning at the desired speed. When reversed, it will stop at the position of -300 rotations.
The INI and HAL files look like this: Is there any misconfiguration? It feels like it's being positioned.
#****** my-mill.ini *****
[EMC]
MACHINE = my-mill
DEBUG = 0
VERSION = 1.1
[DISPLAY]
DISPLAY = axis
EDITOR = gedit
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
ARCDIVISION = 64
GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in
MAX_FEED_OVERRIDE = 2.0
MIN_SPINDLE_OVERRIDE = 0.5
MAX_SPINDLE_OVERRIDE = 1.2
DEFAULT_SPINDLE_SPEED = 300
MAX_SPINDLE_SPEED = 3000
DEFAULT_LINEAR_VELOCITY = 10.
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 166.67
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/masao/linuxcnc/nc_files
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm 0.001mm
[KINS]
JOINTS = 3
#JOINTS = 1
KINEMATICS = trivkins coordinates=XYZ
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
PROGRAM_EXTENSION = .nc,.tap G-Code File
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD = 100000
SERVO_PERIOD = 1000000
[HAL]
HALFILE = my-mill.hal
HALFILE = ethercat.hal
HALFILE = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal
[TRAJ]
COORDINATES = X Y Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 8.3
MAX_LINEAR_VELOCITY = 33.333
DEFAULT_LINEAR_ACCELERATION = 833.0
MAX_LINEAR_ACCELERATION = 833.0
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
[SPINDLE_0]
OUTPUT_MAX_LIMIT = 10
OUTPUT_MIN_LIMIT = -10
[AXIS_X]
MAX_VELOCITY = 166.67
MAX_ACCELERATION = 500.0
MIN_LIMIT = -200.5
MAX_LIMIT = 0.5
[JOINT_0]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -200.5
MAX_LIMIT = 0.5
MAX_VELOCITY = 83.333
MAX_ACCELERATION = 833.0
SCALE = 1.0
FERROR = 1000
MIN_FERROR = .25
HOME_SEARCH_VEL = 5.0
HOME_OFFSET = 0
HOME_USE_INDEX = YES
HOME_LATCH_VEL = 1.0
HOME_FINAL_VEL = 3.0
INPUT_SCALE = 1000
OUTPUT_SCALE = 1
MAX_OUTPUT = 10.0
BACKLASH = 0
#PID Parameter
DEADBAND = 0.0000
P = 20.0
I = 0.02
D = 0.1
FF0 = 0.000
FF1 = 0.000
FF2 = 0.0
BIAS = 0.000
[AXIS_Y]
MAX_VELOCITY = 166.67
MAX_ACCELERATION = 500.0
MIN_LIMIT = -200.0
MAX_LIMIT = 200.0
[JOINT_1]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -200.0
MAX_LIMIT = 200.0
MAX_VELOCITY = 83.333
MAX_ACCELERATION = 833.0
#STEPGEN_MAXACCEL = 937.5
SCALE = 1.0
FERROR = 1000
MIN_FERROR = .25
HOME_SEARCH_VEL = 5.0
HOME_OFFSET = 0
HOME_USE_INDEX = YES
HOME_LATCH_VEL = 1.0
HOME_FINAL_VEL = 3.0
INPUT_SCALE = 1000
OUTPUT_SCALE = 1
MAX_OUTPUT = 10.0
BACKLASH = 0
#PID Parameter
DEADBAND = 0.0000
P = 20.0
I = 0.02
D = 0.1
FF0 = 0.000
FF1 = 0.000
FF2 = 0.0
BIAS = 0.000
[AXIS_Z]
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
MIN_LIMIT = -200.0
MAX_LIMIT = 200.0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -200.0
MAX_LIMIT = 200.0
MAX_VELOCITY = 83.333
MAX_ACCELERATION = 833.0
#STEPGEN_MAXACCEL = 937.5
SCALE = 1.0
FERROR = 1000
MIN_FERROR = .25
HOME_SEARCH_VEL = 0
HOME_OFFSET = 0
HOME_USE_INDEX = NO
HOME_LATCH_VEL = 0
HOME_FINAL_VEL = 0
INPUT_SCALE = 1000
OUTPUT_SCALE = 1
MAX_OUTPUT = 10.0
BACKLASH = 0
#PID Parameter
DEADBAND = 0.0000
P = 8.0
I = 0.01
D = 0.2
FF0 = 0.000
FF1 = 0.000
FF2 = 0.0
BIAS = 0.000
#Spindle Setting
[SPINDLE]
#PID Parameter
DEADBAND = 0.0000
P = 10.0
I = 0.01
D = 0.21
FF0 = 0.000
FF1 = 0.000
FF2 = 0.0
BIAS = 0.000
#***** my-mill.hal *****
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_spindles=1
# Add PID
loadrt pid num_chan=4
loadrt not
addf pid.0.do-pid-calcs servo-thread
addf pid.1.do-pid-calcs servo-thread
addf pid.2.do-pid-calcs servo-thread
addf pid.3.do-pid-calcs servo-thread
source sim_hardware.hal
addf sim-hardware.update servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
net estop-out <= iocontrol.0.user-enable-out
#***** ethercat.hal *****
oadusr -W /usr/share/ethercat/linuxcnc_ethercat/src/lcec_conf ethercat-conf.xml
loadrt lcec
addf lcec.read-all servo-thread
addf lcec.write-all servo-thread
# X-Axis
setp lcec.0.1.aout-0-max-dc 10
setp lcec.0.1.aout-0-min-dc -10
setp lcec.0.1.aout-0-enable 1
setp lcec.0.1.aout-0-scale 10
# Y-Axis
setp lcec.0.1.aout-1-max-dc 10
setp lcec.0.1.aout-1-min-dc -10
setp lcec.0.1.aout-1-enable 1
setp lcec.0.1.aout-1-scale -10
# Z-Axis
setp lcec.0.1.aout-2-max-dc 10
setp lcec.0.1.aout-2-min-dc -10
setp lcec.0.1.aout-2-enable 1
setp lcec.0.1.aout-2-scale 10
# W-Axis(Spindle)
setp lcec.0.1.aout-3-max-dc 10
setp lcec.0.1.aout-3-min-dc -10
setp lcec.0.1.aout-3-enable 1
setp lcec.0.1.aout-3-scale 10
net EXT_STOP iocontrol.0.emc-enable-in lcec.0.1.din-0
# PID Parameter
# X-Axis
setp pid.0.Pgain [JOINT_0]P
setp pid.0.Igain [JOINT_0]I
setp pid.0.Dgain [JOINT_0]D
setp pid.0.bias [JOINT_0]BIAS
setp pid.0.FF0 [JOINT_0]FF0
setp pid.0.FF1 [JOINT_0]FF1
setp pid.0.FF2 [JOINT_0]FF2
setp pid.0.deadband [JOINT_0]DEADBAND
setp pid.0.maxoutput [JOINT_0]MAX_OUTPUT
# Y-Axis
setp pid.1.Pgain [JOINT_1]P
setp pid.1.Igain [JOINT_1]I
setp pid.1.Dgain [JOINT_1]D
setp pid.1.bias [JOINT_1]BIAS
setp pid.1.FF0 [JOINT_1]FF0
setp pid.1.FF1 [JOINT_1]FF1
setp pid.1.FF2 [JOINT_1]FF2
setp pid.1.deadband [JOINT_1]DEADBAND
setp pid.1.maxoutput [JOINT_1]MAX_OUTPUT
# Z-Axis
setp pid.2.Pgain [JOINT_2]P
setp pid.2.Igain [JOINT_2]I
setp pid.2.Dgain [JOINT_2]D
setp pid.2.bias [JOINT_2]BIAS
setp pid.2.FF0 [JOINT_2]FF0
setp pid.2.FF1 [JOINT_2]FF1
setp pid.2.FF2 [JOINT_2]FF2
setp pid.2.deadband [JOINT_2]DEADBAND
setp pid.2.maxoutput [JOINT_2]MAX_OUTPUT
# Spindle PID Parameter
setp pid.3.Pgain [SPINDLE]P
setp pid.3.Igain [SPINDLE]I
setp pid.3.Dgain [SPINDLE]D
setp pid.3.bias [SPINDLE]BIAS
setp pid.3.FF0 [SPINDLE]FF0
setp pid.3.FF1 [SPINDLE]FF1
setp pid.3.FF2 [SPINDLE]FF2
setp pid.3.deadband [SPINDLE]DEADBAND
setp pid.3.maxoutput 10
# PID Connect Signals
# X-Axis
setp lcec.0.1.enc-0-pos-scale 4000
net PID_X_OUT pid.0.output lcec.0.1.aout-0-value
net PID_X_FB pid.0.feedback lcec.0.1.enc-0-pos
net PID_X_CMD pid.0.command joint.0.motor-pos-cmd
net PID_X_FB => joint.0.motor-pos-fb
# Y-Axis
setp lcec.0.1.enc-1-pos-scale -4000
net PID_Y_OUT pid.1.output lcec.0.1.aout-1-value
net PID_Y_FB pid.1.feedback lcec.0.1.enc-1-pos
net PID_Y_CMD pid.1.command joint.1.motor-pos-cmd
net PID_Y_FB => joint.1.motor-pos-fb
# Z-Axis
setp lcec.0.1.enc-2-pos-scale 2000
net PID_Z_OUT pid.2.output lcec.0.1.aout-2-value
net PID_Z_FB pid.2.feedback lcec.0.1.enc-2-pos
net PID_Z_CMD pid.2.command joint.2.motor-pos-cmd
net PID_Z_FB => joint.2.motor-pos-fb
# Servo Amp Ready input
net sv-ready <= motion.motion-enabled
net sv-ready => pid.0.enable
net sv-ready => pid.1.enable
net sv-ready => pid.2.enable
net sv-ready => lcec.0.1.dout-0
#net sv-ready => lcec.0.1.dout-2 #Brake Coil
# Spindle
setp lcec.0.1.enc-3-pos-scale 4000
net spindle-index-enable <=> pid.3.index-enable
net spindle-index-enable <=> lcec.0.1.enc-3-index-ext-pos-enable
net spindle-pid-fb <= lcec.0.1.enc-3-pos
net spindle-pid-fb => pid.3.feedback
net spindle-pid-fb => spindle.0.revs
#net spindle-vel-cmd-rps <= spindle.0.speed-cmd-rps
net spindle-vel-cmd-rpm <= spindle.0.speed-out
#net spindle-vel-cmd-rps => pid.3.command
net spindle-vel-cmd-rpm => pid.3.command
net spindle-pid-output <= pid.3.output
net spindle-pid-output => lcec.0.1.aout-3-value
net spindle-enable <= spindle.0.on
net spindle-enable => pid.3.enable
net spindle-enable => lcec.0.1.dout-1
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable <=> spindle.0.index-enable
#Limit SW & Homing
# X-Axis
#net x-puls-limit joint.0.pos-hard-lim lcec.0.1.din-2-not
#net x-minus-limit joint.0.neg-hard-lim lcec.0.1.din-3-not
net x-puls-limit joint.0.pos-lim-sw-in lcec.0.1.din-2-not
net x-minus-limit joint.0.neg-lim-sw-in lcec.0.1.din-3-not
net x-home-sw joint.0.home-sw-in lcec.0.1.din-1-not
net x-home-index-enable joint.0.index-enable <=> lcec.0.1.enc-0-index-ext-pos-enable
# Y-Axis
net y-puls-limit joint.1.pos-lim-sw-in lcec.0.1.din-6-not
net y-minus-limit joint.1.neg-lim-sw-in lcec.0.1.din-7-not
net y-home-sw joint.1.home-sw-in lcec.0.1.din-5-not
net y-home-index-enable joint.1.index-enable <=> lcec.0.1.enc-1-index-ext-pos-enable
# Z-Axis
net z-puls-limit joint.2.pos-lim-sw-in lcec.0.1.din-10-not
net z-minus-limit joint.2.neg-lim-sw-in lcec.0.1.din-11-not
net z-home-sw joint.2.home-sw-in lcec.0.1.din-9-not
net z-home-index-enable joint.2.index-enable <=> lcec.0.1.enc-2-index-ext-pos-enable
Please Log in or Create an account to join the conversation.
- Masa
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 8
12 Aug 2021 07:42 #217592
by Masa
Replied by Masa on topic Spindle using torque mode servo motor
This issue has been resolved.
The following has been added and corrected in HAL.
loadrt ddt count=1
addf ddt.0 servo-thread
net spindle-vel-fb <= lcec.0.1.enc-3-pos
net spindle-vel-fb => ddt.0.in
net spindle-pid-fb <= ddt.0.out
net spindle-pid-fb => pid.3.feedback
net spindle-vel-fb => spindle.0.revs
net spindle-vel-cmd-rps <= spindle.0.speed-cmd-rps
#net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rps => pid.3.command
#net spindle-vel-cmd-rpm => pid.3.command
net spindle-pid-output <= pid.3.output
net spindle-pid-output => lcec.0.1.aout-3-value
net spindle-enable <= spindle.0.on
net spindle-enable => pid.3.enable
net spindle-enable => lcec.0.1.dout-1
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable <=> spindle.0.index-enable
thank you.
The following has been added and corrected in HAL.
loadrt ddt count=1
addf ddt.0 servo-thread
net spindle-vel-fb <= lcec.0.1.enc-3-pos
net spindle-vel-fb => ddt.0.in
net spindle-pid-fb <= ddt.0.out
net spindle-pid-fb => pid.3.feedback
net spindle-vel-fb => spindle.0.revs
net spindle-vel-cmd-rps <= spindle.0.speed-cmd-rps
#net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rps => pid.3.command
#net spindle-vel-cmd-rpm => pid.3.command
net spindle-pid-output <= pid.3.output
net spindle-pid-output => lcec.0.1.aout-3-value
net spindle-enable <= spindle.0.on
net spindle-enable => pid.3.enable
net spindle-enable => lcec.0.1.dout-1
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable <=> spindle.0.index-enable
thank you.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23170
- Thank you received: 4860
16 Aug 2021 23:18 #217922
by andypugh
Replied by andypugh on topic Spindle using torque mode servo motor
It would be better to skip the ddt and use the lcec.0.1.enc-3-vel signal as the pid-fb, if such a pin exists.
Please Log in or Create an account to join the conversation.
Time to create page: 0.224 seconds