OCCRA
Go to Post FRC is about giving students the best experience possible. - MikeE [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-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 01-26-2003, 12:43 PM
Steven Carmain Steven Carmain is offline
Bit Twiddler
#0045 (TecknoKats)
Team Role: Electrical
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Kokomo, IN
Posts: 84
Steven Carmain will become famous soon enough
Solution to Timing Loops

I have found out how to time. Based of the information from Innovation First, a loop is every 26.2 ms, assuming your code does't lengthen it. Based off of that, there are 38.167938931297709923664122137405 loops per sec. So to do close timing without overloading the stamp, you do:

Time VAR byte
RealTime VAR byte

Time = Time + delta_t + 1
if Time > 38 then
Time = Time - 38
RealTime = RealTime + 1
EndIf

This way only uses 2 bytes insted of a byte and a word. I tryed the delta_t * 262 / 10 but it overloaded the stamp and was very inaccurate.

Based of of this formula, then the basic stamp will be 0.530431579 seconds fast at end of match.

You can check this information on this xls I inclosed.
__________________
Team 45's Student Lead Electrical

A robot is like a campfire: it takes a while to bulid it, and then everyone surounds it!
A world without standards is chaos. A world with standards is chaos.
My Website! Includes a spelling program that speaks!
1993 Video Archive
  #2   Spotlight this post!  
Unread 01-26-2003, 03:31 PM
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
Thumbs up Dear god thats great

i must applaud you for your idea. I myself, being a rookie programmer on a rookie team, am just getting the hang of the language, but after reading the forum got this idea yesterday, but then flushed it out, on one basis. doesn't delta_t count the total number of packets missed since starting the program?

-Anthony
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year
  #3   Spotlight this post!  
Unread 01-26-2003, 03:40 PM
Noah's Avatar
Noah Noah is offline
Code Monkey
#0861 (The Gondobots)
Team Role: Programmer
 
Join Date: Apr 2002
Location: Venice, California
Posts: 139
Noah has a spectacular aura aboutNoah has a spectacular aura about
Send a message via AIM to Noah
Re: Dear god thats great

Quote:
Originally posted by Anthony Kesich
[Bdoesn't delta_t count the total number of packets missed since starting the program? [/b]
No, delta_t counts the number of missed packets since your last serin. it gets reset to 0 with each serin.
__________________
"It's broken? NOOAAHH!!! This is your doing, isn't it!"

"We can fix it in the software!"
"It's a BROKEN GEAR!"
  #4   Spotlight this post!  
Unread 01-26-2003, 04:07 PM
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
thats good to hear, you always want to check your bases. you know, play it safe.

-Anthony
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year
  #5   Spotlight this post!  
Unread 01-26-2003, 09:19 PM
Steven Carmain Steven Carmain is offline
Bit Twiddler
#0045 (TecknoKats)
Team Role: Electrical
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Kokomo, IN
Posts: 84
Steven Carmain will become famous soon enough
Did you get the xls. If you guys didn't, then can I have a email address if you want a copy or to post it in the internet
__________________
Team 45's Student Lead Electrical

A robot is like a campfire: it takes a while to bulid it, and then everyone surounds it!
A world without standards is chaos. A world with standards is chaos.
My Website! Includes a spelling program that speaks!
1993 Video Archive
  #6   Spotlight this post!  
Unread 01-26-2003, 09:23 PM
Noah's Avatar
Noah Noah is offline
Code Monkey
#0861 (The Gondobots)
Team Role: Programmer
 
Join Date: Apr 2002
Location: Venice, California
Posts: 139
Noah has a spectacular aura aboutNoah has a spectacular aura about
Send a message via AIM to Noah
You can attach it to your post as a file. That would probably be best. That way everyone can download it straight from here.
__________________
"It's broken? NOOAAHH!!! This is your doing, isn't it!"

"We can fix it in the software!"
"It's a BROKEN GEAR!"
  #7   Spotlight this post!  
Unread 01-27-2003, 08:08 AM
Greg McCoy's Avatar
Greg McCoy Greg McCoy is offline
boiler up!
FRC #3940 (CyberTooth)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Kokomo, IN
Posts: 484
Greg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond repute
Send a message via AIM to Greg McCoy
Re: Solution to Timing Loops

Quote:
Originally posted by Steven Carmain
I have found out how to time. Based of the information from Innovation First, a loop is every 26.2 ms, assuming your code does't lengthen it.
How is this possible? Unless you use only the default code, this number will change, and you have to change the code if you are going to do anything automated.

It's really not that hard to just figure out the numbers by guess and check.

You can do a timer with 2 bytes too, only difference is that you can only count to 255, and when you reach this number you simply start a new step, as documented in my programming sample in the white papers.

Last edited by Greg McCoy : 01-27-2003 at 08:12 AM.
  #8   Spotlight this post!  
Unread 01-27-2003, 08:17 AM
Steven Carmain Steven Carmain is offline
Bit Twiddler
#0045 (TecknoKats)
Team Role: Electrical
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Kokomo, IN
Posts: 84
Steven Carmain will become famous soon enough
If you do the research like I did, then you would see that a loop is 26.2 ms a loop. If your code is shorter then you wait at serin until you get the information and start the loop over. If you take too long in your code, then the delta_t comes in. It count the number of loops you missed as long as it is in the serin. If you miss 5 serins then you have the basic run error. So in theory, this should be accurate.
__________________
Team 45's Student Lead Electrical

A robot is like a campfire: it takes a while to bulid it, and then everyone surounds it!
A world without standards is chaos. A world with standards is chaos.
My Website! Includes a spelling program that speaks!
1993 Video Archive
  #9   Spotlight this post!  
Unread 01-27-2003, 10:32 PM
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
Talking

all i know is this code works. I played with basic autonomous mode today (this isn't that sad, seeing as i am the only real programmer at my school, this is a rookie team, and i have taught myself almost all of the code) and this works like a charm. Since most people only use timing in auton mode, you will only be off by about .066 seconds, and that is extremely insignificant. (It was so little that i didn't notice at all)

-Anthony
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year
  #10   Spotlight this post!  
Unread 01-27-2003, 10:47 PM
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
one question. why the timing loops? why not just a counter?

i made a little program a few days ago, all it does is use a byte and a nibble, and based on the counter and nibble advances through a select case. all you do to control it is adjust the byte to how high to count, and always advance the nibble by one. you can get up to 18 operations in this way, actually more if you don't use the full 255 loops from one byte at a time.

if this doesn't make sense, i'll post the code tomorrow afternoon when i find it. it's very simple when you see it, and it works fine. no need to worry about time, because if the loop gets longer, even a timer would get screwed up.
__________________
AIM --> Woloi
Email --> ian@woloschin.com
  #11   Spotlight this post!  
Unread 01-28-2003, 07:33 PM
Greg McCoy's Avatar
Greg McCoy Greg McCoy is offline
boiler up!
FRC #3940 (CyberTooth)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Kokomo, IN
Posts: 484
Greg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond repute
Send a message via AIM to Greg McCoy
Yeah, that's pretty much what I did. It seems to me that it does the exact same thing with less complexity and the exact same efficiency if done correctly.
  #12   Spotlight this post!  
Unread 01-29-2003, 04:36 PM
mjt902 mjt902 is offline
Registered User
#0902
 
Join Date: Apr 2002
Location: Heritage High School
Posts: 31
mjt902 is an unknown quantity at this point
First, this thread starter knows what he's talking about. Second, a counter counts loops. The number of loops you get in one second changes. Don't believe me:

copy a simple statement 100 times, or use some calc in your program and see how slow the counter goes.

I can forsee that this years coding is that complex when compared to last years (all we needed were a few if statements). The delta_t is the only TRUE thing in your code, so it is imperative that you do the auton mode the way suggested, and do NOT use counters.

GUESS AND CHECK IS NOT HELPING US LEARN ANYTHING
__________________
Top Ten Reasons to Procrastinate:
1.
  #13   Spotlight this post!  
Unread 01-29-2003, 05:03 PM
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
uh, i can control how long it does something based on counting with cycles AND delta_t. it's the same as a timing loop, minus the extra memory and added difficulty. and i've seen no problems so far with my code. sure, it aint pretty, but it's dead reckoning, it's not supposed to be!
__________________
AIM --> Woloi
Email --> ian@woloschin.com
  #14   Spotlight this post!  
Unread 01-29-2003, 06:17 PM
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
There is no advantage to converting Stamp loops to "real" time. It is a 1-to-1 conversion, meaning that each "real" time value corresponds to some fixed number of loops and vice-versa. For example, the following code would do exactly the same thing:

Code:
loopCnt VAR byte
loopCntHigh VAR nib
loopCnt=0
loopCntHigh=0

SERIN...

if (loopCnt + 1 + delta_t > 255) then loopCntHigh=loopCntHigh + 1 : loopCnt=loopCnt+1+delta_t-255 else loopCnt=loopCnt+1+delta_t

SELECT (loopCntHigh<<8 + loopCnt)
CASE range1Low TO range2High
  'do stuff
CASE range2Low TO range2High
  'do other stuff
CASE ELSE
  'do even more stuff
ENDSELECT

SEROUT...
This will let you count up to 4096 loops, which is approx 1min 45s worth of autonomous time. Plus, it only uses 1.5 bytes!

Questions about the above stuff? Email or PM me and I'd be more than happy to explain.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #15   Spotlight this post!  
Unread 01-29-2003, 06:36 PM
mjt902 mjt902 is offline
Registered User
#0902
 
Join Date: Apr 2002
Location: Heritage High School
Posts: 31
mjt902 is an unknown quantity at this point
Once again you correct me!!! Oh, I'm lazy anyway but thanks for the free code. Only one question have I:
where'd you get the 8 from in SELECT(loopCntHigh<<8 + loopcnt)

i think you and i are on the same page (only i'm on a different plane) , and its great learning from you!!!
__________________
Top Ten Reasons to Procrastinate:
1.
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
Timing of nats for next year Ian W. Championship Event 13 03-03-2003 06:28 PM
Way back there. Size of Nationals, and a solution archiver 2001 23 06-24-2002 03:28 AM
what is or isn't a timing belt? archiver 2001 6 06-23-2002 11:26 PM
two sided timing belt archiver 2001 3 06-23-2002 10:34 PM
Dual Sided Timing Belts Lachuck894 Technical Discussion 9 01-14-2002 10:10 AM


All times are GMT -5. The time now is 03:13 PM.

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


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