Re-evaluate Hal Parameters Each Repeat
- HomemadeNJ
 - Offline
 - Junior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 27
 - Thank you received: 13
 
			
	
						15 Jan 2022 19:07				#231910
		by HomemadeNJ
	
	
		
			
	
			
			 		
													
	
				Re-evaluate Hal Parameters Each Repeat was created by HomemadeNJ			
			
				Been pulling my hair out on this one for the last few hours. I have the subroutine below that I pass some values to from pyvcp and a sum2 statement. What I'm seeing is that the values are grabbed once and then it repeats with those values. I'm trying to find a way to grab the parameters again after each loop. The Z movement is being incremented and I'll get the first stepdown but not any more. I'm taking an increment from pyvcp and adding it to the joint commanded position for the next move down.
o100 sub
#1 = #<_hal[pyvcp.travel-spinbox]>
#2 = #<_hal[pyvcp.travel_speed-spinbox]>
#3 = #<_hal[sum2.1.out]>
#4 = #<_hal[pyvcp.passes-spinbox]>
o101 repeat [#4]
G20
G1 X#1 F#2
G0 Z#3
G1 X0 F#2
G0 Z#3
o101 endrepeat
o100 endsub
M2
Any ideas here?
					o100 sub
#1 = #<_hal[pyvcp.travel-spinbox]>
#2 = #<_hal[pyvcp.travel_speed-spinbox]>
#3 = #<_hal[sum2.1.out]>
#4 = #<_hal[pyvcp.passes-spinbox]>
o101 repeat [#4]
G20
G1 X#1 F#2
G0 Z#3
G1 X0 F#2
G0 Z#3
o101 endrepeat
o100 endsub
M2
Any ideas here?
Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Away
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						15 Jan 2022 19:58				#231915
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic Re-evaluate Hal Parameters Each Repeat			
			
				Thats expected as the pins are not updated in real time
linuxcnc.org/docs/devel/html/gcode/overv...gcode:ini-hal-params
					linuxcnc.org/docs/devel/html/gcode/overv...gcode:ini-hal-params
Please Log in or Create an account to join the conversation.
- HomemadeNJ
 - Offline
 - Junior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 27
 - Thank you received: 13
 
			
	
						15 Jan 2022 20:22		 -  15 Jan 2022 20:24		#231919
		by HomemadeNJ
	
	
		
			
	
	
			 		
													
	
				Replied by HomemadeNJ on topic Re-evaluate Hal Parameters Each Repeat			
			
				Ah bummer about not being able to update them in real time
Was able to figure out the below and just increment and add to the original values from pyvcp. Works well but updating in real time would be sweet.
o100 sub
#1 = #<_hal[pyvcp.travel-spinbox]>
#2 = #<_hal[pyvcp.travel_speed-spinbox]>
#3 = #<_hal[sum2.1.out]>
#4 = #<_hal[pyvcp.passes-spinbox]>
#5 = 0
#6 = #<_hal[joint.1.pos-cmd]>
#7 = #<_hal[mult2.0.out]>
o101 while [#5 LT #4]
G20
G1 X#1 F#2
G0 Z#3
#3 = [#3+#7]
G1 X0 F#2
G0 Z#3
#5 = [#5+1]
#3 = [#3+#7]
o101 endwhile
o100 endsub
M2
					Was able to figure out the below and just increment and add to the original values from pyvcp. Works well but updating in real time would be sweet.
o100 sub
#1 = #<_hal[pyvcp.travel-spinbox]>
#2 = #<_hal[pyvcp.travel_speed-spinbox]>
#3 = #<_hal[sum2.1.out]>
#4 = #<_hal[pyvcp.passes-spinbox]>
#5 = 0
#6 = #<_hal[joint.1.pos-cmd]>
#7 = #<_hal[mult2.0.out]>
o101 while [#5 LT #4]
G20
G1 X#1 F#2
G0 Z#3
#3 = [#3+#7]
G1 X0 F#2
G0 Z#3
#5 = [#5+1]
#3 = [#3+#7]
o101 endwhile
o100 endsub
M2
		Last edit: 15 Jan 2022 20:24  by HomemadeNJ.			
			Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Away
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						15 Jan 2022 20:35				#231921
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic Re-evaluate Hal Parameters Each Repeat			
			
				Read that link. There may be a workaround using M66			
					Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Away
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						15 Jan 2022 20:36				#231922
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic Re-evaluate Hal Parameters Each Repeat			
			
				Actually probably won't help cos your GUI pins are not real time anyway.			
					Please Log in or Create an account to join the conversation.
- MaHa
 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 465
 - Thank you received: 197
 
			
	
						15 Jan 2022 22:54				#231957
		by MaHa
	
	
		
			
	
			
			 		
													
	
				Replied by MaHa on topic Re-evaluate Hal Parameters Each Repeat			
			
				The only way to solve is, in .hal  for each pyvcp input something as
and in the routine
If you do this before while/endwhile, should be no problem.
If you need more analog ins, num_aio= to increase, as example
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_aio=16
 			
					net travel-spinbox pyvcp.travel-spinbox motion.analog-in-01and in the routine
M66 E1 L0
#1 = #5399If you do this before while/endwhile, should be no problem.
If you need more analog ins, num_aio= to increase, as example
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_aio=16
Please Log in or Create an account to join the conversation.
		Time to create page: 0.075 seconds