Go to Post [This year's game manual contains] 46 new pages of pictures displaying how to attach bumpers, assuring at least 15% of teams almost get it right this time. - PayneTrain [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
  #22   Spotlight this post!  
Unread 16-02-2004, 13:47
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Newbie Autonomous Question(s)

Quote:
Originally Posted by LBK Rules
Our team has been trying to code the banners, and we just can't get it to work right.

If somebody can please post some working line fowolling code, I know all of us newbies woud greatly appreciate it.
Well, I can't guarrantee this works, but if you want to look at it...
PHP Code:
// Check if the right sensor is reading the line
if(lineDetectorLeft == ON_LINE)
{
  
// Turn right
  
driveMotorLeft 127;
  
driveMotorRight 254;
}
else if(
lineDetectorRight == ON_LINE)
{
  
// Turn left
  
driveMotorLeft 254;
  
driveMotorRight 127;
}
else
{
  
// Go forward
  
driveMotorLeft 254;
  
driveMotorRight 254;

Subsitute pwmXX for the driveMotorLeft and Rights, the lineDetectorLeft and Rights with the digital inputs they are on, and the ON_LINEs with the value that the sensors read when over the line. This is a very simple algorithm and can be improved, but it gives you the idea. Put it in its own function and continually call it and it will (should) faithfully follow a line.

--EDIT--
You can also adjust the speeds passed to the motors. The way it is now, it might lose the line because it is too fast.
__________________


Last edited by Ryan M. : 16-02-2004 at 13:51.
 


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
A better autonomous method.. randomperson Programming 4 24-02-2004 18:02
Initializing autonomous mode Mr. Lim Programming 7 02-02-2004 07:26
variable? manodrum Programming 11 01-04-2003 17:20
autonomous mode problem on field Chris_C Programming 17 26-03-2003 19:11
Autonomous Kill Switch UCGL_Guy Programming 8 15-01-2003 17:39


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

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