QtPyVcp - Rules Expressions

More
30 Nov 2019 14:34 #151569 by Donb9261
Is there a doc for all the rules expressions possible based on the setup for QtPyVCP?

I have some ideas and would like to know to what extent expressions can support them.


Thanks

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

More
30 Nov 2019 14:50 #151571 by Leon82
Replied by Leon82 on topic QtPyVcp - Rules Expressions
There are a few examples in the documentation and tutorial but I would also be interested in that
The following user(s) said Thank You: Donb9261

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

More
03 Dec 2019 00:13 #151791 by BigJohnT
Expressions are based on Python expressions, so usually any valid Python expression will work.

JT
The following user(s) said Thank You: Donb9261

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

More
04 Dec 2019 21:16 #152022 by Donb9261
Thanks JT.

So far digging the QtPyVCP aspect.

Is there a doc to explain from step 1 to step nth on how to work with the hal widgets? It seems like it should be rather cut and dry but I am finding it difficult to know where to start.

Let's say I have a vacuum pump. I need to turn it via a hal pin. Then once vacuum is established I need some feedback from a vacuum sensor through a hal in.

So say my out is digital.0.out1.

and my sensor is digital.0.in1.

Pretty easy stuff.

Now I need to insert a HalButtonWidget to turn on my pump. And I would either use a HalButton as an indicator or a HalLED as an indicator to show status of the pressure switch.

I would also need to disable the Cycle Start button unless the vacuum sensor in is high.

How would I set up the Hal. Through just the vcp?.hal. Through custom.hal.? postgui.hal? halui? Kinda confusing as to what file should be used.

Then once I have the hal file set right... How do I use the widgets to tie the hal to the button and led?

I am very very very experienced with Fanuc, Siemens, and Heidenhain (Modified Linuxcnc btw..) as I have been in the CNC machine tool industry for 30+ years as a field engineer for OEM's.

Just need a shove in the right direction.

Any help will be returned if you need my brain for anything. I do applications(programming), full integration of robotics, Renishaw, Blum... If it goes on a million dollar CNC, I am 100% sure I can help.

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

More
04 Dec 2019 22:49 #152029 by BigJohnT
Have you gone through the QtPyVCP tutorials?
qtpyvcp.kcjengr.com/tutorials/index.html

As for not enabling the cycle start unless some condition is met could be done in hal or with a rule that evaluates to a bool and use that to control the enable of the button. I'd have to go down to the basement and check the exact syntax on my development pc... I'm answering this in windblows.

JT
The following user(s) said Thank You: Donb9261

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

More
05 Dec 2019 00:33 #152031 by Donb9261
No worries brother. Lol. Yeah Windows sucks for sure. I had originally dev on windows and found that if I wanted death by a thousand paper cuts that is the way to go.

Appreciate the reach back.

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

More
05 Dec 2019 21:03 #152110 by newbynobi
This can be done in pure Hal. You need to connect the enable feature of the button to the in pin.

Norbert
The following user(s) said Thank You: Donb9261

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

More
05 Dec 2019 21:06 #152111 by Donb9261
Yes I understood that part. But how do you connect hal to the ui? Name the HalButton the same as the pin alias? Etc...

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

More
06 Dec 2019 23:48 - 06 Dec 2019 23:56 #152196 by BigJohnT
Been pretty busy but managed to cobble up and example of how to do that in hal.

Create a hal pushbutton (I named it halbutton and give it a name that makes sense and make it checkable.

I used a hal checkbox to simulate the hardware input.

In your postgui.hal file add something like the following using your names.
# add an and gate for the two conditions needed to turn on power to the machine
loadrt and2 names=power_on
addf power_on servo-thread

# add a not so when one condition is off the power is shut off
loadrt not names=power_off
addf power_off servo-thread

# net the first condition to the and2 input 0
net air_ok qtpyvcp.halcheckbox.checked => power_on.in0

# net the halbutton to the and2 input 1
net power_btn qtpyvcp.halbutton.checked => power_on.in1

# net the and two out to halui machine on and to the not in
net power_on power_on.out => halui.machine.on => power_off.in

# net the not out to halui machine off
net power_off power_off.out => halui.machine.off

If you are already loading and2 or not you would have to add to that line to get one more.

Kurt is going to see if he has time to add all the hal pins to the rules editor which would be a tiny bit cleaner IMHO.

Edit: I missed that you said cycle start the halui pin for that is halui.program.run also you might want to make additional checks, in the hal examples I have an example of run pause from one button, might be useful.

JT
Last edit: 06 Dec 2019 23:56 by BigJohnT.

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

Moderators: KCJLcvette
Time to create page: 0.097 seconds
Powered by Kunena Forum