how to auto-set widget?
- dab77
- Offline
- Elite Member
-
- Posts: 194
- Thank you received: 2
sorry, I misread your request - you wanted to set a widget property from a HAL pin, not an INI value
I adapted the example in master to accept a widget property via a HAL pin: git.linuxcnc.org/gitweb?p=emc2.git;a=tre...fa5d6887c0df38fbb178
to run, start axis, and in a second window cd to configs/gladevcp/set-param-from-ini and run:
$ export INI_FILE_NAME=demo.ini
$ gladevcp -u meter_scale.py meter_scale.ui
Then adjust the meter_scale.max-value pin and observe the HAL meter widget,
-Michael
Hi! finally i could spend some time on your suggestion.
Your files work (except it doesn't take the min value from demo.ini..), meaning i can change the max_value using setp into the hal command line, into the 'watch hal config' window.
so i menaged to glue this into my setup, first trying only to change one meter, but i've found out that if i want my gladevcp panel inside the emc2 window, it doesn't create the pin. Maybe because to create that it must have the 'gladevcp' name, and not the name of the python file..?
If i run my setup into a terminal window after running emc2 (like you suggested) it works.
I would like to manage that problem, since i want gladevcp panel inside the same windows.
do you have any suggestion?
thanks, Davide.
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
-
- Posts: 195
- Thank you received: 11
mhaberler wrote:
so i menaged to glue this into my setup, first trying only to change one meter, but i've found out that if i want my gladevcp panel inside the emc2 window, it doesn't create the pin. Maybe because to create that it must have the 'gladevcp' name, and not the name of the python file..?
I am fairly sure that the pin is created as gladevcp.max-value pin , since running gladevcp inside
an Axis pane requires the HAL component name 'gladevcp'.
Please investigate the gladevcp component's pins with 'Show HAL configuration'.
If you find it, use that name. Otherwise I'm sure there's an error message which gives some hints as to what happened. If so, post that here.
- Michael
Please Log in or Create an account to join the conversation.
- dab77
- Offline
- Elite Member
-
- Posts: 194
- Thank you received: 2
That's why i'm asking help here, 'cause it seems strange that it didn't create the pin!mhaberler wrote:
I am fairly sure that the pin is created as gladevcp.max-value pin , since running gladevcp inside
an Axis pane requires the HAL component name 'gladevcp'.
Please investigate the gladevcp component's pins with 'Show HAL configuration'.
If you find it, use that name. Otherwise I'm sure there's an error message which gives some hints as to what happened. If so, post that here.
- Michael
now i'll post my files, which work now, but only if i run them after emc2:
then i try again to set them to work inside the emc2 window, and call all the pins gladevcp.xxx...
Please Log in or Create an account to join the conversation.
- dab77
- Offline
- Elite Member
-
- Posts: 194
- Thank you received: 2
GLADEVCP = -u gladevcp.py gladevcp.ui
using these files:
i have this error:
gladevcp.hal:109: Pin 'gladevcp.max-value1' does not exist
infact, if i don't load my hal file, i can't see the pin:
p.s. another question for you, in the .py file instead of this line:
how can i write directly the name of the file? ..i couldn't..inifile = emc.ini(os.getenv("INI_FILE_NAME"))
thanks, Davide.
Please Log in or Create an account to join the conversation.
- dab77
- Offline
- Elite Member
-
- Posts: 194
- Thank you received: 2
into the file: ../emc2-dev/src/emc/usr_intf/axis/scripts/axis.py , i changed the line 3051 in this way:
in this way it creates the hal pin i need, also if loaded inside emc2 windows.cmd = "halcmd loadusr -Wn tgvcp gladevcp".split()
into the .ini file the Gladevcp line looks like that:
GLADEVCP = -c tgvcp -u tgvcp.py -H tgvcp.hal tgvcp.ui
obviously i needed to run: make , into my src directory.
If i did something wrong please correct me.
Thanks!
p.s. I still need an hint on the previous question about the inifile.
Ciao, Davide.
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
-
- Posts: 195
- Thank you received: 11
Re: "pin not created":
The issue could be sequencing. Note that when using a tab inside Axis, gladevcp is started by Axis, which means that the pins created by gladevcp are only accessible after Axis startup. Therefore these pins can be referenced only by HAL commands which are executed through HAL/POSTGUI_HALFILE. Those are executed post gladevcp setup when running inside Axis in the right-hand panel.
-Michael
dab77 wrote:
That's why i'm asking help here, 'cause it seems strange that it didn't create the pin!
now i'll post my files, which work now, but only if i run them after emc2:
then i try again to set them to work inside the emc2 window, and call all the pins gladevcp.xxx...
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
-
- Posts: 195
- Thank you received: 11
p.s. another question for you, in the .py file instead of this line:how can i write directly the name of the file? ..i couldn't..inifile = emc.ini(os.getenv("INI_FILE_NAME"))
try
inifile = emc.ini("/path/to/inifile")
-Michael
Please Log in or Create an account to join the conversation.
- dab77
- Offline
- Elite Member
-
- Posts: 194
- Thank you received: 2
Yes it should be like that, but if the pins and glade hal file have the standard name 'gladevcp' the pin is not created. I can say that because i tried to disable all the references to that pins, so that emc2 runs without errors and i can see the pins....
Re: "pin not created":
The issue could be sequencing. Note that when using a tab inside Axis, gladevcp is started by Axis, which means that the pins created by gladevcp are only accessible after Axis startup. Therefore these pins can be referenced only by HAL commands which are executed through HAL/POSTGUI_HALFILE. Those are executed post gladevcp setup when running inside Axis in the right-hand panel.
-Michael
gladevcp.max-value is not there.
then i have tried, as i wrote in my last post, to change the default name to something else, and it worked.
but i really can't understand definitely where the bug is.
I thought i sent you all the necessary files, i'll send you tomorrow all that you may need to try that your self (except you should have a thrustmaster joystick...)
The only thing i didn't try was to put the file name inside ""... sorry.try
inifile = emc.ini("/path/to/inifile")
-Michael
I'll try that tomorrow.
Thanks, Davide.
Please Log in or Create an account to join the conversation.
- dab77
- Offline
- Elite Member
-
- Posts: 194
- Thank you received: 2
Ah, maybe it's because this configuration is intended to be run on emc2.4 JA3 branch? so axis and joint configuration into the .ini file is different from standard emc2.
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
-
- Posts: 195
- Thank you received: 11
I checked ...
What is missing?
Your homebrew kins module, and the fact that you are running some none-standard branch?
Look, this is the deal:
You ask for help, so please do your part of the work first. That is: isolating the problem so it can reproduced without somebody else fiddling for hours on end. This is not a manufacturer support hotline with handholding for a fee.
Your kins stuff, JA3 etc etc is obviously irrelevant to the problem you claim exists.
Please take the time to take master or v2.5_branch, and modify configs/sim/axis.ini it until it shows the problem. Then file it on the bugtracker so it isnt forgotten in the mists of forum posts.
There are some really good Python tutorials online, and this site isnt one of them.
- Michael
Please Log in or Create an account to join the conversation.