custom_postgui.hal will not load with a Custom GUI

More
16 Oct 2013 01:34 #39905 by fbx109
Hello everyone,

I created a custom GUI with glade. I used python to for event handlers. The GUI is working well so far, but now I want to get the status of a pin from HAL.

I added a new hal pin in Python as follows:

self.halcomp = hal.component("gui01")
Key_A = self.halcomp.newpin("Key_A", hal.HAL_BIT, hal..HAL_IN)

Then I output the value every 100ms

In my custom_postgui.hal I connect the hal pin to the python pin I created as follows:

net Key_A_Connection matrix_kb.0.key.r0c0 => gui01.Key_A

No matter what python indicates that the pin is false. I used the HAL Meter that Linuxcnc has built in to verify that the pin would change in Linuxcnc and it does.

Through some trial and error I found that the custom_postgui.hal would not load with my custom GUI.

If I put garbage in the custom_postgui.hal no errors would be thrown, but if I used the "axis" GUI Linuxcnc would error out when the garbage was present.

Any ideas what I am doing wrong or if I forgot something?

Thanks

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

More
16 Oct 2013 18:35 #39951 by newbynobi
Have you added the postgui hal file in your INI?
Is the postgui hal file in the right place?

Give some more Details please, or add your code , INI and Glade files.


Norbert

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

More
23 Oct 2013 21:41 #40230 by fbx109
I have added the postgui hal file in the INI. When I use the default GUI Axis, the postgui hal file loads, but if I use my custom GUI it will not. The postgui hal file is in the same place as the default hal file. All the files requested are attached, If you need anything else let me know. I am still getting the same issue.

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

More
23 Oct 2013 22:07 #40231 by BigJohnT
This might be of interest to you...

gnipsel.com/linuxcnc/gui/gui06e.html

JT

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

More
24 Oct 2013 07:15 #40237 by andypugh

I have added the postgui hal file in the INI. When I use the default GUI Axis, the postgui hal file loads, but if I use my custom GUI it will not.


I believe that it is the job of the GUI to loaf the postgui HAL file, rather than being built into the linuxcnc startup script.

As was discovered in this thread: www.linuxcnc.org/index.php/german/forum/...-path-question#40219 One option is to add it to the startup script.

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

More
24 Oct 2013 17:43 #40245 by ArcEye
Hi

Andy Pugh wrote:

I believe that it is the job of the GUI to loaf the postgui HAL file, rather than being built into the linuxcnc startup script.


This is how Axis does it
if postgui_halfile:
	            res = os.spawnvp(os.P_WAIT, "halcmd", ["halcmd", "-i", vars.emcini.get(), "-f", postgui_halfile])
        	    if res: raise SystemExit, res

As it has to embed the widget panels into its interface, it makes double sense for the gui to do it.

The problem with it and another reason it is easiest for the GUI to do it, is timing.

As you can quickly establish, if you put the net commands etc from the custom_postgui.hal into the main file, they will fail because the components have not been created yet.

It is surprising how quickly seperate commands are executed and you have to be certain one is complete (component creation) before launching another (linking component HAL pins) that relies upon it.

The linuxcnc script passes more info in the commandline parameters when it lauches the GUI defined in DISPLAY = than you might realise
Write a bit of code in your GUI that iterates through argv** and prints them and you will see.

regards

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

More
24 Oct 2013 20:13 #40249 by BigJohnT
Just in case no one clicked on the link I posted that is my tutorial on using a post gui file with a custom gui...

JT

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

More
14 Nov 2013 02:53 #40801 by fbx109

This might be of interest to you...

gnipsel.com/linuxcnc/gui/gui06e.html

JT


Thanks everyone for your help! I am sorry for the late reply, I work on this machine once a week in between school. I ended up using the tutorial above and it worked like a charm. The only thing it forgot to say is to create a self.ini_file member variable and set it to the inifile argument passed into the gui class.

I now have pins working in python. B)

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

Moderators: mhaberlerHansU
Time to create page: 0.096 seconds
Powered by Kunena Forum