On 11/01/2010 09:54 PM, Jon Elson wrote: > Chris Radek wrote: >> I think Seb started with that code and improved it >> to get the good results we have from hostmot2 now. You might want to >> browse the git history to see what he did? >> >> The changes 84e73cbd534 and especially fed9d8e5a58 look relevant. >> >> > I looked briefly at hostmot2/encoder.c but couldn't even tell where the > timestamp/velocity > code was. Maybe that was the wrong file. >
That's the right file. It's in the hm2_encoder_instance_process_tram_read() function. That function gets run for each encoder channel, every time through the servo loop. The comment on line 832 introduces the fix to the "velocity spike when reversing direction" problem. The solution that Peter suggested, that I implemented, is to report velocity=0 for the edge that signals a direction reversal. The hard part of writing that code was figuring out how to do it while handling timestamp roll-over correctly. I made this little chart to help me think about it: <http://highlab.com/~seb/emc2/hm2-encoder/> I think it's still mostly up-to-date. Maybe I should add it to src/hal/drivers/mesa-hostmot2/doc? It adds up to just 88 KB, but i'm not sure if it makes any sense to anyone but me.... (Hm, the hm2 encoder code has an old FIXME from back in February, for a bug Micges reported that I was never able to reproduce... Probably time to shrug and remove it.) -- Sebastian Kuzminsky ------------------------------------------------------------------------------ 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