View Single Post
  #4   Spotlight this post!  
Unread 09-11-2007, 10:50
charrisTTI charrisTTI is offline
Ramblin' Wreck
AKA: Charles Harris
FRC #0623
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Vienna, VA
Posts: 106
charrisTTI has a spectacular aura aboutcharrisTTI has a spectacular aura about
Send a message via AIM to charrisTTI
Re: programing the vex optical shaft encoder

your program assumes that all the motors go exactly the same speed and stop/start immediately.

you need to take inertia of your system into account.

looks like a typo for the compare value of rot_encoder2: rot_encoder2 < 2 should probably be rot_encoder2 < 20 (in several places)

try evaluating each encoder value separately and turn the corresponding motor off when that encoder reaches the desired value.

you may also need to accelerate and decelerate the motors rather than just a hard stop and start to reduce overshoot.
__________________
FRC 623 2003,2004,2005,2006,2007,2008, 2009, 2010, 2011
FRC 1900 2007
FVC 60 and 193 2006
FVC 3271 2007
FTC 226 and 369 2008, 2009, 2010, 2011
FTC 3806 2010