25.06.2010 13:10, Andy Pugh пишет:
> On 25 June 2010 03:14, Alexey Starikovskiy <[email protected]> wrote:
>
>   
>> I think real problem is here:
>>
>> dy = pos->tran.y - old.y;
>> dx = pos->tran.x - old.x;
>> if (dx != 0 || dy != 0) {
>> C = atan2(dx, dy);
>> }
>> C should be set to zero before if.
>> dx == 0 and dy == 0 may be not what you want. fabs(dx)>eps will be more
>> appropriate.
>>     
> I agree that might give incorrect results from a mathematical point of
> view (and I could probably afford to go a lot bigger than eps in
> practice) but it seems to be an unlikely cause of the underlying
> problem (unconnected stepgen function moving for no good reason,
> numbers not incrementing by the requested amount).
> I am pretty sure that atan2(0,0) returns zero rather than NaN, that is
> certainly all I have seen on the linked HAL pin unless HAL translates
> NaN to zero?
>   
You use C from previous call in case of dx=0 and dy=0.
It could be anything and could move you anywhere.
>   
>> and dx, dy and C and rKcount really belong to this function and not the
>> global context.
>>     
> Good point, this is true now, but hasn't always been so.
>
>   
>> Only 'old' is shared between two functions and needs to be global.
>>     
> And that doesn't need to be, I moved the code that sets it  to the
> other function and forgot to move the debug HAL pin at the same time.
>
>   


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to