View Single Post
  #18   Spotlight this post!  
Unread 31-01-2006, 12:50
Joel J's Avatar
Joel J Joel J is offline
do you..
no team
 
Join Date: May 2001
Rookie Year: 2000
Location: San Jose, CA
Posts: 1,445
Joel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

Quote:
Originally Posted by Abwehr
You can replace the line:

control /= 4;

with:

control >> 2;

But that's about it - otherwise it works.
if control can be negative, then a right shift can have a disastrous effect! mcc18 v2.4 does NOT shift in 1's for a negative number. Instead, it treats all numbers as unsigned.

For example,

int control = -16;
control = control >> 2;

After that snippet, you'd expect control to be -4, but in actuality its 16380. Quite different.
__________________
Joel Johnson

Division By Zero (229) Alumni, 2003-2007
RAGE (173) Alumni, 1999-2003