View Single Post
  #1   Spotlight this post!  
Unread 12-03-2011, 13:36
davidalln's Avatar
davidalln davidalln is offline
World's Worst Coder
AKA: David Allen
FRC #2415 (The Westminster Wiredcats)
Team Role: Programmer
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Atlanta, GA
Posts: 108
davidalln is on a distinguished road
Send a message via AIM to davidalln
Re: Line Tracking Code Help

My raw autonomous code wouldn't be much use to you, as its deeply integrated in our system and would be difficult to read if you don't know what everything does. But here's the basic idea:

Code:
if (leftSensorTripped) {
   robotDrive->TankDrive(0.7, 0.8);
} else if (rightSensorTripped) {
   robotDrive->TankDrive(0.8, 0.7);
} else {
   robotDrive->TankDrive(0.7, 0.7);
}
This will gradually get your robot back on the line without overcorrecting. Obviously this is oversimplified and you'll need to adapt it to your bot, but this shows the basic idea. Note that this will not work well in the Y (middle autonomous) as you need a much sharper turn at the corner. For that you need to make a sharper turn.
__________________
SANTOSH ANDREW DECKER RICK WYNNIE SEAN DEREK MATT
(alamo (semis), p'tree (CHAMPS!), nc (CHAMPS!), newton (quarters))


Best four years of my life. Thanks to everyone who made it happen.
Reply With Quote