Connect comp param to GUI

More
03 Oct 2011 16:31 #13628 by fma
I'm trying to connect some comp params (pid Pgain,Igain and Dgain) to my GUI (pyvcp), but it does not work. I get the following error:

'Signal temp_pid_P can not add OUT pin 'pyvcp.temperature_pid_P', it already has I/O pin 'pid.0.Pgain'.

In file temperature.hal:

[...]
net temp_pid_P pid.0.Pgain
[...]

In file 'temperature_gui.hl' file:

[...]
net temp_pid_P pyvcp.temperature_pid_P
[...]

Is there a way to do that?

Thanks,

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

More
03 Oct 2011 17:24 #13629 by ArcEye
Replied by ArcEye on topic Re:Connect comp param to GUI
Hi

Those pins are shown as I/O

The below works on my simulation

net temp-pid-P <= pid.0.Pgain => pyvcp.temperature-pid-P


I changed to dashes rather than underscores, comp converts underscores in pin names to dashes when compiling a component I seem to recall, sometimes using a name with 2 or more underscores seemed to produce an error, so I stopped using them when naming my own pins and signals.

regards

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

More
03 Oct 2011 17:39 #13630 by andypugh
ArcEye wrote:

The below works on my simulation

net temp-pid-P <= pid.0.Pgain => pyvcp.temperature-pid-P


Is your pyvcp an output or an input?

I get the same error connecting a simple output pin (from constant) to Pgain.

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

More
03 Oct 2011 17:49 #13631 by BigJohnT
I get the same error trying to connect a spin box pin to the I/O

John

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

More
03 Oct 2011 18:21 #13632 by andypugh
You can only link I/O type pins to inputs, or other I/O pins (as only one pin in a net is allowed to be a writer)
As far as I can see there is no good reason for the gain pins to be I/O.

You _might_ find that the machine->calibration screen does what you want, have you tried that?

There are a number of inelegant solutions:
1) Change the pin type in /usr/share/pyshared/pyvcp_widgets.py
Possibly better to copy and paste the spinbox control name into a widget with a new name.
The magic value is on line 800 (if you are using a spinbox), change HAL_OUT to HAL_IO
This is a runtime-interpreted file, so there should be no need to recompile anything.

2) Edit and recompile pid.c You will need the file to do this (you could pick up just that one file from git.linuxcnc.org, it's in src/hal/components
You can recompile and install using comp, without needing to reinstall all of EMC2.
In some ways this it the tidiest option.

3) create a very simple HAL module with an IN pin and an IO pin, and a function that make out = in.
Again, that would need to be compiled with comp.

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

More
03 Oct 2011 21:17 #13633 by fma
Replied by fma on topic Re:Connect comp param to GUI
Solution 3) seems to me to be the best. I'll try that.

Thanks!

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

More
03 Oct 2011 21:39 #13634 by andypugh
Now we have spotted this problem we might change those pins to inputs in the next EMC2 release. Nobody I have talked to so far thinks that makes any sense.

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

More
03 Oct 2011 21:54 #13635 by fma
Replied by fma on topic Re:Connect comp param to GUI
I wrote the comp as suggested, and it works fine. Maybe such comp could be added to EMC2 core?

Another solution could be to allow a widget to be an i/o, so it can be connected to such i/o param? This will allow the widget to be refreshed/initialize from the param, as we often do in GUI programming...

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

Time to create page: 0.077 seconds
Powered by Kunena Forum