View Single Post
  #3   Spotlight this post!  
Unread 20-02-2006, 22:14
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: Preventing drift

You could over-complicate things and mount encoders on each side.

Or you could record each side's RPMs and do

Faster Side RPM / Slower Side RPM

Multiply that value by the speed you would normally output to the faster motor and you are done. This theoretically will vary with battery voltage and the like, but it comes to the point where it is not noticable.

Sample code:
Code:
#define SPEED_COMP .95 // This is Faster Side RPM / Slower Side RPM

// Assuming your left side is faster
RIGHT_SIDE = p1_y;
LEFT_SIDE = p2_y * SPEED_COMP;
KISS.

EDIT: Happy 700th post to me =)
__________________
http://www.mikesorrenti.com/