View Single Post
  #8   Spotlight this post!  
Unread 06-04-2006, 00:29
Ben Englert Ben Englert is offline
Registered User
FRC #1072
 
Join Date: Jan 2006
Location: San Jose CA
Posts: 40
Ben Englert has a spectacular aura aboutBen Englert has a spectacular aura aboutBen Englert has a spectacular aura about
Re: Critique this code

Quote:
Originally Posted by Tom Bottiglieri
Why did you use integer math in control_system.c and floating point in drive_control.c. All assignments are being dropped into int variables, so multiplying by 1.30 is just going to put extra strain on the processor to just get the same answer.

Try
Code:
targetticks = (percentage * 26) /20;
That's something I've always wondered... people say that doing floating point math really does stretch the PIC to the edge of its capacity, but I haven't had any problems with it, even when it is handling a lot of interrupts from encoders etc. Is there an easy way to tell how much load it's under?
__________________
Before a match at SVR, 3/17/06
Tatsu: "Yo Englert, what's our autonomous mode?"
Me: "We'll find out, won't we."
Both: *maniacal laughter*
After the match's autonomous period ends:
Me: "Well, the basic control system still responds. That's always good."
Both: *further laughter*