- LinuxCNC
- General LinuxCNC Questions
- [resolved]Ethercat servo spindle orient problem while using M19 ?
[resolved]Ethercat servo spindle orient problem while using M19 ?
- timaer
- Offline
- Premium Member
Less
More
- Posts: 82
- Thank you received: 4
11 Jul 2024 07:53 - 13 Jul 2024 09:43 #304871
by timaer
[resolved]Ethercat servo spindle orient problem while using M19 ? was created by timaer
Hi,everyone
I've tried to follow the orient hal map to build a hal to test if it can be workable for orient ,but met some problem. while running M3 S100,M4 S100 such command it's all OK, but when I tried to use M19 R180 ,it didnt rotate at all. Using halshow display GUI,I noticed that while I run M3/M4 command,the spindle.on is true,but while I run the M19 R180 ,it is false.I dont know if it is the reason.Wish someone could help me ,point out where is the error of my hal .Thanks
###########################################################
#
# CIA 402 example snippet Hal
#
###########################################################
###########################################################
# Setup
###########################################################
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=2
loadrt pid names=pos-pid,velo-pid
loadrt orient count=1
loadrt mux2 count=1
###########################################################
# Functions servo-thread
###########################################################
addf lcec.read-all servo-thread #reading from servo
addf cia402.0.read-all servo-thread
addf cia402.1.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread #linuxcnc module ,cia402 module as a translator
addf pos-pid.do-pid-calcs servo-thread
addf velo-pid.do-pid-calcs servo-thread
addf orient.0 servo-thread
addf mux2.0 servo-thread
addf cia402.0.write-all servo-thread
addf cia402.1.write-all servo-thread #writing to servo
addf lcec.write-all servo-thread
#########################################
#nets
#########################################
net emc-enable => iocontrol.0.emc-enable-in
sets emc-enable 1
#config
#
# Joint 0
#
setp cia402.0.csp-mode 0
setp cia402.0.velo-scale 166
#FOR SPINDLE
setp velo-pid.deadband 0.3 #limit pid tolerance
setp velo-pid.maxoutput 500 #limit pid maxoutput to protect
setp pos-pid.deadband 0.3
setp pos-pid.maxoutput 500
net 0-statusword lcec.0.0.cia-statusword => cia402.0.statusword
net 0-opmode-display lcec.0.0.opmode-display => cia402.0.opmode-display
net 0-drv-act-pos lcec.0.0.actual-position => cia402.0.drv-actual-position
net 0-drv-act-velo lcec.0.0.actual-velocity => cia402.0.drv-actual-velocity
net 0-speed-fb cia402.0.velocity-fb => velo-pid.feedback
net 0-pos-fb pos-pid.feedback <= cia402.0.pos-fb => orient.0.position
#for spindle orient
#from linuxcnc motion to cia402 / cia402 to motion
#net 0-spindleON spindle.0.on => cia402.0.enable
#net 0-target-speed spindle.0.speed-out => cia402.0.velocity-cmd
net 0-home-index spindle.0.index-enable => cia402.0.home
net 0-spindleON velo-pid.enable <= spindle.0.on => cia402.0.enable
net 0-target-speed spindle.0.speed-out => velo-pid.command
net 0-orient pos-pid.enable <= spindle.0.orient => orient.0.enable => mux2.0.sel
net 0-angle spindle.0.orient-angle => orient.0.angle
net 0-orient_topos orient.0.command => pos-pid.command
net 0-pospid-tomux pos-pid.output => mux2.0.in1
net 0-velopid-tomux velo-pid.output => mux2.0.in0
net 0-muxtoabs-final-speed mux2.0.out => cia402.0.velocity-cmd
net 0-amp-fault spindle.0.amp-fault-in <= cia402.0.drv-fault
#from cia402 to servo
net 0-controlword cia402.0.controlword => lcec.0.0.cia-controlword
net 0-modes-of-operation cia402.0.opmode => lcec.0.0.opmode
net 0-drv-target-pos cia402.0.drv-target-position => lcec.0.0.target-position
net 0-drv-target-velo cia402.0.drv-target-velocity => lcec.0.0.target-velocity
#
# Joint 1
#
setp cia402.1.csp-mode 1
setp cia402.1.pos-scale 166
#from servo to cia402
net 1-statusword lcec.0.1.cia-statusword => cia402.1.statusword
net 1-opmode-display lcec.0.1.opmode-display => cia402.1.opmode-display
net 1-drv-act-pos lcec.0.1.actual-position => cia402.1.drv-actual-position
net 1-drv-act-velo lcec.0.1.actual-velocity => cia402.1.drv-actual-velocity
#from linuxcnc motion to cia402 / cia402 to motion
net 1-home-index joint.1.index-enable => cia402.1.home
net 1-enable joint.1.amp-enable-out => cia402.1.enable
net 1-amp-fault joint.1.amp-fault-in <= cia402.1.drv-fault
net 1-pos-cmd joint.1.motor-pos-cmd => cia402.1.pos-cmd
net 1-pos-fb joint.1.motor-pos-fb <= cia402.1.pos-fb
#from cia402 to servo
net 1-controlword cia402.1.controlword => lcec.0.1.cia-controlword
net 1-modes-of-operation cia402.1.opmode => lcec.0.1.opmode
net 1-drv-target-pos cia402.1.drv-target-position => lcec.0.1.target-position
net 1-drv-target-velo cia402.1.drv-target-velocity => lcec.0.1.target-velocity
I've tried to follow the orient hal map to build a hal to test if it can be workable for orient ,but met some problem. while running M3 S100,M4 S100 such command it's all OK, but when I tried to use M19 R180 ,it didnt rotate at all. Using halshow display GUI,I noticed that while I run M3/M4 command,the spindle.on is true,but while I run the M19 R180 ,it is false.I dont know if it is the reason.Wish someone could help me ,point out where is the error of my hal .Thanks
###########################################################
#
# CIA 402 example snippet Hal
#
###########################################################
###########################################################
# Setup
###########################################################
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=2
loadrt pid names=pos-pid,velo-pid
loadrt orient count=1
loadrt mux2 count=1
###########################################################
# Functions servo-thread
###########################################################
addf lcec.read-all servo-thread #reading from servo
addf cia402.0.read-all servo-thread
addf cia402.1.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread #linuxcnc module ,cia402 module as a translator
addf pos-pid.do-pid-calcs servo-thread
addf velo-pid.do-pid-calcs servo-thread
addf orient.0 servo-thread
addf mux2.0 servo-thread
addf cia402.0.write-all servo-thread
addf cia402.1.write-all servo-thread #writing to servo
addf lcec.write-all servo-thread
#########################################
#nets
#########################################
net emc-enable => iocontrol.0.emc-enable-in
sets emc-enable 1
#config
#
# Joint 0
#
setp cia402.0.csp-mode 0
setp cia402.0.velo-scale 166
#FOR SPINDLE
setp velo-pid.deadband 0.3 #limit pid tolerance
setp velo-pid.maxoutput 500 #limit pid maxoutput to protect
setp pos-pid.deadband 0.3
setp pos-pid.maxoutput 500
net 0-statusword lcec.0.0.cia-statusword => cia402.0.statusword
net 0-opmode-display lcec.0.0.opmode-display => cia402.0.opmode-display
net 0-drv-act-pos lcec.0.0.actual-position => cia402.0.drv-actual-position
net 0-drv-act-velo lcec.0.0.actual-velocity => cia402.0.drv-actual-velocity
net 0-speed-fb cia402.0.velocity-fb => velo-pid.feedback
net 0-pos-fb pos-pid.feedback <= cia402.0.pos-fb => orient.0.position
#for spindle orient
#from linuxcnc motion to cia402 / cia402 to motion
#net 0-spindleON spindle.0.on => cia402.0.enable
#net 0-target-speed spindle.0.speed-out => cia402.0.velocity-cmd
net 0-home-index spindle.0.index-enable => cia402.0.home
net 0-spindleON velo-pid.enable <= spindle.0.on => cia402.0.enable
net 0-target-speed spindle.0.speed-out => velo-pid.command
net 0-orient pos-pid.enable <= spindle.0.orient => orient.0.enable => mux2.0.sel
net 0-angle spindle.0.orient-angle => orient.0.angle
net 0-orient_topos orient.0.command => pos-pid.command
net 0-pospid-tomux pos-pid.output => mux2.0.in1
net 0-velopid-tomux velo-pid.output => mux2.0.in0
net 0-muxtoabs-final-speed mux2.0.out => cia402.0.velocity-cmd
net 0-amp-fault spindle.0.amp-fault-in <= cia402.0.drv-fault
#from cia402 to servo
net 0-controlword cia402.0.controlword => lcec.0.0.cia-controlword
net 0-modes-of-operation cia402.0.opmode => lcec.0.0.opmode
net 0-drv-target-pos cia402.0.drv-target-position => lcec.0.0.target-position
net 0-drv-target-velo cia402.0.drv-target-velocity => lcec.0.0.target-velocity
#
# Joint 1
#
setp cia402.1.csp-mode 1
setp cia402.1.pos-scale 166
#from servo to cia402
net 1-statusword lcec.0.1.cia-statusword => cia402.1.statusword
net 1-opmode-display lcec.0.1.opmode-display => cia402.1.opmode-display
net 1-drv-act-pos lcec.0.1.actual-position => cia402.1.drv-actual-position
net 1-drv-act-velo lcec.0.1.actual-velocity => cia402.1.drv-actual-velocity
#from linuxcnc motion to cia402 / cia402 to motion
net 1-home-index joint.1.index-enable => cia402.1.home
net 1-enable joint.1.amp-enable-out => cia402.1.enable
net 1-amp-fault joint.1.amp-fault-in <= cia402.1.drv-fault
net 1-pos-cmd joint.1.motor-pos-cmd => cia402.1.pos-cmd
net 1-pos-fb joint.1.motor-pos-fb <= cia402.1.pos-fb
#from cia402 to servo
net 1-controlword cia402.1.controlword => lcec.0.1.cia-controlword
net 1-modes-of-operation cia402.1.opmode => lcec.0.1.opmode
net 1-drv-target-pos cia402.1.drv-target-position => lcec.0.1.target-position
net 1-drv-target-velo cia402.1.drv-target-velocity => lcec.0.1.target-velocity
Last edit: 13 Jul 2024 09:43 by timaer.
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 3970
- Thank you received: 1719
11 Jul 2024 08:19 #304873
by Aciera
Replied by Aciera on topic Ethercat servo spindle orient problem while using M19 ?
for M19
'spindle.on' is false
'spindle.orient' is true
Have a look at section 2:
linuxcnc.org/docs/devel/html/config/core...html#sec:motion-pins
When you call M19 what do you see when you watch this signal:
net 0-muxtoabs-final-speed mux2.0.out => cia402.0.velocity-cmd
'spindle.on' is false
'spindle.orient' is true
Have a look at section 2:
linuxcnc.org/docs/devel/html/config/core...html#sec:motion-pins
When you call M19 what do you see when you watch this signal:
net 0-muxtoabs-final-speed mux2.0.out => cia402.0.velocity-cmd
The following user(s) said Thank You: timaer
Please Log in or Create an account to join the conversation.
- timaer
- Offline
- Premium Member
Less
More
- Posts: 82
- Thank you received: 4
11 Jul 2024 08:36 - 11 Jul 2024 08:47 #304874
by timaer
Replied by timaer on topic Ethercat servo spindle orient problem while using M19 ?
Hi,Thank you ,Aciera.I just runned M19 R180,and the 0-muxtoabs-final-speed value is 0.2, is this the reason why the orient not working ?
BTW,"for M19 'spindle.on' is false 'spindle.orient' is true ",that's the exact situation while I runned M19,but still ,the orient action not happed.
BTW,"for M19 'spindle.on' is false 'spindle.orient' is true ",that's the exact situation while I runned M19,but still ,the orient action not happed.
Last edit: 11 Jul 2024 08:47 by timaer.
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 3970
- Thank you received: 1719
11 Jul 2024 08:46 #304876
by Aciera
Replied by Aciera on topic Ethercat servo spindle orient problem while using M19 ?
Looks like the spindle drive is only enabled when using M3/M4:
net 0-spindleON velo-pid.enable <= spindle.0.on => cia402.0.enable
I guess you need to enable the spindle drive if 'spindle.0.on' is true OR 'spindle.0.orient' is true
So maybe try inserting an 'OR2' component with the 'spindle.0.on' signal on input 0, 'spindle.0.orient' signal on input 1 and the output going to 'cia402.0.enable'
net 0-spindleON velo-pid.enable <= spindle.0.on => cia402.0.enable
I guess you need to enable the spindle drive if 'spindle.0.on' is true OR 'spindle.0.orient' is true
So maybe try inserting an 'OR2' component with the 'spindle.0.on' signal on input 0, 'spindle.0.orient' signal on input 1 and the output going to 'cia402.0.enable'
The following user(s) said Thank You: timaer
Please Log in or Create an account to join the conversation.
- timaer
- Offline
- Premium Member
Less
More
- Posts: 82
- Thank you received: 4
11 Jul 2024 09:10 - 11 Jul 2024 09:10 #304882
by timaer
Replied by timaer on topic Ethercat servo spindle orient problem while using M19 ?
Hi,Aciera,I've modified it following your suggestion.it seems to be still not working.before modifying ,the final value is always 0.2 and after modifying ,now the value jump over again in 0.2 and -0.2 .
###########################################################
#
# CIA 402 example snippet Hal
#
###########################################################
###########################################################
# Setup
###########################################################
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=2
loadrt pid names=pos-pid,velo-pid
loadrt orient count=1
loadrt mux2 count=1
loadrt or2 count=1
###########################################################
# Functions servo-thread
###########################################################
addf lcec.read-all servo-thread #reading from servo
addf cia402.0.read-all servo-thread
addf cia402.1.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread #linuxcnc module ,cia402 module as a translator
addf pos-pid.do-pid-calcs servo-thread
addf velo-pid.do-pid-calcs servo-thread
addf orient.0 servo-thread
addf mux2.0 servo-thread
addf or2.0 servo-thread
addf cia402.0.write-all servo-thread
addf cia402.1.write-all servo-thread #writing to servo
addf lcec.write-all servo-thread
#########################################
#nets
#########################################
net emc-enable => iocontrol.0.emc-enable-in
sets emc-enable 1
#config
#
# Joint 0
#
setp cia402.0.csp-mode 0
setp cia402.0.velo-scale 166
#FOR SPINDLE
setp velo-pid.deadband 0.3 #limit pid tolerance
setp velo-pid.maxoutput 500 #limit pid maxoutput to protect
setp pos-pid.deadband 0.3
setp pos-pid.maxoutput 500
net 0-statusword lcec.0.0.cia-statusword => cia402.0.statusword
net 0-opmode-display lcec.0.0.opmode-display => cia402.0.opmode-display
net 0-drv-act-pos lcec.0.0.actual-position => cia402.0.drv-actual-position
net 0-drv-act-velo lcec.0.0.actual-velocity => cia402.0.drv-actual-velocity
net 0-speed-fb cia402.0.velocity-fb => velo-pid.feedback
net 0-pos-fb pos-pid.feedback <= cia402.0.pos-fb => orient.0.position
#for spindle orient
#from linuxcnc motion to cia402 / cia402 to motion
#net 0-spindleON spindle.0.on => cia402.0.enable
#net 0-target-speed spindle.0.speed-out => cia402.0.velocity-cmd
net 0-spindleon-normal velo-pid.enable <= spindle.0.on => or2.0.in0
net 0-home-index spindle.0.index-enable => cia402.0.home
net 0-target-speed spindle.0.speed-out => velo-pid.command
net 0-orient pos-pid.enable <= spindle.0.orient => orient.0.enable => mux2.0.sel => or2.0.in1
net 0-spindleON or2.0.out => cia402.0.enable
net 0-angle spindle.0.orient-angle => orient.0.angle
net 0-orient_topos orient.0.command => pos-pid.command
net 0-pospid-tomux pos-pid.output => mux2.0.in1
net 0-velopid-tomux velo-pid.output => mux2.0.in0
net 0-muxtoabs-final-speed mux2.0.out => cia402.0.velocity-cmd
net 0-amp-fault spindle.0.amp-fault-in <= cia402.0.drv-fault
#from cia402 to servo
net 0-controlword cia402.0.controlword => lcec.0.0.cia-controlword
net 0-modes-of-operation cia402.0.opmode => lcec.0.0.opmode
net 0-drv-target-pos cia402.0.drv-target-position => lcec.0.0.target-position
net 0-drv-target-velo cia402.0.drv-target-velocity => lcec.0.0.target-velocity
#
# Joint 1
#
setp cia402.1.csp-mode 1
setp cia402.1.pos-scale 166
#from servo to cia402
net 1-statusword lcec.0.1.cia-statusword => cia402.1.statusword
net 1-opmode-display lcec.0.1.opmode-display => cia402.1.opmode-display
net 1-drv-act-pos lcec.0.1.actual-position => cia402.1.drv-actual-position
net 1-drv-act-velo lcec.0.1.actual-velocity => cia402.1.drv-actual-velocity
#from linuxcnc motion to cia402 / cia402 to motion
net 1-home-index joint.1.index-enable => cia402.1.home
net 1-enable joint.1.amp-enable-out => cia402.1.enable
net 1-amp-fault joint.1.amp-fault-in <= cia402.1.drv-fault
net 1-pos-cmd joint.1.motor-pos-cmd => cia402.1.pos-cmd
net 1-pos-fb joint.1.motor-pos-fb <= cia402.1.pos-fb
#from cia402 to servo
net 1-controlword cia402.1.controlword => lcec.0.1.cia-controlword
net 1-modes-of-operation cia402.1.opmode => lcec.0.1.opmode
net 1-drv-target-pos cia402.1.drv-target-position => lcec.0.1.target-position
net 1-drv-target-velo cia402.1.drv-target-velocity => lcec.0.1.target-velocity
###########################################################
#
# CIA 402 example snippet Hal
#
###########################################################
###########################################################
# Setup
###########################################################
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=2
loadrt pid names=pos-pid,velo-pid
loadrt orient count=1
loadrt mux2 count=1
loadrt or2 count=1
###########################################################
# Functions servo-thread
###########################################################
addf lcec.read-all servo-thread #reading from servo
addf cia402.0.read-all servo-thread
addf cia402.1.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread #linuxcnc module ,cia402 module as a translator
addf pos-pid.do-pid-calcs servo-thread
addf velo-pid.do-pid-calcs servo-thread
addf orient.0 servo-thread
addf mux2.0 servo-thread
addf or2.0 servo-thread
addf cia402.0.write-all servo-thread
addf cia402.1.write-all servo-thread #writing to servo
addf lcec.write-all servo-thread
#########################################
#nets
#########################################
net emc-enable => iocontrol.0.emc-enable-in
sets emc-enable 1
#config
#
# Joint 0
#
setp cia402.0.csp-mode 0
setp cia402.0.velo-scale 166
#FOR SPINDLE
setp velo-pid.deadband 0.3 #limit pid tolerance
setp velo-pid.maxoutput 500 #limit pid maxoutput to protect
setp pos-pid.deadband 0.3
setp pos-pid.maxoutput 500
net 0-statusword lcec.0.0.cia-statusword => cia402.0.statusword
net 0-opmode-display lcec.0.0.opmode-display => cia402.0.opmode-display
net 0-drv-act-pos lcec.0.0.actual-position => cia402.0.drv-actual-position
net 0-drv-act-velo lcec.0.0.actual-velocity => cia402.0.drv-actual-velocity
net 0-speed-fb cia402.0.velocity-fb => velo-pid.feedback
net 0-pos-fb pos-pid.feedback <= cia402.0.pos-fb => orient.0.position
#for spindle orient
#from linuxcnc motion to cia402 / cia402 to motion
#net 0-spindleON spindle.0.on => cia402.0.enable
#net 0-target-speed spindle.0.speed-out => cia402.0.velocity-cmd
net 0-spindleon-normal velo-pid.enable <= spindle.0.on => or2.0.in0
net 0-home-index spindle.0.index-enable => cia402.0.home
net 0-target-speed spindle.0.speed-out => velo-pid.command
net 0-orient pos-pid.enable <= spindle.0.orient => orient.0.enable => mux2.0.sel => or2.0.in1
net 0-spindleON or2.0.out => cia402.0.enable
net 0-angle spindle.0.orient-angle => orient.0.angle
net 0-orient_topos orient.0.command => pos-pid.command
net 0-pospid-tomux pos-pid.output => mux2.0.in1
net 0-velopid-tomux velo-pid.output => mux2.0.in0
net 0-muxtoabs-final-speed mux2.0.out => cia402.0.velocity-cmd
net 0-amp-fault spindle.0.amp-fault-in <= cia402.0.drv-fault
#from cia402 to servo
net 0-controlword cia402.0.controlword => lcec.0.0.cia-controlword
net 0-modes-of-operation cia402.0.opmode => lcec.0.0.opmode
net 0-drv-target-pos cia402.0.drv-target-position => lcec.0.0.target-position
net 0-drv-target-velo cia402.0.drv-target-velocity => lcec.0.0.target-velocity
#
# Joint 1
#
setp cia402.1.csp-mode 1
setp cia402.1.pos-scale 166
#from servo to cia402
net 1-statusword lcec.0.1.cia-statusword => cia402.1.statusword
net 1-opmode-display lcec.0.1.opmode-display => cia402.1.opmode-display
net 1-drv-act-pos lcec.0.1.actual-position => cia402.1.drv-actual-position
net 1-drv-act-velo lcec.0.1.actual-velocity => cia402.1.drv-actual-velocity
#from linuxcnc motion to cia402 / cia402 to motion
net 1-home-index joint.1.index-enable => cia402.1.home
net 1-enable joint.1.amp-enable-out => cia402.1.enable
net 1-amp-fault joint.1.amp-fault-in <= cia402.1.drv-fault
net 1-pos-cmd joint.1.motor-pos-cmd => cia402.1.pos-cmd
net 1-pos-fb joint.1.motor-pos-fb <= cia402.1.pos-fb
#from cia402 to servo
net 1-controlword cia402.1.controlword => lcec.0.1.cia-controlword
net 1-modes-of-operation cia402.1.opmode => lcec.0.1.opmode
net 1-drv-target-pos cia402.1.drv-target-position => lcec.0.1.target-position
net 1-drv-target-velo cia402.1.drv-target-velocity => lcec.0.1.target-velocity
Last edit: 11 Jul 2024 09:10 by timaer.
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 3970
- Thank you received: 1719
11 Jul 2024 09:50 #304889
by Aciera
Replied by Aciera on topic Ethercat servo spindle orient problem while using M19 ?
Besides the pins you were already watching also have a look at the 'orient' component pins:
linuxcnc.org/docs/html/man/man9/orient.9.html
This should verify if you are getting any useful signal to 'pos-pid.command'
I see that you have not connected 'orient.0.mode' to 'spindle.0.orient-mode'. Not sure if the 'orient' component has a default value for its 'mode'-pin but you may want to make the connection just to be sure.
Note that I know nothing about the EtherCAT side of things at all, including the 'cia402' component.
linuxcnc.org/docs/html/man/man9/orient.9.html
This should verify if you are getting any useful signal to 'pos-pid.command'
I see that you have not connected 'orient.0.mode' to 'spindle.0.orient-mode'. Not sure if the 'orient' component has a default value for its 'mode'-pin but you may want to make the connection just to be sure.
Note that I know nothing about the EtherCAT side of things at all, including the 'cia402' component.
The following user(s) said Thank You: timaer
Please Log in or Create an account to join the conversation.
- timaer
- Offline
- Premium Member
Less
More
- Posts: 82
- Thank you received: 4
11 Jul 2024 09:57 #304891
by timaer
Replied by timaer on topic Ethercat servo spindle orient problem while using M19 ?
Thank you,Aciera. I just followed the pin guide map in the following link wiki.linuxcnc.org/uploads/orient.svg , I dont know if I need to net the orient.mode and spindle.orient-mode,because it 's not mentioned in that link.
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 3970
- Thank you received: 1719
11 Jul 2024 10:18 #304892
by Aciera
Replied by Aciera on topic Ethercat servo spindle orient problem while using M19 ?
I guess you could verify by checking the value of the 'orient.0.mode' pin.
The following user(s) said Thank You: timaer
Please Log in or Create an account to join the conversation.
- timaer
- Offline
- Premium Member
Less
More
- Posts: 82
- Thank you received: 4
12 Jul 2024 01:37 #304956
by timaer
Replied by timaer on topic Ethercat servo spindle orient problem while using M19 ?
I've checked the 'orient.0.mode' pin value,it is always 0 no matter I executed M3S100 or M19R180, is it normal?
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
Less
More
- Posts: 1819
- Thank you received: 736
12 Jul 2024 17:07 #305012
by spumco
spindle.n.orient-mode outputs the M19 P-value (default 0) and should be connected to orient.n.mode.
Mine looks like this:
I think if that connection is left out of HAL orient.n.mode defaults to '0', but it doesn't hurt to have the connection. Otherwise if for some reason you want to restrict direction with an M19 P-value you won't be able to.
Below is my lathe spindle config with orient stuff that works. Step/dir servo motor.
The spindle.0.revs pin is necessary to synchronize my sub-spindle to the main spindle and is not required for orient. None of the 'loadrt' stuff is in there, but the pin names should be self-explanatory.
######################
## MAIN-SPINDLE ##
######################
#SPINDLE AMP FAULT CONNECTION
net SPIN0-AMP-FAULT => spindle.0.amp-fault-in #FROM 02IO.HAL
#SPINDLE ENCODER - INDEX SIGNAL
net SPIN0-INDEX-ENABLE <=> hm2_[MESA](BOARD).0.encoder.04.index-enable
net SPIN0-INDEX-ENABLE <=> spindle.0.index-enable
net SPIN0-INDEX-ENABLE <=> pid.s0.index-enable
net SPIN0-INDEX-ENABLE <=> pid.s0orient.index-enable
#SPINDLE ENCODER - VELOCITY SIGNAL
net SPIN0-VEL-FB-RPS <= hm2_[MESA](BOARD).0.encoder.04.velocity
net SPIN0-VEL-FB-RPS => spindle.0.speed-in #USED FOR CSS AND FEED PER REV
#SPINDLE ENCODER - VELOCITY-RPM SIGNAL
net SPIN0-VEL-FB-RPM <= hm2_[MESA](BOARD).0.encoder.04.velocity-rpm
net SPIN0-VEL-FB-RPM => pid.s0.feedback
#SPINDLE PID COMMAND
net SPIN0-ON <= spindle.0.on
net SPIN0-ON => pid.s0.enable
net SPIN0-VEL-CMD-RPS <= spindle.0.speed-out-rps
net SPIN0-VEL-CMD-RPS => pid.s0.command
#net SPIN0-VEL-CMD-RPM <= spindle.0.speed-out
#net SPIN0-VEL-CMD-RPM => pid.s0.command
net SPIN0-PID-OUTPUT <= pid.s0.output
#SPINDLE ORIENT CONNECTIONS
setp orient.s0.tolerance 0.5
net SPIN0-ORIENT-ANGLE <= spindle.0.orient-angle
net SPIN0-ORIENT-ANGLE => orient.s0.angle
net SPIN0-ORIENT-MODE <= spindle.0.orient-mode
net SPIN0-ORIENT-MODE => orient.s0.mode
net SPIN0-ORIENT-ENA <= spindle.0.orient
net SPIN0-ORIENT-ENA => orient.s0.enable
net SPIN0-ORIENT-ENA => pid.s0orient.enable
net SPIN0-IN-POS <= orient.s0.is-oriented
net SPIN0-IN-POS => spindle.0.is-oriented
net SPIN0-ORIENT-DONE <= spindle.0.locked #TO 02IO.HAL FOR MOTION.DIGITAL-IN
net SPIN0-POSITION <= hm2_[MESA](BOARD).0.encoder.04.position
net SPIN0-POSITION => spindle.0.revs #USED FOR SYNCHRONIZED SPINDLE MOVES
net SPIN0-POSITION => orient.s0.position
net SPIN0-POSITION => pid.s0orient.feedback
net SPIN0-ORIENT-CMD <= orient.s0.command
net SPIN0-ORIENT-CMD => pid.s0orient.command
net SPIN0-ORIENT-OUT <= pid.s0orient.output
#SWITCH BETWEEN SPINDLE AND ORIENT
net SPIN0-PID-OUTPUT => mux2.s0.in0 #SPINDLE PID OUTPUT
net SPIN0-ORIENT-OUT => mux2.s0.in1 #ORIENT PID OUTPUT
net SPIN0-ORIENT-ENA => mux2.s0.sel #ORIENT COMMAND
net SPIN0-OUTPUT <= mux2.s0.out #SELECTED OUTPUT
net SPIN0-OUTPUT => hm2_[MESA](BOARD).0.stepgen.06.velocity-cmd
net MACHINE-IS-ON => hm2_[MESA](BOARD).0.stepgen.06.enable
#FORCE ORIENT AT HOME-ALL
setp oneshot.s0orient.width 1
net ALL-HOMED <= motion.is-all-homed
net ALL-HOMED => oneshot.s0orient.in
net SPIN0-ORIENT-HOMEALL <= oneshot.s0orient.out
net SPIN0-ORIENT-HOMEALL => halui.mdi-command-00
#SPINDLE-AT-SPEED
net SPIN0-AT-SPEED => spindle.0.at-speed
#GUI SCALING
setp scale.s0.gain 60
setp lowpass.s0.gain 1.000000
net SPIN0-VEL-FB-RPS => scale.s0.in
net SPIN0-FB-RPM <= scale.s0.out
net SPIN0-FB-RPM => abs.s0.in
net SPIN0-FB-RPM-ABS <= abs.s0.out
net SPIN0-FB-RPM-ABS => lowpass.s0.in
net SPIN0-FB-RPM-ABS-FILTERED <= lowpass.s0.out #SIGNAL TO GUI RPM DISPLAY
#STEPGEN SETTINGS
setp hm2_[MESA](BOARD).0.stepgen.06.dirsetup [SPINDLE_0](DIRSETUP)
setp hm2_[MESA](BOARD).0.stepgen.06.dirhold [SPINDLE_0](DIRHOLD)
setp hm2_[MESA](BOARD).0.stepgen.06.steplen [SPINDLE_0](STEPLEN)
setp hm2_[MESA](BOARD).0.stepgen.06.stepspace [SPINDLE_0](STEPSPACE)
setp hm2_[MESA](BOARD).0.stepgen.06.position-scale [SPINDLE_0](SCALE)
setp hm2_[MESA](BOARD).0.stepgen.06.maxvel [SPINDLE_0](MAX_RPS)
setp hm2_[MESA](BOARD).0.stepgen.06.maxaccel [SPINDLE_0](MAX_ACCEL_RPS)
setp hm2_[MESA](BOARD).0.stepgen.06.control-type 1
#ENCODER SETTINGS
setp hm2_[MESA](BOARD).0.encoder.04.counter-mode 0
setp hm2_[MESA](BOARD).0.encoder.04.filter 0
setp hm2_[MESA](BOARD).0.encoder.04.index-invert 0
setp hm2_[MESA](BOARD).0.encoder.04.index-mask 0
setp hm2_[MESA](BOARD).0.encoder.04.index-mask-invert 0
setp hm2_[MESA](BOARD).0.encoder.04.scale [SPINDLE_0](ENCODER_SCALE) #2500/PPR
#SPINDLE PID SETTINGS
setp pid.s0.Pgain [SPINDLE_0]P
setp pid.s0.Igain [SPINDLE_0]I
setp pid.s0.Dgain [SPINDLE_0]D
setp pid.s0.bias [SPINDLE_0]BIAS
setp pid.s0.FF0 [SPINDLE_0]FF0
setp pid.s0.FF1 [SPINDLE_0]FF1
setp pid.s0.FF2 [SPINDLE_0]FF2
setp pid.s0.deadband [SPINDLE_0]DEADBAND
setp pid.s0.maxoutput [SPINDLE_0]MAX_OUTPUT
setp pid.s0.error-previous-target true
#ORIENT PID SETTINGS
setp pid.s0orient.Pgain [ORIENT_S0]P
setp pid.s0orient.Igain [ORIENT_S0]I
setp pid.s0orient.Dgain [ORIENT_S0]D
setp pid.s0orient.bias [ORIENT_S0]BIAS
setp pid.s0orient.FF0 [ORIENT_S0]FF0
setp pid.s0orient.FF1 [ORIENT_S0]FF1
setp pid.s0orient.FF2 [ORIENT_S0]FF2
setp pid.s0orient.FF3 [ORIENT_S0]FF3
setp pid.s0orient.deadband [ORIENT_S0]DEADBAND
setp pid.s0orient.maxoutput [ORIENT_S0]MAX_OUTPUT
setp pid.s0orient.error-previous-target true
Replied by spumco on topic Ethercat servo spindle orient problem while using M19 ?
M19 "P" indicates the direction mode. The default is '0' (bi-directional).I've checked the 'orient.0.mode' pin value,it is always 0 no matter I executed M3S100 or M19R180, is it normal?
spindle.n.orient-mode outputs the M19 P-value (default 0) and should be connected to orient.n.mode.
Mine looks like this:
net SPIN0-ORIENT-MODE <= spindle.0.orient-mode
net SPIN0-ORIENT-MODE => orient.s0.mode
I think if that connection is left out of HAL orient.n.mode defaults to '0', but it doesn't hurt to have the connection. Otherwise if for some reason you want to restrict direction with an M19 P-value you won't be able to.
Below is my lathe spindle config with orient stuff that works. Step/dir servo motor.
The spindle.0.revs pin is necessary to synchronize my sub-spindle to the main spindle and is not required for orient. None of the 'loadrt' stuff is in there, but the pin names should be self-explanatory.
Warning: Spoiler!
######################
## MAIN-SPINDLE ##
######################
#SPINDLE AMP FAULT CONNECTION
net SPIN0-AMP-FAULT => spindle.0.amp-fault-in #FROM 02IO.HAL
#SPINDLE ENCODER - INDEX SIGNAL
net SPIN0-INDEX-ENABLE <=> hm2_[MESA](BOARD).0.encoder.04.index-enable
net SPIN0-INDEX-ENABLE <=> spindle.0.index-enable
net SPIN0-INDEX-ENABLE <=> pid.s0.index-enable
net SPIN0-INDEX-ENABLE <=> pid.s0orient.index-enable
#SPINDLE ENCODER - VELOCITY SIGNAL
net SPIN0-VEL-FB-RPS <= hm2_[MESA](BOARD).0.encoder.04.velocity
net SPIN0-VEL-FB-RPS => spindle.0.speed-in #USED FOR CSS AND FEED PER REV
#SPINDLE ENCODER - VELOCITY-RPM SIGNAL
net SPIN0-VEL-FB-RPM <= hm2_[MESA](BOARD).0.encoder.04.velocity-rpm
net SPIN0-VEL-FB-RPM => pid.s0.feedback
#SPINDLE PID COMMAND
net SPIN0-ON <= spindle.0.on
net SPIN0-ON => pid.s0.enable
net SPIN0-VEL-CMD-RPS <= spindle.0.speed-out-rps
net SPIN0-VEL-CMD-RPS => pid.s0.command
#net SPIN0-VEL-CMD-RPM <= spindle.0.speed-out
#net SPIN0-VEL-CMD-RPM => pid.s0.command
net SPIN0-PID-OUTPUT <= pid.s0.output
#SPINDLE ORIENT CONNECTIONS
setp orient.s0.tolerance 0.5
net SPIN0-ORIENT-ANGLE <= spindle.0.orient-angle
net SPIN0-ORIENT-ANGLE => orient.s0.angle
net SPIN0-ORIENT-MODE <= spindle.0.orient-mode
net SPIN0-ORIENT-MODE => orient.s0.mode
net SPIN0-ORIENT-ENA <= spindle.0.orient
net SPIN0-ORIENT-ENA => orient.s0.enable
net SPIN0-ORIENT-ENA => pid.s0orient.enable
net SPIN0-IN-POS <= orient.s0.is-oriented
net SPIN0-IN-POS => spindle.0.is-oriented
net SPIN0-ORIENT-DONE <= spindle.0.locked #TO 02IO.HAL FOR MOTION.DIGITAL-IN
net SPIN0-POSITION <= hm2_[MESA](BOARD).0.encoder.04.position
net SPIN0-POSITION => spindle.0.revs #USED FOR SYNCHRONIZED SPINDLE MOVES
net SPIN0-POSITION => orient.s0.position
net SPIN0-POSITION => pid.s0orient.feedback
net SPIN0-ORIENT-CMD <= orient.s0.command
net SPIN0-ORIENT-CMD => pid.s0orient.command
net SPIN0-ORIENT-OUT <= pid.s0orient.output
#SWITCH BETWEEN SPINDLE AND ORIENT
net SPIN0-PID-OUTPUT => mux2.s0.in0 #SPINDLE PID OUTPUT
net SPIN0-ORIENT-OUT => mux2.s0.in1 #ORIENT PID OUTPUT
net SPIN0-ORIENT-ENA => mux2.s0.sel #ORIENT COMMAND
net SPIN0-OUTPUT <= mux2.s0.out #SELECTED OUTPUT
net SPIN0-OUTPUT => hm2_[MESA](BOARD).0.stepgen.06.velocity-cmd
net MACHINE-IS-ON => hm2_[MESA](BOARD).0.stepgen.06.enable
#FORCE ORIENT AT HOME-ALL
setp oneshot.s0orient.width 1
net ALL-HOMED <= motion.is-all-homed
net ALL-HOMED => oneshot.s0orient.in
net SPIN0-ORIENT-HOMEALL <= oneshot.s0orient.out
net SPIN0-ORIENT-HOMEALL => halui.mdi-command-00
#SPINDLE-AT-SPEED
net SPIN0-AT-SPEED => spindle.0.at-speed
#GUI SCALING
setp scale.s0.gain 60
setp lowpass.s0.gain 1.000000
net SPIN0-VEL-FB-RPS => scale.s0.in
net SPIN0-FB-RPM <= scale.s0.out
net SPIN0-FB-RPM => abs.s0.in
net SPIN0-FB-RPM-ABS <= abs.s0.out
net SPIN0-FB-RPM-ABS => lowpass.s0.in
net SPIN0-FB-RPM-ABS-FILTERED <= lowpass.s0.out #SIGNAL TO GUI RPM DISPLAY
#STEPGEN SETTINGS
setp hm2_[MESA](BOARD).0.stepgen.06.dirsetup [SPINDLE_0](DIRSETUP)
setp hm2_[MESA](BOARD).0.stepgen.06.dirhold [SPINDLE_0](DIRHOLD)
setp hm2_[MESA](BOARD).0.stepgen.06.steplen [SPINDLE_0](STEPLEN)
setp hm2_[MESA](BOARD).0.stepgen.06.stepspace [SPINDLE_0](STEPSPACE)
setp hm2_[MESA](BOARD).0.stepgen.06.position-scale [SPINDLE_0](SCALE)
setp hm2_[MESA](BOARD).0.stepgen.06.maxvel [SPINDLE_0](MAX_RPS)
setp hm2_[MESA](BOARD).0.stepgen.06.maxaccel [SPINDLE_0](MAX_ACCEL_RPS)
setp hm2_[MESA](BOARD).0.stepgen.06.control-type 1
#ENCODER SETTINGS
setp hm2_[MESA](BOARD).0.encoder.04.counter-mode 0
setp hm2_[MESA](BOARD).0.encoder.04.filter 0
setp hm2_[MESA](BOARD).0.encoder.04.index-invert 0
setp hm2_[MESA](BOARD).0.encoder.04.index-mask 0
setp hm2_[MESA](BOARD).0.encoder.04.index-mask-invert 0
setp hm2_[MESA](BOARD).0.encoder.04.scale [SPINDLE_0](ENCODER_SCALE) #2500/PPR
#SPINDLE PID SETTINGS
setp pid.s0.Pgain [SPINDLE_0]P
setp pid.s0.Igain [SPINDLE_0]I
setp pid.s0.Dgain [SPINDLE_0]D
setp pid.s0.bias [SPINDLE_0]BIAS
setp pid.s0.FF0 [SPINDLE_0]FF0
setp pid.s0.FF1 [SPINDLE_0]FF1
setp pid.s0.FF2 [SPINDLE_0]FF2
setp pid.s0.deadband [SPINDLE_0]DEADBAND
setp pid.s0.maxoutput [SPINDLE_0]MAX_OUTPUT
setp pid.s0.error-previous-target true
#ORIENT PID SETTINGS
setp pid.s0orient.Pgain [ORIENT_S0]P
setp pid.s0orient.Igain [ORIENT_S0]I
setp pid.s0orient.Dgain [ORIENT_S0]D
setp pid.s0orient.bias [ORIENT_S0]BIAS
setp pid.s0orient.FF0 [ORIENT_S0]FF0
setp pid.s0orient.FF1 [ORIENT_S0]FF1
setp pid.s0orient.FF2 [ORIENT_S0]FF2
setp pid.s0orient.FF3 [ORIENT_S0]FF3
setp pid.s0orient.deadband [ORIENT_S0]DEADBAND
setp pid.s0orient.maxoutput [ORIENT_S0]MAX_OUTPUT
setp pid.s0orient.error-previous-target true
The following user(s) said Thank You: timaer
Please Log in or Create an account to join the conversation.
- LinuxCNC
- General LinuxCNC Questions
- [resolved]Ethercat servo spindle orient problem while using M19 ?
Time to create page: 0.087 seconds