how to auto-set widget?

More
12 Dec 2011 16:50 #15594 by dab77
how to auto-set widget? was created by dab77
Hi, i'm trying to use gladevcp, and it works as expected, except i cannot make some value set automatically, and i don't know if it's possible.
for example: a meter, used to show jog speed.
i would like that the MAX value for the meter should be taken directly from the traj_max_linear_velocity pin, so whenever i change that speed, i don't have to change all the meters referred to that value by hand.

Is it possible in some way?
thanks, davide.

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

More
14 Dec 2011 11:45 #15674 by mhaberler
Replied by mhaberler on topic Re:how to auto-set widget?
I'd try a callback on the widget on the realize event

in the callback handler read the value from the ini file using the emc module, and set the property accordingly

-Michael

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

More
14 Dec 2011 17:23 #15685 by dab77
Replied by dab77 on topic Re:how to auto-set widget?
Thanks, that sounds simple, but i don't know how to do it.
How can i set that property, if in the widget i can only put a number in a box?

can you help me a little more, please?

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

More
14 Dec 2011 20:51 #15692 by mhaberler
Replied by mhaberler on topic Re:how to auto-set widget?
here is an example: git.mah.priv.at/gitweb/emc2-dev.git/shor...roperty-from-inifile

actually the realize event isnt needed at all. I'll add that to master.

- Michael

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

More
14 Dec 2011 21:28 #15693 by mhaberler
Replied by mhaberler on topic Re:how to auto-set widget?
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

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

More
15 Dec 2011 16:38 #15707 by dab77
Replied by dab77 on topic Re:how to auto-set widget?
Thanks a lot! i'll sure try that next week, as i go back home.
i think you got what i meant.

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

More
28 Dec 2011 21:12 #16050 by dab77
Replied by dab77 on topic Re:how to auto-set widget?
mhaberler wrote:

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.

More
28 Dec 2011 22:33 #16057 by mhaberler
Replied by mhaberler on topic Re:how to auto-set widget?
dab77 wrote:

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.

More
29 Dec 2011 18:59 #16087 by dab77
Replied by dab77 on topic Re:how to auto-set widget?

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

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:

File Attachment:

File Name: tgvcp_files.zip
File Size:6 KB


then i try again to set them to work inside the emc2 window, and call all the pins gladevcp.xxx...
Attachments:

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

More
29 Dec 2011 19:22 - 29 Dec 2011 19:26 #16089 by dab77
Replied by dab77 on topic Re:how to auto-set widget?
When i try to use this line into the ini file:

GLADEVCP = -u gladevcp.py gladevcp.ui

using these files:

File Attachment:

File Name: gladevcp_files.zip
File Size:2 KB

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:

inifile = emc.ini(os.getenv("INI_FILE_NAME"))

how can i write directly the name of the file? ..i couldn't..

thanks, Davide.
Attachments:
Last edit: 29 Dec 2011 19:26 by dab77.

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

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