HAL pin is not created

More
01 Jan 2024 22:38 #289514 by edmarwjr
Hi,

I am using linuxcnc-2.9.2. The machine was created with Bookworm PREEMPT-RT ISO. Then, linuxcnc was updated to 2.9.2
I also reproduced the problem bellow in my desktop with simulator. Version is 2.9.0~pre1+git20230208.f1270d6ed7
I am using gmoccapy

Relevant fragment of my INI file:
EMBED_TAB_NAME = Touch Piece
EMBED_TAB_COMMAND = gladevcp -x {XID} macros/touch.glade
EMBED_TAB_LOCATION = hbox_jog

I am trying to create a VCP panel.
I got to a point that I managed to make all buttons to work. But I would like to see some internal values displayed in the panel.
So. I setup a HAL_label, with ID=block-height-in. (Type is "1", i.e., accepts a float point)
The name of my glade file is touch.glade, so there should be a hal pin named touch.block-height-in

In my POSTGUI hal file, I have:
(Note that fragment bellow is for test purposes on the simulator. The real machine the constant.0.value is set by a M1xx script)
loadrt constant
addf constant.0 servo-thread
setp constant.0.value 3.000456

loadrt mult2
addf mult2.0 servo-thread
setp mult2.0.in0 25.4 
net touch-block-in  mult2.0.in1 <= constant.0.out
net touch-block-in  touch.block-height-in <= constant.0.out
net touch-block-mm  touch.block-height-mm <= mult2.0.out



This leads to the following error:
**** GMOCCAPY INFO : inifile = /home/edmar/linuxcnc/configs/sim.gmoccapy/gmoccapy.ini ****:
**** GMOCCAPY INFO : postgui halfile = ****:
gmoccapy_postgui.hal:36: Pin 'touch.block-height-in' does not exist
_kill_dynamic_childs
Traceback (most recent call last):
 File "/usr/bin/gladevcp", line 54, in <module>
   import gladevcp.makepins
 File "/usr/lib/python3/dist-packages/gladevcp/__init__.py", line 1, in <module>
   from .hal_pythonplugin import *
 File "/usr/lib/python3/dist-packages/gladevcp/hal_pythonplugin.py", line 30, in <module>
   from .hal_gremlin import HAL_Gremlin
 File "/usr/lib/python3/dist-packages/gladevcp/hal_gremlin.py", line 36, in <module>
   import gremlin
 File "/usr/lib/python3/dist-packages/gremlin.py", line 47, in <module>
   from OpenGL.GL import *
 File "/usr/lib/python3/dist-packages/OpenGL/GL/__init__.py", line 8, in <module>
   from OpenGL.GL.exceptional import *
 File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
 File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
 File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
 File "<frozen importlib._bootstrap_external>", line 936, in exec_module
 File "<frozen importlib._bootstrap_external>", line 1069, in get_code
 File "<frozen importlib._bootstrap_external>", line 729, in _compile_bytecode
KeyboardInterrupt

*BUT*
if I comment out the last 2 net lines, and start linuxcnc again, and use Halshow,
I can see the pin is there (see attachment)

Can someone explain what is happenning ?

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

More
01 Jan 2024 22:40 - 01 Jan 2024 22:40 #289515 by edmarwjr
Replied by edmarwjr on topic HAL pin is not created
Attachment here.
 
Attachments:
Last edit: 01 Jan 2024 22:40 by edmarwjr.

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

More
02 Jan 2024 02:52 #289524 by edmarwjr
Replied by edmarwjr on topic HAL pin is not created
I found a solution for this problem. But I don't understand why it solves the problem.
I would appreciate if anyone could comment on that.

I Removed the last two lines from POSTGUI hal file (the net connections) and put them in a separate file (touch.hal)
Then replaced the EMBED_TAB_COMMAND with:

halcmd loadusr -Wn touch gladevcp -c touch -H touch.hal -x {XID} macros/touch.glade

The POSTGUI hal file is supposed to be executed after GUI is loaded, I understand that the gladevcp command line is part of the GUI, so net connections on POSTGUI should be fine.
Is it a race condition ?

TIA
Edmar
 

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

More
02 Jan 2024 06:53 #289535 by cmorley
Replied by cmorley on topic HAL pin is not created
Postgui only means after the GUI (Gmoccapy) is loaded.
Gladevcp is a separate program 'embedded' visually into gmoccapy, They are not in the same process context. Gladevcp can take longer to finish.
Meaning ya it can create a race condition.

Gladevcp HAL commands should be loadded in the gladevcp commamd line just as you did.

try:
EMBED_TAB_COMMAND = gladevcp -c touch -x {XID} -H touch.hal -x {XID} macros/touch.glade

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

Moderators: HansU
Time to create page: 0.070 seconds
Powered by Kunena Forum