Go to Post 256:1 gear reductions provide surprisingly little torque once the gears have failed. - Kevin Sevcik [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 31-01-2002, 22:54
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Here is the thing...

You cannot count on how long it will take you to get through a loop of your program.

If you have a program that is complex, you may make it in 24 msec one time and 26 msec in another.

If you make it in 24 msec, you MAY be ready to receive the next packet of data that comes from the OI, if you take 26msec, you will definitely MISS the data packet and have to wait around until the next one arrives (which will be a while because they only come at best at 25 msec intervals).

Now, add to that that not all data packets make it through intact you you begin to realize that you will only get to increment your counter at variable intervals. The intervals are outside of your programs control.

So....

What is a clever sheep supposed to do?

Well, FIRST gives you some help. If you ask for it (by setting c_Delta_T = 1 in the default program and by including Delta_T in your SERIN command, which gets data from the master CPU), the master CPU will tell you how many data packets you missed since the last time you got data from it.

SO...

Rather than just adding 1 to counter each time through the loop, you can add in Delta_T, the number of data packets you missed. This will help you keep your clock up to speed even when your program is running slower (perhaps because you left a Debug statement in the code -- you naughty little debugger you) or because you are at a competition and there are many other robots broadcasting on frequencies very near your own.

It is not a big deal but it is a better mouse trap if you care to build it.

Joe J.
 


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
PBASIC ARCTAN function Greg Ross Programming 14 11-05-2003 12:28
Need to learn PBASIC...Where Should I Go? IMDWalrus Programming 5 29-04-2003 16:43
Obscure PBASIC for RoboEmu rbayer Programming 1 28-03-2003 23:57
PBasic 2.5 vs. 2.0 Anthony Kesich Programming 6 09-02-2003 22:06
RoboEmu v.1a (another PBASIC emulator) rbayer Programming 0 07-07-2002 00:45


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

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