On Wed, 2010-03-10 at 13:02 -0500, Stephen Wille Padnos wrote: > Kirk Wallace wrote: > > I need a C algorithm that solves the shortest distance to a carousel > > tool (encoder wraps at 0). I can solve the distance from the current to > > the target tool with three tests, CW distance CCW distance, then test > > for the shortest, but it seems I should be able to do this in one test. > > I suspect the solution is so simple, I'll slap my forehead when I see > > it. Thanks. > > > You could use the modmath component. > > Or look at the source code for the algorithm I chose :) > > - Steve
Man, the documentation couldn't get thinner. There is a modmath.ko (but no source), a "loadrt modmath mod_dir=2" in the Mazak .hal file and that seems to be it. I'll hit it with a rock (wiggle pins in AXIS) and see what it does. I suppose I should add something to the wiki... unless someone beats me to it. I thought this would be simple but: http://en.wikipedia.org/wiki/Modular_arithmetic -- Kirk Wallace http://www.wallacecompany.com/machine_shop/ http://www.wallacecompany.com/E45/index.html California, USA ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users