Re-evaluate Hal Parameters Each Repeat

More
15 Jan 2022 19:07 #231910 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?

Please Log in or Create an account to join the conversation.

More
15 Jan 2022 19:58 #231915 by rodw
Thats expected as the pins are not updated in real time
linuxcnc.org/docs/devel/html/gcode/overv...gcode:ini-hal-params

Please Log in or Create an account to join the conversation.

More
15 Jan 2022 20:22 - 15 Jan 2022 20:24 #231919 by HomemadeNJ
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
Last edit: 15 Jan 2022 20:24 by HomemadeNJ.

Please Log in or Create an account to join the conversation.

More
15 Jan 2022 20:35 #231921 by rodw
Read that link. There may be a workaround using M66

Please Log in or Create an account to join the conversation.

More
15 Jan 2022 20:36 #231922 by rodw
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.

More
15 Jan 2022 22:54 #231957 by MaHa
The only way to solve is, in .hal  for each pyvcp input something as
net travel-spinbox pyvcp.travel-spinbox motion.analog-in-01

and in the routine
M66 E1 L0
#1 = #5399

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

 

Please Log in or Create an account to join the conversation.

Time to create page: 0.091 seconds
Powered by Kunena Forum