VMC related HAL questions.
- thewho
 - Offline
 - Senior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 70
 - Thank you received: 2
 
			
	
						04 May 2015 23:06				#58378
		by thewho
	
	
		
			
	
	
			
			 		
													
	
				VMC related HAL questions. was created by thewho			
			
				My previous topic in "Driver Boards" went a little off topic with a lot of HAL related questions.
So I thought it was time to start a new in the correct (hopefully) section of the forum.
I'm slowly getting closer to knowing how hal is done. Not good enough to write anything myself yet though
Quick info:
Machine: Modig MD5000 -85
Spindle: SK40 5krpm max, Lenze 4902 DC spindle drive (+/-10V control)
Control: Mesa 5i25+7i77
My most prominent problem at the moment is spindle speed compensation. Or lack of.. As seen in the picture below.
Andypugh pointed me to this wiki page:
wiki.linuxcnc.org/cgi-bin/wiki.pl?SpindleOrient
Witch sadly doesn't help me (and my limited hal knowledge) much
I've attached my .ini and -hal files if they are of any interest.
So can somebody help me?
			
					So I thought it was time to start a new in the correct (hopefully) section of the forum.
I'm slowly getting closer to knowing how hal is done. Not good enough to write anything myself yet though
Quick info:
Machine: Modig MD5000 -85
Spindle: SK40 5krpm max, Lenze 4902 DC spindle drive (+/-10V control)
Control: Mesa 5i25+7i77
My most prominent problem at the moment is spindle speed compensation. Or lack of.. As seen in the picture below.
Andypugh pointed me to this wiki page:
wiki.linuxcnc.org/cgi-bin/wiki.pl?SpindleOrient
Witch sadly doesn't help me (and my limited hal knowledge) much
I've attached my .ini and -hal files if they are of any interest.
So can somebody help me?
Please Log in or Create an account to join the conversation.
- thewho
 - Offline
 - Senior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 70
 - Thank you received: 2
 
			
	
						09 May 2015 04:13				#58516
		by thewho
	
	
		
			
	
			
			 		
													
	
				Replied by thewho on topic VMC related HAL questions.			
			
				I've been reading up on the hal documentation and It's not that hard when you understand how it works.
But "spindle closed loop control" might be a little to advanced to start with
The "Spindle Orientation" schematic makes a lot more sense now at least
Can the spindles two pid's be tuned via Linuxcnc? (cant remember what the tool is called) Or do I have to change the settings in the hal file?
					But "spindle closed loop control" might be a little to advanced to start with
The "Spindle Orientation" schematic makes a lot more sense now at least
Can the spindles two pid's be tuned via Linuxcnc? (cant remember what the tool is called) Or do I have to change the settings in the hal file?
Please Log in or Create an account to join the conversation.
- thewho
 - Offline
 - Senior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 70
 - Thank you received: 2
 
			
	
						15 May 2015 03:24				#58705
		by thewho
	
	
		
			
	
			
			 		
													
	
				Replied by thewho on topic VMC related HAL questions.			
			
				Can I modify and use this on my machine?
wiki.linuxcnc.org/cgi-bin/wiki.pl?Closed...pindle_Speed_Control
					wiki.linuxcnc.org/cgi-bin/wiki.pl?Closed...pindle_Speed_Control
Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						15 May 2015 17:36		 -  15 May 2015 17:38		#58723
		by andypugh
	
	
		
			
				
The Vismach model that I am playing with now has a closed-loop velocity spindle with orient (using M19)
so the HAL code to implement t this HAL diagram now exists as an example.
Unforunately it only exists on my machine at home.
If I get chance I will nip home at lunchtime and post it here. (as I am away all weekend)
					
	
	
			 		
													
	
				Replied by andypugh on topic VMC related HAL questions.			
			Can I modify and use this on my machine?
wiki.linuxcnc.org/cgi-bin/wiki.pl?Closed...pindle_Speed_Control
The Vismach model that I am playing with now has a closed-loop velocity spindle with orient (using M19)
so the HAL code to implement t this HAL diagram now exists as an example.
Unforunately it only exists on my machine at home.
If I get chance I will nip home at lunchtime and post it here. (as I am away all weekend)
		Last edit: 15 May 2015 17:38  by andypugh.			
	
		The following user(s) said Thank You: akb1212 	
			Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						15 May 2015 19:09		 -  21 Jul 2015 23:14		#58732
		by andypugh
	
	
		
			
	
	
	
			 		
													
	
				Replied by andypugh on topic VMC related HAL questions.			
			
				This is the complete simulated VMC (so far).
It will start up, home and run G-code.
It will also rotate the simulated spindle and respond to M19 commands.
Note that the orient component only updates outputs when motion.spindle-orient goes true from false, so to change orient angle you have to start the spindle and move it fractionally.
So,
M19 R45
M3 S10
M19 R180
Will work. (I might look at modifying "orient")
Tool changing is a work-in-progress. At the moment M6 is remapped to call an O-word subroutine, but the subroutine still does very little. 
The G-code routine now does a complete tool change cycle for the simulated machine, but anyone using this code should make absolutely sure that it does all the necessary things in the right sequence for their hardware. Errors could be costly, but I am not in a position to test this code on your actual machine.
Extract the VMC.zip file into the configs folder and you should get a new config to choose in the LinuxCNC config picker.
You will need to give the "vmcgui" file execute permissions for the config to work.
(right-click, properties, permissions, from the file manager)
(Update 18 July) The carousel component now supports position-pulse + index mode
					It will start up, home and run G-code.
It will also rotate the simulated spindle and respond to M19 commands.
Note that the orient component only updates outputs when motion.spindle-orient goes true from false, so to change orient angle you have to start the spindle and move it fractionally.
So,
M19 R45
M3 S10
M19 R180
Will work. (I might look at modifying "orient")
The G-code routine now does a complete tool change cycle for the simulated machine, but anyone using this code should make absolutely sure that it does all the necessary things in the right sequence for their hardware. Errors could be costly, but I am not in a position to test this code on your actual machine.
Extract the VMC.zip file into the configs folder and you should get a new config to choose in the LinuxCNC config picker.
You will need to give the "vmcgui" file execute permissions for the config to work.
(right-click, properties, permissions, from the file manager)
(Update 18 July) The carousel component now supports position-pulse + index mode
		Last edit: 21 Jul 2015 23:14  by andypugh.			
	
		The following user(s) said Thank You: akb1212 	
			Please Log in or Create an account to join the conversation.
- thewho
 - Offline
 - Senior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 70
 - Thank you received: 2
 
			
	
						19 May 2015 03:48				#58832
		by thewho
	
	
		
			
	
			
			 		
													
	
				Replied by thewho on topic VMC related HAL questions.			
			
				I understand that Linuxcnc can "do it all" if you know what you are doing. But why isn't things like closed loop spindle control built in? Almost every machine controlled by Linuxcnc has a rotating spindle of some sort, yes I know that only a few have some sort of spindle position feedback but still..
Is it a time/prio thing?
Same with Pncconf, it's a great tool but I feel it could do so much more.
Thanks again Andy for helping newbies like me
			
					Is it a time/prio thing?
Same with Pncconf, it's a great tool but I feel it could do so much more.
Thanks again Andy for helping newbies like me
Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						19 May 2015 04:04				#58835
		by andypugh
	
	
		
			
				
It isn't generally necessary, for one thing. Exact spindle speed isn't that important. Before VFDs machines would only run at 6 or 8 fixed speeds, and nobody worried about it too much.
Even now, you don't particularly care about exact speed, just too fast and too slow.
					
	
			
			 		
													
	
				Replied by andypugh on topic VMC related HAL questions.			
			But why isn't things like closed loop spindle control built in?
It isn't generally necessary, for one thing. Exact spindle speed isn't that important. Before VFDs machines would only run at 6 or 8 fixed speeds, and nobody worried about it too much.
Even now, you don't particularly care about exact speed, just too fast and too slow.
Please Log in or Create an account to join the conversation.
- BigJohnT
 - 
				
											 - Offline
 - Administrator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 3990
 - Thank you received: 994
 
			
	
						19 May 2015 18:18				#58856
		by BigJohnT
	
	
		
			
				
If only you knew how complex Pncconf is and how many thousands of hours the author spent writing it.
Spindle feedback is in the manual.
JT
					
	
			
			 		
													
	
				Replied by BigJohnT on topic VMC related HAL questions.			
			Is it a time/prio thing?
Same with Pncconf, it's a great tool but I feel it could do so much more.
If only you knew how complex Pncconf is and how many thousands of hours the author spent writing it.
Spindle feedback is in the manual.
JT
Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						19 May 2015 22:56				#58862
		by andypugh
	
	
		
			
	
			
			 		
													
	
				Replied by andypugh on topic VMC related HAL questions.			
			
					Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						20 May 2015 06:39				#58879
		by andypugh
	
	
		
			
	
	
			 		
													
	
				Replied by andypugh on topic VMC related HAL questions.			
			
				OK, I now have the whole thing working. In the end I settled on a G-code subroutine for the tool-change sequence after finding a serious design flaw in my sequencer component.
This is a video of the tool change in action:
And here is the G-code that does the change.			
					This is a video of the tool change in action:
And here is the G-code that does the change.
o<toolchange> sub
M19 R0  ;align the spindle
; only unload the tool if there is a tool in the spindle
; This assumes that the carousel is already aligned correctly. 
; It is important to unload the tool before shutting down the machine. 
O100 IF [#<tool_in_spindle> GT 0]
    G53 G0 Z -100
    
    M64 P2 ; move arm in
    M66 P2 L3 Q5 ; wait for arm-in = true
    O104 if [#5399 LT 0]
        (abort, failed to move arm in)
    O104 endif
    M64 P3 ; release tool
    M66 P3 L3 Q2 ; wait for tool-released = true
    O105 if [#5399 LT 0]
        (abort, failed to release tool)
    O105 endif
O100 ENDIF
    G53 G0 Z0
O200 IF [#<selected_tool> GT 0]
    M65 P1 ; unlock carousel
    M66 P1 L4 Q1 ; wait for locked=false
    O106 if [#5399 LT 0]
        (abort, failed to unlock carousel)
    O106 endif
    M68 E0 Q#<selected_pocket> ;set the carousel to move to the right pocket
    M64 P0 ; start carousel
    G4 P2
    M66 P0 L3 Q60 ; wait for carousel finished
    O107 if [#5399 LT 0]
        (abort, failed to align carousel)
    O107 endif
    M65 P0; stop carousel
    M64 P1 ; lock carousel
    M66 P1 L3 Q1 ; wait for locked=true
    O108 if [#5399 LT 0]
        (abort, failed to lock carousel)
    O108 endif
    M64 P2 ; move arm in (might already be in)
    M66 P2 L3 Q5 ; wait for arm-in = true
    O109 if [#5399 LT 0]
        (abort, failed to move arm in)
    O109 endif
    G53 G0 Z-100 ; pick up the tool
O200 ENDIF 
M65 P3 ; clamp tool
M66 P3 L4 Q2 ; wait for tool-released = false
O110 if [#5399 LT 0]
    (abort, failed to clamp tool)
O110 endif
M65 P2 ; move arm back out
M66 P4 L3 Q5 ; wait for arm-out = true
O111 if [#5399 LT 0]
    (abort, failed to move arm in)
O111 endif
o<toolchange> endsub [1]
M2
		The following user(s) said Thank You: akb1212, sspeed33317, SRDC 	
			Please Log in or Create an account to join the conversation.
		Time to create page: 0.138 seconds