Just a little update. I think that this is a weird issue of float math or something. Difference between old pos input and new pos input is often nonzero in a very crazy way, the value seemingly does not change, but there is always a difference.
I re-wrote Andy's function to compare the absolute value of the diff, and compare that to 1E-07. I know that this is crazy, ugly, and stupid. But it works beautifully. I added a few output pins to this comp to watch those diffs and so on, and that's how I could figure it out. So, the bottom line is 1) The knee moves at a perfectly acceptable speed (1cm per second or so) 2) It moves smoothly, with low acceleration (which reduces stresses on everything) 3) The following error is always under 0.001 4) After 10 seconds following completion of a move, the motor turns off and uses zero current. So, I would say, with the exception of unresolved float math issue and its ugly solution above, everything is GREAT and I can just use this machine now. Still need to add Jon's second DAC card and wire the rotary table/4th axis in again. i On Thu, Mar 3, 2011 at 9:28 PM, Igor Chudov <[email protected]> wrote: > No, the issue and the reason why it does not work, is that old_pos and > position_command_in are always different, even if by 1 billionth. > > I am rewriting some stuff. > > i > > > On Thu, Mar 3, 2011 at 8:57 PM, Igor Chudov <[email protected]> wrote: > >> >> >> On Thu, Mar 3, 2011 at 1:45 PM, andy pugh <[email protected]> wrote: >> >>> On 3 March 2011 16:53, Jon Elson <[email protected]> wrote: >>> >>> > I STILL don't like it. You need a HAL component that looks at >>> commanded >>> > position >>> > (comes from axis.8.motor-pos-cmd, I think) and compares current to last >>> > position. >>> >>> Whilst also not liking it, this custom HAL component would do the >>> trick: (It needs to be compiled with comp --install timeout.comp) >>> >>> component timeout """Reduces motor command to a predetermied value after >>> a >>> certain number of seconds of no axis motion"""; >>> >>> pin in float position-command-in "link to motor-pos-cmd"; >>> pin in float current-in "link to the PID output"; >>> pin out float current-out "link to the DAC"; >>> param rw float timeout = 10 "timeout in seconds"; >>> param rw float default-current = 0 "current output after timeout"; >>> variable float old_pos; >>> variable float t = 0; >>> function _; >>> license "GPL"; >>> author "Andy Pugh"; >>> >>> ;; >>> >>> FUNCTION(_){ >>> if (old_pos != position_command_in){ >>> t = timeout; >>> } >>> else { >>> t -= fperiod; >>> } >>> >>> if (t < 0){ >>> current_out = default_current; >>> } >>> else { >>> current_out = current_in; >>> } >>> >>> old_pos = position_command_in; >>> } >>> >>> >>> >> Andy, this is an awesome comp, except that it does not quite work. Here's >> the version that I use: >> >> component timeout """Reduces motor command to a predetermied value after >> a >> certain number of seconds of no axis motion"""; >> >> pin in float position-command-in "link to motor-pos-cmd"; >> pin in float current-in "link to the PID output"; >> pin out float current-out "link to the DAC"; >> param rw float timeout = 10 "timeout in seconds"; >> param rw float default-current = 0 "current output after timeout"; >> variable float old_pos; >> variable float t = 0; >> function _; >> license "GPL"; >> author "Andy Pugh"; >> >> ;; >> >> FUNCTION(_){ >> if (old_pos != position_command_in){ >> t = timeout; >> } >> else { >> t -= fperiod; >> } >> >> if (t < 0){ >> current_out = default_current * current_in; >> } >> else { >> current_out = current_in; >> } >> >> old_pos = position_command_in; >> } >> >> It works in the sense that its output is equal to input. >> >> It does not work in the sense that it does not shut down after 10 seconds. >> >> Your code looks very good to me, and I think that what is happening is >> that you are trying to subtract a small number fperiod, from a large number >> t, and that does not work. >> >> The config I have says >> >> newsig pid-W-out float >> #newsig pid-W-command-in float >> >> setp w_axis_timeout.default-current 0 # current factor applied after >> timeout >> setp w_axis_timeout.timeout 10 # Timeout in seconds >> >> linksp pid-W-out <= pid.4.output # >> pid-W-out is output of pid 4 >> linksp Wpos-cmd => w_axis_timeout.position-command-in # >> and it goes into timeout >> linksp pid-W-out => w_axis_timeout.current-in # and it >> goes into timeout >> linksp Woutput <= w_axis_timeout.current-out # output >> from timeout will go to motor >> >> i >> >> > ------------------------------------------------------------------------------ What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
