>> On 11 May 2013 20:19, Lars Andersson <[email protected]> wrote: >> >>> Trying to control servo P I and D at runtime with potentiometers to >>> practise loop optimising. >> As you have seen, an underlying problem is that the Gains are IO pins. >> They used to be parameters, but it was decided that pins would be more >> useful, but then it was realised that an input pin can not change its >> own value, so that internal limiting is a problem, so they were made >> into IO pins. Which isn't necessarily better. (ref >> http://psha.org.ru/irc/%23emc-devel/2013-04-30.html#19:09:14 ) >> >> The already-existing "tristate-float" component ( >> http://www.linuxcnc.org/docs/html/man/man9/tristate_float.9.html ) can >> be used to make the conversion. > I tried a different approach and duplicated the pins, one IO and one IN > like this in mypid.c > > retval = hal_pin_float_newf(HAL_IO, &(addr->pgain), comp_id, > "%s.Pgain", prefix); > if (retval != 0) { > return retval; > } > retval = hal_pin_float_newf(HAL_IN, &(addr->pgain), comp_id, > "%s.Pgain-in", prefix); > if (retval != 0) { > return retval; > } > > It compiles correctly and loads correctly and the regulator obeys the IN > pin, but it does not reflect in the value of the IO pin. > Don't understand why? Both points to the same internal variable. > This is the rsult after setting X.Pgain-in: halcmd: show pin X.Pgain Component Pins: Owner Type Dir Value Name 7 float I/O 0 X.Pgain 7 float IN 55.84 X.Pgain-in <== P0
------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
