Go to Post Long after we've forgotten that absurd pink bunny, Dave's other car is still on Mars. - 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-2003, 22:17
David Bing David Bing is offline
Registered User
no team
 
Join Date: Jan 2003
Location: None
Posts: 8
David Bing is an unknown quantity at this point
Backwards auton_mode

After finally deciding what to do for our line-tracking code, I figured that it was about time to learn how to use autonomous mode. I seem to understand it and all, so to make sure that I could get it to work, I put the following lines of code in (using the default program):

if auton_mode = 1 then next15:
pause 500
next15:

All that was currently connected was the rotating light spike. When I ran the program, even though it wasn't in autonomous mode, the light flickered (pausing for 1/2 second at a time, of course)! When I switched the RC's team number to 0 (put it into autonomous mode), the light was constant, as if it should've been in normal mode! I switched it to "auton_mode = 0," and it worked as it should have, but why? Everywhere I've read has said that auton_mode is 1 when it is ON, and 0 when it's off! What's going on?
  #2   Spotlight this post!  
Unread 05-02-2003, 22:27
Jeremy_Mc's Avatar
Jeremy_Mc Jeremy_Mc is offline
GitHubber
no team
Team Role: Mentor
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Orlando, FL
Posts: 496
Jeremy_Mc will become famous soon enoughJeremy_Mc will become famous soon enough
Re: Backwards auton_mode

the code does what you asked it to...

if auton_mode = 1 then next15:

[ if autonomous mode is on then go to the label "next15" ]

pause 500

[ this code executes if you don't go to "next15" ]

next15:

[ this label executes if autonomous mode is on ]

if you're still confused, PM me...

*jeremy
__________________
GitHub - Collaborate on code, documentation, etc. - http://github.com
  #3   Spotlight this post!  
Unread 05-02-2003, 23:23
wwrye wwrye is offline
Registered User
#0057 (Leopards)
 
Join Date: Jan 2003
Location: Houston
Posts: 18
wwrye is an unknown quantity at this point
next15 label

With that logic, you are going to be going through the next15 label regardless of auton_mode's value. If you use labels, you need to do something like this:

Code:
If auton_mode = 1 then got do_auton

'regular code in here

goto skip_auton
do_autonomous:

'autonomous goes in here

skip_auton:
A better option, if you're comfortable with 2.5 syntax is something like this:
Code:
 if auton_mode = 1 then
'autonomous stuff here
else
'non-autonomous code in here
endif

Last edited by wwrye : 05-02-2003 at 23:32.
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


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

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