|
Re: GTS Code
Here is another alternative to what usbcd36 said. We are not using quadrature encoders with our drive system but we are using a gear tooth sensor. The following code is what we used for one side to determine if we need to increment or decrement the counter.
Code:
if(pwm13 < 118)
{
Encoder_3_Count -= ENCODER_3_TICK_DELTA;
}
else if (pwm13 > 136)
{
Encoder_3_Count += ENCODER_3_TICK_DELTA;
}
What we are doing is looking at the PWM value for the drive on that side and if it is outside of a designated window we will then increment or decrement the counter based on the value of the PWM.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
|