View Single Post
  #17   Spotlight this post!  
Unread 23-02-2012, 19:46
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
Re: Help me understand PIDController::OnTarget()

Code:
				
if (fabs(m_error) > (m_maximumInput - m_minimumInput) / 2)
    {
        if (m_error > 0)
       {
            m_error = m_error - m_maximumInput + m_minimumInput;
       }
       else
       {
           m_error = m_error + m_maximumInput - m_minimumInput;
       }
}
Now that you brought this code up, would someone mind explaining why it is there? What is maximumInput and minimumInput? They both have a default value of zero. If maximumInput = 1 and minimumInput = -1 then the error is being biased by -2 for m_error>0 and 2 for m_error<0 if abs(m_error) > 1. So lets say that m_error = 1.2 then m_error is biased to become -.8 . What is this accomplishing?

Last edited by vamfun : 23-02-2012 at 20:00.
Reply With Quote