On Tuesday 18 December 2012 19:08:42 andy pugh did opine:

> On 16 December 2012 22:46, andy pugh <bodge...@gmail.com> wrote:
> > It wouldn't be all that hard to make a linearisation curve component.
> 
> And it wasn't. Put the following in  a text file called
> "lincurve.comp" then sudo comp --install lincurve.comp.
> 
> component lincurve "one-dimensional lookup table";
> description """Performs a 1-dimensional lookup and interpolation. The
> x-val parameters must be monotonic, though identical adjacent values
> are allowed. (for example 0,0,0,10) for a 4-element curve. For input x
> less than the lowest xval the y-val of the lowest is returned. For x
> greater than the largest x-val the yval corresponding to x-max is
> returned (ie, no extrapolation is performed. """;
> 
> param rw float y-val##[16:personality] "output values";
> param rw float x-val##[16:personality] "input values";
> 
> pin in float x "The input value";
> pin out float y "The output value";
> 
> variable unsigned i = 0;
> 
> option extra_setup yes;
> 
> author "andy pugh";
> license "GPL";
> 
> function _;
> 
> ;;
> 
> FUNCTION(_){
>     double f;
>     if (x >= x_val(personality-1)) {
>         y = y_val(personality-1);
>         return;
>     }
>     if (x <= x_val(0)) {
>         y = y_val(0);
>         return;
>     }
>     while (x > x_val(i+1)) { i++;}
>     while (x < (x_val(i))) { i--;}
> 
>     f = (x - x_val(i))/(x_val(i+1)-x_val(i));
>     y = y_val(i) + f * (y_val(i+1) - y_val(i));
> 
> }
> 
> 
> EXTRA_SETUP(){
>     if (personality > 16) personality=16;
>     return 0;
> }

Please put this into the hal repo andy, I think it can be very useful 
indeed.  I think it will need some man page dressing up, unless that file 
is nothing more than a CSV list.  Adding that comment would seem to be 
sufficient to me anyway.

But as I said on IRC, a 10k resistor in series with the signal from the C41 
to the FC250J's center arm of the pot terminal worked wonders for the 
linearity of control vs speed.  I actually have something I can use.  Needs 
some fine tuning of course but it works plus or minus 1 rps at any speed 
now.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
The chief danger in life is that you may take too many precautions.
                -- Alfred Adler
I was taught to respect my elders, but its getting 
harder and harder to find any...

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to