PID Pin Problems

More
06 Jan 2011 22:10 #6487 by malleblas
PID Pin Problems was created by malleblas
halcmd: loadrt pid

halcmd: show pin pid.0.*gain pid.0.feedback pid.0.error
Component Pins:
Owner   Type  Dir         Value  Name
     3  float I/O             0  pid.0.Dgain
     3  float I/O             0  pid.0.Igain
     3  float I/O             1  pid.0.Pgain
     3  float OUT             0  pid.0.error
     3  float IN              0  pid.0.feedback

halcmd: net some-sig <= pid.  => pid.0.error 
halcmd: net some-sig <= pid.0.Pgain  => pid.0.error 
<stdin>:2: Signal 'some-sig' can not add OUT pin 'pid.0.error', it already has I/O pin 'pid.0.Pgain'
halcmd: net some-sig <= pid.0.feedback  => pid.0.error
halcmd:

Never mind the fact that connecting the error output to either Pgain or feedback is non-sensical, I am using it as an example. In my actual configuration, I am connecting an OUT pin from a pyVCP GUI to Pgain and getting the same error. I cannot see any reason why any of the *gain inputs are listed as input/output pins. Could anyone provide more information as to why, and if there is no good reason, should they be changed? For the standard configuration where a value is fed direct from the INI file using setp, it is fine, but I am trying to make a GUI which aids in PID tuning.

-Mikey

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

More
06 Jan 2011 22:30 #6489 by malleblas
Replied by malleblas on topic Re:PID Pin Problems
I have a quick fix for anyone facing the same problem. I created a new component called "passthru"

michael@cnc:~$ cat passthru.comp 
component passthru "Joins OUT to I/O pins";
pin in float in;
pin io float out;
function _;
license "GPL";
;;



FUNCTION(_) {
	out = in;
}

michael@cnc:~$ sudo comp --install passthru.comp

To use, just place this in between the two components with interfacing issues.
halcmd: loadrt passthru
halcmd: addf passthru.0 SOME-THREAD
halcmd: out-sig <= OUT-PIN => passthru.0.in
halcmd: io-sig <= passthru.0.out => IO-PIN

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

More
31 Aug 2021 00:26 #219205 by C_M_H
Replied by C_M_H on topic Re:PID Pin Problems
Thanks for posting this. I just used this technique and it worked great.

Was banging my head against a wall for awhile until I found it.

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

Time to create page: 0.059 seconds
Powered by Kunena Forum