After some thinking, I changed the comp source code, to update old commanded position with new one, ONLY if the difference between the old commanded position and the new one is material.
This will let me move at glacial speed, too. Thanks for making me think about it. And thanks to Andy Pugh too. I love EMC and what I can do with it! I have not yet tested this change, but here's the latest code: =========================================== 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"; pin out float debug-t-out "Watch t"; pin out float debug-old-pos "Watch old-pos"; pin out float debug-pos-in "Watch position-command-in"; pin out float debug-pos-diff "Watch position diff"; 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(_){ debug_old_pos = old_pos; debug_pos_in = position_command_in; debug_pos_diff = position_command_in - old_pos; double diff = old_pos - position_command_in; if( diff < 0 ) diff = -diff; if (diff > 1E-7){ t = timeout; old_pos = position_command_in; } else { t -= fperiod; } debug_t_out = t; if (t < 0){ current_out = default_current * current_in; t = -1; } else { current_out = current_in; } } On Fri, Mar 4, 2011 at 9:38 AM, Igor Chudov <ichu...@gmail.com> wrote: > > > On Fri, Mar 4, 2011 at 9:25 AM, gene heskett <ghesk...@wdtv.com> wrote: > >> On Friday, March 04, 2011 10:12:57 am Igor Chudov did opine: >> >> > On Fri, Mar 4, 2011 at 7:27 AM, Przemek Klosowski < >> > >> > przemek.klosow...@gmail.com> wrote: >> > > On 3/4/11, Igor Chudov <ichu...@gmail.com> wrote: >> > > > 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. >> > > >> > > NO, absolutely not stupid at all. This is in fact the only sane way of >> > > comparing floating point numbers, recommended in all numerical >> > > analysis textbooks. >> > >> > Whils I kind of agree in general (I do numerical modeling too, for a >> > living), here we are essentially comparing a == a and it fails. See my >> > another post in this thread about GCC bug 323. >> > >> > My concern with doing what I am doing, is that if I wanted the knee to >> > move at glacial speed, it would shut off. >> > But I know that I do not need it. >> >> But, would it not come back on and move accordingly if the diff between >> shutoff position (saved) and present requested position exceeded that >> 1E-07? > > > > No, the comparison is between the previously commanded position and the > currently commanded position. > > And this is why I am slightly concerned with this approach. > > >> That does seem to a a pretty reasonable assumption, and at that >> small a diff, the part would never know the motor had been resting. I >> don't >> see an accumulated error creeping in as long as the requested position is >> never thrown away, only the saved requested position at the point of the >> turnoff. >> >> > I would not be worried if I was comparing actual with commanded, but I > compare previous commanded to current commanded. > > >> I looked at the smallest knee mill Grizzly has, but keep going back to the >> G0704 because of its larger table motion envelope. OTOH the head on that >> re-labeled machine can be articulated too. But it also weighs a good half >> ton, and the flooring in my shop is not up to that, its sagged about 2" in >> the middle now, and was liberally blocked and leveled when I built it. >> Damned yellow clay soil, its a supercooled liquid. Never stops flowing. > > > Maybe some concrete application is in order. > > I love my 2 ton mill. :) > > 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 Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users