Well, after an AMAZING amount of fooling around with barely one page of code, I finally have MOST of the velocity estimation working in the ppmc driver. I'm still not sure it is right, though.
One quirk, which I think is inherent in the way that HAL component encoder.c works, and which I copied, is that a dithering encoder gets the wrong velocity. The first count of the dither gets the right velocity, as there was no movement for some time before. The second count, if immediately following the first one, cancels out the movement, but it gets twice the velocity, as these are seen as two counts in a short period of time. I suppose you could look back two servo periods, and if the position delta between now and n-2 is zero, then velocity should be zero in that case. Maybe I implemented the code wrong. Under some conditions it seems like it might be an improvement, but it is not as smooth as I had hoped for. Now, maybe the problem is the servo I am using for tuning is so jittery (as it does not yet use the velocity info) that it creates a lot of these dithery counts. Jon ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers