View Single Post
  #2   Spotlight this post!  
Unread 03-02-2008, 13:05
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: Problem with negitive numbers

Quote:
Originally Posted by Uberbots View Post
check your PID loop... maybe you inadvertedly got rid of a typecast.

also, are you sure you dont have any longs defined in there?
I did a find in my code, and found only one long. It is used in CalculateSpeed, to store a local copy of the encoder count. The output from CalculateSpeed appears correctly in the printfs in both CalculateSpeed and PID.

Quote:
Originally Posted by Alan Anderson View Post
I don't see anything that defines the type of output. If it were an unsigned variable, it would give the behavior you describe.
It is defined in the code in my first post, line 7. It is an int.

Quote:
Originally Posted by dcbrown View Post
If you suspect overflow in currentOutput, then bump it from int to short long type to see if the symptoms change.
I will try that next time I have access to the robot.
__________________
Eric Haskins KC9JVH