Go to Post Engineers crave and demand facts, and won't reach a conclusion without them. - Richard Wallace [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-02-2005, 00:47
Unsung FIRST Hero
miketwalker miketwalker is offline
Robot Lifeguard
FRC #1902 (Exploding Bacon)
 
Join Date: Dec 2001
Rookie Year: 2002
Location: Orlando, FL
Posts: 878
miketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond repute
Send a message via AIM to miketwalker
26.2ms loop question

I've had some very interesting results when I've been working on using loop counts as timers for distance calculations. I kept getting results being half of what I wanted. So, I threw in a timer and manually timed how many loops would go by in a minute... and after dividing my results I found that each timer tick took very close to twice the 26.2ms data stream (since I did it by hand I don't know if it was exactly twice or just close). I was wondering why this is.

I was thinking... are the loops really 52.4ms for calculations and such? Or does it vary based on how many calculations you have or something? I'd like to find out why this seems to be occuring, and if it is 52.4ms that will be a simple fix by modifying the number used, but because of precision purposes I want to find out if I'm right or not... or if the loops will take longer and longer with more and more calculations. I've never used timers to do these types of calculations so I've never run into this before. Any ideas?
  #2   Spotlight this post!  
Unread 05-02-2005, 01:06
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,586
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: 26.2ms loop question

Quote:
Originally Posted by miketwalker
I've had some very interesting results when I've been working on using loop counts as timers for distance calculations. I kept getting results being half of what I wanted. So, I threw in a timer and manually timed how many loops would go by in a minute... and after dividing my results I found that each timer tick took very close to twice the 26.2ms data stream (since I did it by hand I don't know if it was exactly twice or just close). I was wondering why this is.
Since you talked earlier about using a lot of floats, I'd assume you are doing more then 26.2ms worth of calculations. You can check the packet number. If you only get every other packet, your program is taking to long.
  #3   Spotlight this post!  
Unread 05-02-2005, 08:43
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
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,854
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: 26.2ms loop question

Quote:
Originally Posted by miketwalker
... are the loops really 52.4ms for calculations and such?
Just a thought...
You aren't by any chance testing on the EDU controller are you?
EDU = 17ms slow loop (~59 loops per second) as opposed to the FRC 26ms.

Nah. I'm going the wrong way aren't I? Faster rather than the slower you are experiencing. (Too early on a Sunday morning. I shouldn't post before noon.)
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 05-02-2005 at 08:46.
  #4   Spotlight this post!  
Unread 05-02-2005, 10:41
Unsung FIRST Hero
miketwalker miketwalker is offline
Robot Lifeguard
FRC #1902 (Exploding Bacon)
 
Join Date: Dec 2001
Rookie Year: 2002
Location: Orlando, FL
Posts: 878
miketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond repute
Send a message via AIM to miketwalker
Re: 26.2ms loop question

Quote:
Originally Posted by Joe Ross
Since you talked earlier about using a lot of floats, I'd assume you are doing more then 26.2ms worth of calculations. You can check the packet number. If you only get every other packet, your program is taking to long.
I ended up not using a bunch of floats. I was just curious with that thread as I was planning some things out. Currently I'm working with 2 floats, and when I don't run the functions using floats my counter is still counting at about half the speed it should be.
  #5   Spotlight this post!  
Unread 05-02-2005, 11:55
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: 26.2ms loop question

I'm not sure why it would be greater than 26.2ms.

Doesn't the master uP stop your code if it exceeds the 26.2 refresh limit? (and the "code error" light comes on) Or does your code call putdata() in the middle of the loop?
__________________

Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rewriting main loop Max Lobovsky Programming 4 04-01-2005 18:35
Question of the Week!!! (7/19/04) Andy Grady General Forum 23 23-07-2004 13:21
Question of the Week!!! (6/14/04) Andy Grady General Forum 23 01-07-2004 15:54
Question of the Week [05-02-04]: The Very Merry Month of May EddieMcD Rumor Mill 10 05-05-2004 14:02
quick question: TIMERS Xufer Programming 58 18-03-2004 08:49


All times are GMT -5. The time now is 19:19.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi