- Configuring LinuxCNC
 - Advanced Configuration
 - Help getting carousel to continue rotation after encoder position reached
 
Help getting carousel to continue rotation after encoder position reached
- kinghpole
 - Offline
 - Junior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 20
 - Thank you received: 0
 
			
	
						27 Aug 2023 20:13				#279113
		by kinghpole
	
	
		
			
	
	
			
			 		
													
	
				Help getting carousel to continue rotation after encoder position reached was created by kinghpole			
			
				Hi I’m trying to get the tool turret of an Emco PC Turn 120 working using the carousel component the PC Turn 120 uses from I can tell a fairly unique "encoder" to measure the turret position it uses a ring with a 90 degree cut out that rotates through 4 optical limit switches measure the position of the turret I've attach a picture to help visualize it. I set up a carousel instance to read the encoder as a binary encoder and then use the remap to convert the called pocket to the binary value for the encoder to have carousel rotate to. The problem I'm running into is to lock the turret it needs to rotate slightly past when the encoder reads its in the correct position and then rotate back to engage the ratchet type locking mechanism. I’m currently looking for a way to get carousel to do that. I'd appreciate any insights into the problem and help with fixing it thanks.			
					Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						28 Aug 2023 13:28				#279169
		by andypugh
	
	
		
			
	
			
			 		
													
	
				Replied by andypugh on topic Help getting carousel to continue rotation after encoder position reached			
			
				Which version of linuxCNC are you using?
The latest version of carousel (in the pre-release 2.9 version) has some extra pins:
carousel.N.align-dc float in
Use this pin to set the speed of a slower alignment move once the changer is in position. Such a system almost certainly needs decel-time setting too
carousel.N.decel-time float in
Time to wait for carousel to stop before final alignment and position check
These might help.
If you are running the 2.8 version then you can download the carousel.comp file from 2.9 and compile/install it with the "halcompile" utility.
					The latest version of carousel (in the pre-release 2.9 version) has some extra pins:
carousel.N.align-dc float in
Use this pin to set the speed of a slower alignment move once the changer is in position. Such a system almost certainly needs decel-time setting too
carousel.N.decel-time float in
Time to wait for carousel to stop before final alignment and position check
These might help.
If you are running the 2.8 version then you can download the carousel.comp file from 2.9 and compile/install it with the "halcompile" utility.
Please Log in or Create an account to join the conversation.
- kinghpole
 - Offline
 - Junior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 20
 - Thank you received: 0
 
			
	
						28 Aug 2023 18:30				#279191
		by kinghpole
	
	
		
			
	
			
			 		
													
	
				Replied by kinghpole on topic Help getting carousel to continue rotation after encoder position reached			
			
				I'm using version 2.9.0~pre1. I tried changing the carousel.N.decel-time but didn't see any change in operation could you possibly explain how to use those pins?			
					Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						28 Aug 2023 20:38		 -  28 Aug 2023 20:38		#279207
		by andypugh
	
	
		
			
	
	
			 		
													
	
				Replied by andypugh on topic Help getting carousel to continue rotation after encoder position reached			
			
				Looking at the code, I think I see two possible ways to do this:
github.com/LinuxCNC/linuxcnc/blob/master...s/carousel.comp#L391
If either will work will depend on how you are controlling the motor. If you are only using motor_vel and ignoring motor-fwd and motor-rev then setting a timed reverse pulse with a _forward_ duty cycle might do the trick.
However you do need a reverse pulse with your changer, so then it is a question of whether the hold-dc will do that part.
The other option seems to be to have a very long debounce time.
					github.com/LinuxCNC/linuxcnc/blob/master...s/carousel.comp#L391
If either will work will depend on how you are controlling the motor. If you are only using motor_vel and ignoring motor-fwd and motor-rev then setting a timed reverse pulse with a _forward_ duty cycle might do the trick.
However you do need a reverse pulse with your changer, so then it is a question of whether the hold-dc will do that part.
The other option seems to be to have a very long debounce time.
		Last edit: 28 Aug 2023 20:38  by andypugh.			
			Please Log in or Create an account to join the conversation.
- kinghpole
 - Offline
 - Junior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 20
 - Thank you received: 0
 
			
	
						30 Aug 2023 04:17				#279343
		by kinghpole
	
	
		
			
	
			
			 		
													
	
				Replied by kinghpole on topic Help getting carousel to continue rotation after encoder position reached			
			
				Trying to change the debounce time, I got an error saying the parameter was not editable. After that, I looked at the .comp file and realized adding a new forward pulse pin and having it trigger before the reverse pulse was achievable so I recompiled the .so file with a forward pulse and now it works.			
					Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						30 Aug 2023 08:52		 -  30 Aug 2023 08:58		#279356
		by andypugh
	
	
		
			
				
It should be a read/write parameter that can be "setp" in the HAL file:
Glad you got it working, but I would have preferred to find an answer that works for everyone.
 
(edit) Though mis-using the debounce probably isn't a great solution
					
	
	
			 		
													
	
				Replied by andypugh on topic Help getting carousel to continue rotation after encoder position reached			
			Trying to change the debounce time, I got an error saying the parameter was not editable.
It should be a read/write parameter that can be "setp" in the HAL file:
param rw unsigned debounce "How many thread cycles to wait for the position to stabilise";Glad you got it working, but I would have preferred to find an answer that works for everyone.
(edit) Though mis-using the debounce probably isn't a great solution
		Last edit: 30 Aug 2023 08:58  by andypugh.			
			Please Log in or Create an account to join the conversation.
- kinghpole
 - Offline
 - Junior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 20
 - Thank you received: 0
 
			
	
						31 Aug 2023 00:21				#279426
		by kinghpole
	
	
		
			
	
			
			 		
													
	
				Replied by kinghpole on topic Help getting carousel to continue rotation after encoder position reached			
			
				Debounce was not editable for me it gave me an error when I tried to change it in the halfile. This is probably not the place to make a feature request, but having a forward pulse would be really useful for any ratcheting tool turrets that use an encoder that has the same resolution as positions.			
					Please Log in or Create an account to join the conversation.
- Configuring LinuxCNC
 - Advanced Configuration
 - Help getting carousel to continue rotation after encoder position reached
 
		Time to create page: 0.219 seconds