View Single Post
  #9   Spotlight this post!  
Unread 14-02-2004, 13:44
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,801
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: printf isn't printf-ing. Help!

Quote:
Originally Posted by Meandmyself
Current.theta is an unsigned int, and deltat is incremented every 25ms, so generally like 1 or 2. I'm going to try playing around with the order of operations, see if i can get it to work. What if instead of multipying by .08, I divided by 1/.08? would that still force the pic to use floating point calculations?
To stay away from all floating point (and maintain accuracy) do all your multiplication first followed by your divisions.
e.g.,

current.theta += (unsigned long) ((gyroin + gyroprev - 1023) * deltat * 8 / 100) + 2000;
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle