Thread: Fighting PID
View Single Post
  #4   Spotlight this post!  
Unread 20-02-2011, 22:47
Geek 2.0 Geek 2.0 is offline
Registered User
FRC #0107
Team Role: Programmer
 
Join Date: Sep 2009
Rookie Year: 2008
Location: Holland, MI
Posts: 120
Geek 2.0 will become famous soon enough
Re: Fighting PID

I must say, I'm having a bit of trouble understanding what WPILibJ is doing. I'm trying to use it as a reference, but it's contradicting itself. Another example of something that doesn't make much sense:
Code:
if (m_continuous)
{
      if (Math.abs(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;
              }
       }
}
Continuous means that we don't use maximum and minimum input values. but apparently if we're continuous, we're referencing maximum and minimum inputs values!!! What's going on now??

Maybe I shouldn't use this as a reference...