![]() |
Fighting PID
I have yet to try this, but I'm curious...
I want to control the facing direction of the robot with a gyro and PID AND I want to control the travel direction of the robot with an accelerometer and PID. Will these two PIDs fight each other? If so, how would I program around that? Also, what's a good way to program it, considering I can only use one pidWrite() function per class? |
Re: Fighting PID
One solution:
Write a PID loop from scratch; it is a win win situation. You solve that problem, and you learn how to make a PID Loop and how it functions. |
Re: Fighting PID
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) |
Re: Fighting PID
Quote:
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. |
Re: Fighting PID
We've always written our own PID loops. I have never used the PIDs given to us, I find that if you make you're own you can customize it to what you need. It's not that difficult, I use Labview though.
|
Re: Fighting PID
Quote:
|
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)Maybe I shouldn't use this as a reference... |
Re: Fighting PID
Continuous mode still uses the min and max values, but not as limits--instead, it assumes that the shortest route to the setpoint can be achieved by going past the max back to the min and vice/versa. At least, if the comment on the SetContinuous method is to be believed..
|
Re: Fighting PID
Wow, just wrote a lot of code (with no testing in between... this'll end poorly).
Thanks, that makes sense. Since I don't have that, I'm not supporting that feature. It all works out now. |
Re: Fighting PID
Quote:
Quote:
|
| All times are GMT -5. The time now is 03:44. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi