Go to Post This isn't a science fair, sometimes it's okay to give away the answer, especially if they learned something on the way there. - Karthik [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 20-01-2004, 21:44
cgav cgav is offline
Registered User
#0122
 
Join Date: Jan 2004
Location: Yorktown
Posts: 1
cgav is an unknown quantity at this point
Sample Code (Line travel)

Does anyone have a sample algorithm for the autonomous mode (Line travel)? Thanks.
  #2   Spotlight this post!  
Unread 21-01-2004, 09:37
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
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,721
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: Sample Code (Line travel)

Quote:
Originally Posted by cgav
Does anyone have a sample algorithm for the autonomous mode (Line travel)? Thanks.
This sample is from the EDU tutorial at: http://www.rec.ri.cmu.edu/education/...tent/index.htm

[code]
/* This program will track the left side of a dark line.
For this program to work, an IR Reflective Sensor must
be attached to Digital I/O Port 6, and must be placed at a
height where it reads 0 over a dark surface, and some other
number over a light surface. An analog optical sensor may also
be used, but the values in the program must be changed to
correspond to this light sensor's threshold between light
and dark values. */

void Default_Routine(void)/* BEGIN Default_Routine(); */
{

if(rc_dig_in06 == 0) /* if dark is seen */
{
pwm01=pwm03=127; /* turn left motors off */
pwm02=pwm04=96; /* turn right motors forward slowly */
}
else
{
pwm01=pwm03=159; /* turn left motors forward slowly */
pwm02=pwm04=127; /* turn right motors off */
}

printf("%d\n", rc_dig_in06); /* print light sensor readings */

} /* END Default_Routine(); */
[\code]
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
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
Autonomous Code From Experience EbonySeraphim Programming 7 14-03-2003 21:56
Sprockets and Roller Chain Models Madison Inventor 3 04-02-2003 11:51
Does your team use the Default code. Jeff McCune General Forum 2 09-01-2003 14:46
iParts on firstcadlibrary.com Ed Sparks Inventor 3 08-01-2003 23:30
approach to autonomy Mike375 Programming 32 08-01-2003 14:04


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

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