View Single Post
  #6   Spotlight this post!  
Unread 02-02-2008, 23:50
intellec7's Avatar
intellec7 intellec7 is offline
108 programmer
AKA: Gustavo
FRC #0108 (SigmaC@ts)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2006
Location: Hollywood, Florida
Posts: 65
intellec7 is on a distinguished road
Send a message via AIM to intellec7 Send a message via MSN to intellec7
Re: How to get robot to drive straigth using shaft encoders

The best way I know of driving straight with encoders to ensure that the wheels not only maintain in sync, but if they get out of sync , the robot returns back to it's original line is:

During an equal period take the difference between the encoder counts

Integrate this difference.

The result of the integration should be used to offset the commanded wheel commands. See the pseudo code below:

current_difference = left_count - right_count
integrated_error = integrated_error + current_difference

Left_Drive = Commanded_Left_Drive + integrated_error
Right_Drive = Commanded_Left_Drive - integrated_error

Let me know if I should make it clearer