Kirk Wallace wrote:
> 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.
>    
Yep.  My fault for not making documentation when I wrote the code.  
There was a discussion on this list or on IRC recently (in the last few 
months), in which the necessary connections are listed.  They should be 
pretty self-explanatory, but examples always help.

The basic scoop is this:
"up", "down", and "on_target" are bit outputs that tell whether to go 
up, down, or nowhere.  Exactly one of those will be "1" at any time.
"actual" and "desired" are integer inputs that tell where the carousel 
is and where you want it, respectively.
"max" and "min" are the highest and lowest tool slot numbers.  Note that 
tool numbers actually start with 1, so you may need to fiddle with the 
desired/actual values (and/or the requested slot output to the tool 
changer) to get the tool you really want.
"wrap" is a bit input which you probably want to set true, if the 
changer is a carousel.  If set true, then it's assumed that max is next 
to min and you can get from min to max by going "back" one and wrapping 
around.

Hope this helps.
- Steve

- Steve


------------------------------------------------------------------------------
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

Reply via email to