Thanks DR-Motion!
I think this is what i really want(the result)!
But one wrong thing is with this idea(for me!) : it uses sqrt and division and this is what i cant afford.
I saw a project somewhere which have to accomplish the same jobs as mine and the CPU runs at only 16MHz and mine will at 20MHz.But this is still slow for such calculations.
So theres another way.
Lets say i will use lookup tables since there is a little finite of combinations of distance differences ( total of 256 ) between X and Y.
I calculate the values with my calculator or Excel for a specified speed.Yes,then i can use it to jump to the location in the lookup table according to the distance difference.for example if no difference between them then add zero to the PCL and read the value then store it as speed for the first motor.The second motors speed is constant.
But a problem takes place when i want to use different speeds.I mean the DMX controller console tells my equipment the speed(the reference or avarage speed).It would last till silvester 2007 to create lookup tables for all the 256 possible speed levels.And its absolutely meaningless to use such a big memory place.
Since i am using integer numbers only(so i round up and down in calculations) there will be some offset errors(caused by rounding) if using only one lookup table and use only additions to get the correct speed offset from the original.
I hope you understand what i mean! how to compensate for it? |