Go to Post Give yourself the best chance to win at the event you're at by picking the best possible alliance partners available - always. - Rich Kressly [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 20-02-2011, 22:17
Patrickwhite's Avatar
Patrickwhite Patrickwhite is offline
May the North be with you
FRC #0610 (The Coyotes)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Toronto
Posts: 88
Patrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of light
Re: Fighting PID

Quote:
Originally Posted by Geek 2.0 View Post
I'm actually in the process of doing that, and just found a strange problem...

I found this in the PIDController class in WPILibJ:
Code:
if (((m_totalError + m_error) * m_I < m_maximumOutput)
                        && ((m_totalError + m_error) * m_I > m_minimumOutput))
{
       m_totalError += m_error;
}

m_result = (m_P * m_error + m_I * m_totalError + m_D * (m_error - m_prevError));
m_prevError = m_error;
By the looks of it, it's saying that it won't add the error to the total error if the result would be outside the maximum and minimum output. Does that seem wrong to anyone else? Shouldn't it add the error no matter what, and then clip off the result to fit in the max and min output?
That is usually how it's done. There are a few things in WPI's implementation that don't make sense, but overall it's fairly useful.

In terms of your original question, even if you used WPI's implementation, your output doesn't have to feed straight into a motor. If you have them as separate outputs, then decide yourself how to feed them into the speed controllers, there shouldn't be any problem.
__________________
while(!going.isTough());
tough.exit();

What will we do tonight, Warfa?
The same thing we do every night, Patrick. Sit and wait for Electrical.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 23:33.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi