View Single Post
  #1   Spotlight this post!  
Unread 30-01-2016, 15:28
Tominator368 Tominator368 is offline
Registered User
AKA: Thomas Schweich
FRC #4500 (Robohounds)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: STL
Posts: 5
Tominator368 is an unknown quantity at this point
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:
  1. Create a PIDController object, handing it the proper P,I, and D values, as well as instances of the following two classes:
  2. Create a class extending PIDSource and hand it the value of the controller in PIDget()
  3. Create a class extending PIDOutput and have it change some value inside of PIDWrite()
  4. Use the output of the controllers as needed

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 : 30-01-2016 at 22:00. Reason: SOLVED
Reply With Quote