|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Running Two Simultaneous PID Loops
I am having a similar problem to the one found in this http://www.chiefdelphi.com/forums/sh...d.php?t=114061 thread; I want to be able to run multiple different PID loops from the same subsystem. Does anyone know a relatively modular way to create as many PID loops as you want? I'm not sure if it's as straightforward as this:
I'm struggling to find much documentation or examples regarding these classes and methods, and I'm not sure if that's actually what they do, I'll admit it's basically a guess as to what they are. If anyone could let me know if I'm thinking along the right lines or if I'm misunderstanding these functions that would be great. I may need to implement as many as 3 different PID loops to control the same hardware depending on the scenario, some of them combined with others. Thanks. EDIT: I ended up just wrapping PIDOutput in a class I called PIDHandler which simply returns the output of the controller in a getValue() method as the "output". I then was able to use those raw outputs in my calculations. Last edited by Tominator368 : 01-30-2016 at 10:00 PM. Reason: SOLVED |
|
#2
|
||||
|
||||
|
Re: Running Two Simultaneous PID Loops
Can you explain what exactly you're trying to accomplish? There might be a better way then chaining 3 different PIDs.
In that thread the use-case is to have one PID control driving a distance (encoders) and another PID control heading(gyro). They sum nicely by adding/subtracting the heading correction on top of the distance-PID. How many sensor sources do you have? |
|
#3
|
|||
|
|||
|
Re: Running Two Simultaneous PID Loops
Hi ozrien,
To start, I'd like to be able to do pretty much exactly what is described in that thread:
|
|
#4
|
||||||
|
||||||
|
Re: Running Two Simultaneous PID Loops
Quote:
|
|
#5
|
||||
|
||||
|
Re: Running Two Simultaneous PID Loops
Quote:
|
|
#6
|
|||
|
|||
|
Re: Running Two Simultaneous PID Loops
Quote:
The PIDSource is a bit trickier. The pidGet() method should just return the sensor data. All in all they're both just wrappers of data that allow the PIDController class a fixed class to interact with. You may also want to just consider anonymous classes. They simplify your overall project structure. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|