Ethercat Servo spindle orient example required
- snujcnc
- 
				 Topic Author Topic Author
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 71
- Thank you received: 4
			
	
						01 Dec 2019 09:52				#151645
		by snujcnc
	
	
		
			
	
			
			 		
													
	
				Ethercat Servo spindle orient example required was created by snujcnc			
			
				Hi
I am working on ethercat servo which work well on axis
i can run ethercat servo spindle with s and m command ,
when i try to setup spindle orient function i fail every time
if anyone work on ethercat servo spindle with orient function working please share data .
i read many post about spindle orient but all are for different typpe for ready to use card for linuxcnc , i want setting for ethercat servo spindle
					I am working on ethercat servo which work well on axis
i can run ethercat servo spindle with s and m command ,
when i try to setup spindle orient function i fail every time
if anyone work on ethercat servo spindle with orient function working please share data .
i read many post about spindle orient but all are for different typpe for ready to use card for linuxcnc , i want setting for ethercat servo spindle
Please Log in or Create an account to join the conversation.
- andypugh
- 
				  
- Offline
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 19677
- Thank you received: 4554
			
	
						02 Dec 2019 14:49				#151753
		by andypugh
	
	
		
			
	
			
			 		
													
	
				Replied by andypugh on topic Ethercat Servo spindle orient example required			
			
				Does your spindle have orient built-in, or do you need to use a PID and velocity commands?			
					Please Log in or Create an account to join the conversation.
- snujcnc
- 
				 Topic Author Topic Author
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 71
- Thank you received: 4
			
	
						05 Dec 2019 04:01				#152041
		by snujcnc
	
	
		
			
	
			
			 		
													
	
				Replied by snujcnc on topic Ethercat Servo spindle orient example required			
			
				I want to use PID and velocity command
(i also want to know about built in orient function in spindle drive)
					(i also want to know about built in orient function in spindle drive)
Please Log in or Create an account to join the conversation.
- andypugh
- 
				  
- Offline
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 19677
- Thank you received: 4554
			
	
						05 Dec 2019 13:18				#152062
		by andypugh
	
	
		
			
	
	
			 		
													
	
				Replied by andypugh on topic Ethercat Servo spindle orient example required			
			
				If you need to use PID to orient the spindle then I think that things look almost identical to any other spindle orient setup, except that the final output is a velocuty command on EtherCAT rather than a velocity command to a PWM generator.			
					
		The following user(s) said Thank You: snujcnc 	
			Please Log in or Create an account to join the conversation.
- snujcnc
- 
				 Topic Author Topic Author
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 71
- Thank you received: 4
			
	
						30 Dec 2019 04:20				#153540
		by snujcnc
	
	
		
			
	
			
			 		
													
	
				Replied by snujcnc on topic Ethercat Servo spindle orient example required			
			
				thank you
i tried to make orient working but i face issue with orient output ,
output is not working ok because wrong setting in pid
can you share any working orient setup so i can try to understand
					i tried to make orient working but i face issue with orient output ,
output is not working ok because wrong setting in pid
can you share any working orient setup so i can try to understand
Please Log in or Create an account to join the conversation.
- andypugh
- 
				  
- Offline
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 19677
- Thank you received: 4554
			
	
						07 Jan 2020 22:28				#154268
		by andypugh
	
	
		
			
	
			
			 		
													
	
				Replied by andypugh on topic Ethercat Servo spindle orient example required			
			
				Can you post your HAL file?			
					Please Log in or Create an account to join the conversation.
- snujcnc
- 
				 Topic Author Topic Author
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 71
- Thank you received: 4
			
	
						03 Mar 2020 03:18				#159061
		by snujcnc
	
	
		
			
	
			
			 		
													
	
				Replied by snujcnc on topic Ethercat Servo spindle orient example required			
			
				## scale
loadrt scale count=1
addf scale.0 servo-thread
setp scale.0.gain 0.0083
net spindle-speed-scale motion.spindle-speed-out => scale.0.in
net spindle-cmd-rpm <= scale.0.out
#net spindle-cmd-rpm => lcec.0.1.srv-vel-cmd
net spindle-on <= motion.spindle-on
### MUX2 ###
loadrt mux2 count=1
addf mux2.0 servo-thread
net orient-enable => mux2.0.sel
net orient-output => mux2.0.in1
net spindle-cmd-rpm => mux2.0.in0
net comand-to-drive mux2.0.out => lcec.0.1.srv-vel-cmd
loadrt invert count=1
addf invert.0 servo-thread
###########################################################
# motion interface
###########################################################
#spindle POSITION control
net spindle-encoder-raw-val conv-s32-float.0.in <= lcec.0.0.mop-spindle-encoder-raw-val
net spdl_encoder_pos motion.spindle-revs <= conv-s32-float.0.out
#spindle VELOCITY control
setp lcec.0.0.mop-encoder-scale 512
setp lcec.0.0.mop-spindle-ppr-val 20480
net speed-in lcec.0.0.mop-rps-raw-val => motion.spindle-speed-in
net spindle-index motion.spindle-index-enable <=> lcec.0.0.led-29-raw
net orient-enable => orient.enable
net orient-angle => orient.angle
net orient-mode => orient.mode
net orient-cmd-pid => orient.command
net spdl_encoder_pos => orient.position
net orient-enable <= motion.spindle-orient
net orient-angle <= motion.spindle-orient-angle
net orient-mode <= motion.spindle-orient-mode
#PID.0
setp pid.0.Pgain 1.0
setp pid.0.Igain 0.01
setp pid.0.Dgain 0.0
setp pid.0.FF0 0.0
setp pid.0.FF1 0.0
setp pid.0.FF2 0.0
#setp pid.0.bias
net spindle-cmd-rpm => pid.0.command ###
#pid.0.command-deriv
setp pid.0.deadband 0.1
net orient-enable => pid.0.enable ###
# pid.0.error
# pid.0.error-previous-target
net spdl_encoder_pos => pid.0.feedback
# pid.0.feedback-deriv
net spindle-index lcec.0.0.mop-spindle-index => pid.0.index-enable
# pid.0.maxcmdD 20.0
# pid.0.maxcmdDD
#setp pid.0.maxerror
#setp pid.0.maxerrorD
# pid.0.maxerrorI 20.0
net orient-output => pid.0.output
#setp pid.0.maxoutput 0.5
#net orient-output => invert.0.out
#net inv invert.0.in => pid.0.output
#pid.0.saturated
#pid.0.saturated-count
#pid.0.saturated-s
					loadrt scale count=1
addf scale.0 servo-thread
setp scale.0.gain 0.0083
net spindle-speed-scale motion.spindle-speed-out => scale.0.in
net spindle-cmd-rpm <= scale.0.out
#net spindle-cmd-rpm => lcec.0.1.srv-vel-cmd
net spindle-on <= motion.spindle-on
### MUX2 ###
loadrt mux2 count=1
addf mux2.0 servo-thread
net orient-enable => mux2.0.sel
net orient-output => mux2.0.in1
net spindle-cmd-rpm => mux2.0.in0
net comand-to-drive mux2.0.out => lcec.0.1.srv-vel-cmd
loadrt invert count=1
addf invert.0 servo-thread
###########################################################
# motion interface
###########################################################
#spindle POSITION control
net spindle-encoder-raw-val conv-s32-float.0.in <= lcec.0.0.mop-spindle-encoder-raw-val
net spdl_encoder_pos motion.spindle-revs <= conv-s32-float.0.out
#spindle VELOCITY control
setp lcec.0.0.mop-encoder-scale 512
setp lcec.0.0.mop-spindle-ppr-val 20480
net speed-in lcec.0.0.mop-rps-raw-val => motion.spindle-speed-in
net spindle-index motion.spindle-index-enable <=> lcec.0.0.led-29-raw
net orient-enable => orient.enable
net orient-angle => orient.angle
net orient-mode => orient.mode
net orient-cmd-pid => orient.command
net spdl_encoder_pos => orient.position
net orient-enable <= motion.spindle-orient
net orient-angle <= motion.spindle-orient-angle
net orient-mode <= motion.spindle-orient-mode
#PID.0
setp pid.0.Pgain 1.0
setp pid.0.Igain 0.01
setp pid.0.Dgain 0.0
setp pid.0.FF0 0.0
setp pid.0.FF1 0.0
setp pid.0.FF2 0.0
#setp pid.0.bias
net spindle-cmd-rpm => pid.0.command ###
#pid.0.command-deriv
setp pid.0.deadband 0.1
net orient-enable => pid.0.enable ###
# pid.0.error
# pid.0.error-previous-target
net spdl_encoder_pos => pid.0.feedback
# pid.0.feedback-deriv
net spindle-index lcec.0.0.mop-spindle-index => pid.0.index-enable
# pid.0.maxcmdD 20.0
# pid.0.maxcmdDD
#setp pid.0.maxerror
#setp pid.0.maxerrorD
# pid.0.maxerrorI 20.0
net orient-output => pid.0.output
#setp pid.0.maxoutput 0.5
#net orient-output => invert.0.out
#net inv invert.0.in => pid.0.output
#pid.0.saturated
#pid.0.saturated-count
#pid.0.saturated-s
Please Log in or Create an account to join the conversation.
- andypugh
- 
				  
- Offline
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 19677
- Thank you received: 4554
			
	
						05 Mar 2020 14:10		 -  05 Mar 2020 14:11		#159256
		by andypugh
	
	
		
			
	
	
			 		
													
	
				Replied by andypugh on topic Ethercat Servo spindle orient example required			
			
				Are you sure about this?
Is the raw-val a number scaled in counts? If it is then converting to a float won't give you spindle position.
motion.spindle-revs needs to increase by exactly 1.0 for each spindle rotation. You should be able to test this with halmeter.
					net spindle-encoder-raw-val conv-s32-float.0.in <= lcec.0.0.mop-spindle-encoder-raw-val
net spdl_encoder_pos motion.spindle-revs <= conv-s32-float.0.outIs the raw-val a number scaled in counts? If it is then converting to a float won't give you spindle position.
motion.spindle-revs needs to increase by exactly 1.0 for each spindle rotation. You should be able to test this with halmeter.
		Last edit: 05 Mar 2020 14:11  by andypugh.			
			Please Log in or Create an account to join the conversation.
- snujcnc
- 
				 Topic Author Topic Author
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 71
- Thank you received: 4
			
	
						06 Mar 2020 14:05		 -  06 Mar 2020 14:13		#159332
		by snujcnc
	
	
		
			
	
	
			 		
													
	
				Replied by snujcnc on topic Ethercat Servo spindle orient example required			
			
				i repaired my fault as you mentioned
thanks for help
now i can do orientation
					thanks for help
now i can do orientation
		Last edit: 06 Mar 2020 14:13  by snujcnc.			
			Please Log in or Create an account to join the conversation.
- snujcnc
- 
				 Topic Author Topic Author
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 71
- Thank you received: 4
			
	
						07 Mar 2020 03:51				#159368
		by snujcnc
	
	
		
			
	
			
			 		
													
	
				Replied by snujcnc on topic Ethercat Servo spindle orient example required			
			
				One more question for orient holding
Torque after m19r0
1 which pid parameter responsible for increase holding torque after orient position arrive
(I use KEB vfd and want to add some torque ,I try to adjust p I d gain but no success)
Currently I set pid gain 500
And deadband 0.001
Maximum output 1000
All other parameter I set zero
Thanks
					Torque after m19r0
1 which pid parameter responsible for increase holding torque after orient position arrive
(I use KEB vfd and want to add some torque ,I try to adjust p I d gain but no success)
Currently I set pid gain 500
And deadband 0.001
Maximum output 1000
All other parameter I set zero
Thanks
Please Log in or Create an account to join the conversation.
		Time to create page: 0.088 seconds	
