Go to Post I wonder if it could be... Nah, that would just be way too... Never mind. . - dlavery [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 22-01-2003, 19:27
Cobra Cobra is offline
Registered User
#1203 (Pandemonium)
 
Join Date: Jan 2003
Location: Long iSLAND
Posts: 13
Cobra is an unknown quantity at this point
Send a message via AIM to Cobra
FiRST Year Team - need Timer HeLP

hey guys. Well heh, im havin trouble settin up the timer on my bot. the motor is supposed to go 36 cycles/s so in the code we are using this for a timer...

if a_count = (36 *4) then y
y:
drive_R=220

a_count = a_count+1


if i can get the counter to pause for 3 seconds and do the drive_r action the 4th second, that would be all the help i need for now.The code is in the main loop, and all i want it to do is obey the timer... ill be waitin for your replies..ty
  #2   Spotlight this post!  
Unread 22-01-2003, 19:30
Adam Y.'s Avatar
Adam Y. Adam Y. is offline
Adam Y.
no team (?????)
 
Join Date: Mar 2002
Location: Long Island
Posts: 1,979
Adam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to behold
Send a message via AIM to Adam Y.
Quote:
pause for 3 seconds
Duhhhhh(inserted because i forgot what it was) its the pause command and you denote how long you want it to pause but it's units are in miliseconds. Now all it's a matter of figuring out where to pause it. Hmmm.... I believe it should be at the end of the code you posted.
__________________
If either a public officer or any one else saw a person attempting to cross a bridge which had been ascertained to be unsafe, and there were no time to warn him of his danger, they might seize him and turn him back without any real infringement of his liberty; for liberty consists in doing what one desires, and he does not desire to fall into the river. -Mill

Last edited by Adam Y. : 22-01-2003 at 19:39.
  #3   Spotlight this post!  
Unread 22-01-2003, 19:38
Cobra Cobra is offline
Registered User
#1203 (Pandemonium)
 
Join Date: Jan 2003
Location: Long iSLAND
Posts: 13
Cobra is an unknown quantity at this point
Send a message via AIM to Cobra
hm..

Is there a way i can find out how many times the Main Loop runs in one second?
  #4   Spotlight this post!  
Unread 22-01-2003, 19:40
Adam Y.'s Avatar
Adam Y. Adam Y. is offline
Adam Y.
no team (?????)
 
Join Date: Mar 2002
Location: Long Island
Posts: 1,979
Adam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to behold
Send a message via AIM to Adam Y.
That is getting a whee bit too complicated for me. Someone else answer his second question. All I know about pbasic is that in order to pause the program at a certain point you use the pause command. I know a little more but trying to learn about robotics when you have five million things going on is a bit on the insane side
__________________
If either a public officer or any one else saw a person attempting to cross a bridge which had been ascertained to be unsafe, and there were no time to warn him of his danger, they might seize him and turn him back without any real infringement of his liberty; for liberty consists in doing what one desires, and he does not desire to fall into the river. -Mill

Last edited by Adam Y. : 22-01-2003 at 19:42.
  #5   Spotlight this post!  
Unread 22-01-2003, 19:46
Cobra Cobra is offline
Registered User
#1203 (Pandemonium)
 
Join Date: Jan 2003
Location: Long iSLAND
Posts: 13
Cobra is an unknown quantity at this point
Send a message via AIM to Cobra
heh

Maybe i can output the counter out to a display, and time it with a timer, but i think thatll be to many digits. Thanks For your helps though. How long does pause pause for?
  #6   Spotlight this post!  
Unread 22-01-2003, 19:56
Adam Y.'s Avatar
Adam Y. Adam Y. is offline
Adam Y.
no team (?????)
 
Join Date: Mar 2002
Location: Long Island
Posts: 1,979
Adam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to behold
Send a message via AIM to Adam Y.
it pauses the program from 0-65535ms Of course now that I think of it do you really want to pause the whole program??? btw why don't u download the manual on parallax.com too
__________________
If either a public officer or any one else saw a person attempting to cross a bridge which had been ascertained to be unsafe, and there were no time to warn him of his danger, they might seize him and turn him back without any real infringement of his liberty; for liberty consists in doing what one desires, and he does not desire to fall into the river. -Mill
  #7   Spotlight this post!  
Unread 22-01-2003, 20:00
Cobra Cobra is offline
Registered User
#1203 (Pandemonium)
 
Join Date: Jan 2003
Location: Long iSLAND
Posts: 13
Cobra is an unknown quantity at this point
Send a message via AIM to Cobra
nah

i really dont need the pause, i just need a workin timer to hardcode the autonomous code.
  #8   Spotlight this post!  
Unread 22-01-2003, 20:01
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,590
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
First of all, don't use the pause command. This will cause the robot controller to stop executing all code, and miss packets from the OI. If it misses 5 packets in a row, the robot controller resets, which is a bad thing.

Radio data is sent approximately every 26ms. You can use this exactly as a timer if your loop speed is guaranteed to be less then 26ms. Otherwise, you can use the delta_t variable, which tells how many packets that you missed.

The code in the first post is on the right track, but has some logic errors, here is how I would write it.

if a_count < 115 then firstthreesec
if a_count >= 115 & a_count < 154 then fourthsecond
'do whatever you want after fourth second here
goto done
firstthreesec:
drive_R = 127 'neutral
goto done
fourthsecond:
drive_R = 224
done:
a_count = a_count + 1 + delta_t




PS: this thread is close to violating the part of the user agreement that says
Quote:
You also agree not to post the same message in multiple forums, or use the forums as a real-time chat, continuing a 2-3 person conversation on for numerious posts in a short period of time.

Last edited by Joe Ross : 22-01-2003 at 20:03.
  #9   Spotlight this post!  
Unread 22-01-2003, 20:02
Adam Y.'s Avatar
Adam Y. Adam Y. is offline
Adam Y.
no team (?????)
 
Join Date: Mar 2002
Location: Long Island
Posts: 1,979
Adam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to behold
Send a message via AIM to Adam Y.
I really should read up on the innovation first controller and how to program it. I'm always thinking of the basic stamp when I try to answer these questions.
__________________
If either a public officer or any one else saw a person attempting to cross a bridge which had been ascertained to be unsafe, and there were no time to warn him of his danger, they might seize him and turn him back without any real infringement of his liberty; for liberty consists in doing what one desires, and he does not desire to fall into the river. -Mill
  #10   Spotlight this post!  
Unread 22-01-2003, 20:30
Cobra Cobra is offline
Registered User
#1203 (Pandemonium)
 
Join Date: Jan 2003
Location: Long iSLAND
Posts: 13
Cobra is an unknown quantity at this point
Send a message via AIM to Cobra
ok i think i get it

so, delta_t counts the packets bein sents, where if delta_t = 1 then it would be at 26ms, so i can do if delta_t=4(x) (4= roughly 1 second, x= multiplier of how long i want it to go ie. 4*1= 1 sec, 4*2= 2 sec) i should be able to use delta_t as atimer without even a_count? is delta_t already in the default code and used to count the packets every 26ms?
  #11   Spotlight this post!  
Unread 22-01-2003, 21:07
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
delta_t will tell you how many packets you have missed since your last SERIN. It is NOT a running timer. As the code posted by Joe Ross shows, you should still keep your own counter and increment it by 1+delta_t (delta_t will be 0 if your loop is exactly 26ms) each time. Then, multiply this counter by 26ms to get the actual number of seconds that have gone by.

--Rob
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #12   Spotlight this post!  
Unread 24-01-2003, 23:00
Cipher X's Avatar
Cipher X Cipher X is offline
Registered User
no team (Former SigmaC@t Member)
 
Join Date: Jan 2003
Location: Sunrise/Ft Lauderdale, FL
Posts: 39
Cipher X is an unknown quantity at this point
Send a message via AIM to Cipher X
Re: hm..

Quote:
Originally posted by Cobra
Is there a way i can find out how many times the Main Loop runs in one second?
http://www.chiefdelphi.com/forums/sh...threadid=16805

The Thread "How long is one stamp loop" has stuff that can help you figure out how long of loop of your edited program will take. and from this u can find out how many time ur main loop will run in one second.

http://www.emesystems.com/BS2speed.htm

That site has some stuff about speed etc. {Its also in that other Thread}

Cipher X
__________________
"Whatever you do will be insignificant, but it is very important that you do it."
-Mahatma Gandhi
  #13   Spotlight this post!  
Unread 25-01-2003, 19:46
comet22 comet22 is offline
Registered User
#0141
 
Join Date: Jan 2003
Location: Holland, MI
Posts: 22
comet22 is an unknown quantity at this point
the scan time on the controller is roughly 26 milliseconds as we tested it, and there are ways other than counting time you want the motor to run..be creative, use your eyes, we have our robot already going around and up the ramp in 4 seconds flat simply by counting wheel revs.

~Erick
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
The Death of FIRST Anton Abaya General Forum 23 03-05-2006 17:18
The 2003 Index of team's post about their robot... Ken Leung Robot Showcase 4 28-02-2003 00:18
More 'Best' Robots (a well thought list) archiver 2000 2 23-06-2002 23:11
Disqualifications archiver 1999 13 23-06-2002 21:53
How many people are leaving you team this year? Elgin Clock General Forum 26 01-07-2001 23:39


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

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