View Single Post
  #4   Spotlight this post!  
Unread 30-01-2011, 11:27
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Motor balancing (encoders?)

It isn't a common problem. If you are getting significantly different response on the two sides of your drive base, something is wrong with the hardware. It would be better to fix the cause rather than patch it with software.

But if you do want to mask the mechanical or electrical issue, you can use the gyro to modify the X axis input to the Arcade Drive function. Use the joystick as a rudder to determine the desired heading by applying a delta to the current heading as read from the gyro. Use that desired heading as the setpoint of a PID block that reads the current gyro angle and provides the X axis control.

When you're not calling for a turn, the PID will apply whatever turn command is necessary to keep the robot facing the same direction.
Reply With Quote