PID library (not mine)

Dependents:   ElecPneuShifter_4 ipod

Committer:
WarwickRacing
Date:
Sun Nov 28 14:20:07 2010 +0000
Revision:
0:9fe5d80c3c5e

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WarwickRacing 0:9fe5d80c3c5e 1 /**
WarwickRacing 0:9fe5d80c3c5e 2 * @author Aaron Berk
WarwickRacing 0:9fe5d80c3c5e 3 *
WarwickRacing 0:9fe5d80c3c5e 4 * @section LICENSE
WarwickRacing 0:9fe5d80c3c5e 5 *
WarwickRacing 0:9fe5d80c3c5e 6 * Copyright (c) 2010 ARM Limited
WarwickRacing 0:9fe5d80c3c5e 7 *
WarwickRacing 0:9fe5d80c3c5e 8 * Permission is hereby granted, free of charge, to any person obtaining a copy
WarwickRacing 0:9fe5d80c3c5e 9 * of this software and associated documentation files (the "Software"), to deal
WarwickRacing 0:9fe5d80c3c5e 10 * in the Software without restriction, including without limitation the rights
WarwickRacing 0:9fe5d80c3c5e 11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
WarwickRacing 0:9fe5d80c3c5e 12 * copies of the Software, and to permit persons to whom the Software is
WarwickRacing 0:9fe5d80c3c5e 13 * furnished to do so, subject to the following conditions:
WarwickRacing 0:9fe5d80c3c5e 14 *
WarwickRacing 0:9fe5d80c3c5e 15 * The above copyright notice and this permission notice shall be included in
WarwickRacing 0:9fe5d80c3c5e 16 * all copies or substantial portions of the Software.
WarwickRacing 0:9fe5d80c3c5e 17 *
WarwickRacing 0:9fe5d80c3c5e 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
WarwickRacing 0:9fe5d80c3c5e 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
WarwickRacing 0:9fe5d80c3c5e 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
WarwickRacing 0:9fe5d80c3c5e 21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
WarwickRacing 0:9fe5d80c3c5e 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
WarwickRacing 0:9fe5d80c3c5e 23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
WarwickRacing 0:9fe5d80c3c5e 24 * THE SOFTWARE.
WarwickRacing 0:9fe5d80c3c5e 25 *
WarwickRacing 0:9fe5d80c3c5e 26 * @section DESCRIPTION
WarwickRacing 0:9fe5d80c3c5e 27 *
WarwickRacing 0:9fe5d80c3c5e 28 * A PID controller is a widely used feedback controller commonly found in
WarwickRacing 0:9fe5d80c3c5e 29 * industry.
WarwickRacing 0:9fe5d80c3c5e 30 *
WarwickRacing 0:9fe5d80c3c5e 31 * This library is a port of Brett Beauregard's Arduino PID library:
WarwickRacing 0:9fe5d80c3c5e 32 *
WarwickRacing 0:9fe5d80c3c5e 33 * http://www.arduino.cc/playground/Code/PIDLibrary
WarwickRacing 0:9fe5d80c3c5e 34 *
WarwickRacing 0:9fe5d80c3c5e 35 * The wikipedia article on PID controllers is a good place to start on
WarwickRacing 0:9fe5d80c3c5e 36 * understanding how they work:
WarwickRacing 0:9fe5d80c3c5e 37 *
WarwickRacing 0:9fe5d80c3c5e 38 * http://en.wikipedia.org/wiki/PID_controller
WarwickRacing 0:9fe5d80c3c5e 39 *
WarwickRacing 0:9fe5d80c3c5e 40 * For a clear and elegant explanation of how to implement and tune a
WarwickRacing 0:9fe5d80c3c5e 41 * controller, the controlguru website by Douglas J. Cooper (who also happened
WarwickRacing 0:9fe5d80c3c5e 42 * to be Brett's controls professor) is an excellent reference:
WarwickRacing 0:9fe5d80c3c5e 43 *
WarwickRacing 0:9fe5d80c3c5e 44 * http://www.controlguru.com/
WarwickRacing 0:9fe5d80c3c5e 45 */
WarwickRacing 0:9fe5d80c3c5e 46
WarwickRacing 0:9fe5d80c3c5e 47 /**
WarwickRacing 0:9fe5d80c3c5e 48 * Includes
WarwickRacing 0:9fe5d80c3c5e 49 */
WarwickRacing 0:9fe5d80c3c5e 50 #include "PID.h"
WarwickRacing 0:9fe5d80c3c5e 51
WarwickRacing 0:9fe5d80c3c5e 52 PID::PID(float Kc, float tauI, float tauD, float interval) {
WarwickRacing 0:9fe5d80c3c5e 53
WarwickRacing 0:9fe5d80c3c5e 54 usingFeedForward = false;
WarwickRacing 0:9fe5d80c3c5e 55 inAuto = false;
WarwickRacing 0:9fe5d80c3c5e 56
WarwickRacing 0:9fe5d80c3c5e 57 //Default the limits to the full range of I/O: 3.3V
WarwickRacing 0:9fe5d80c3c5e 58 //Make sure to set these to more appropriate limits for
WarwickRacing 0:9fe5d80c3c5e 59 //your application.
WarwickRacing 0:9fe5d80c3c5e 60 setInputLimits(0.0, 3.3);
WarwickRacing 0:9fe5d80c3c5e 61 setOutputLimits(0.0, 3.3);
WarwickRacing 0:9fe5d80c3c5e 62
WarwickRacing 0:9fe5d80c3c5e 63 tSample_ = interval;
WarwickRacing 0:9fe5d80c3c5e 64
WarwickRacing 0:9fe5d80c3c5e 65 setTunings(Kc, tauI, tauD);
WarwickRacing 0:9fe5d80c3c5e 66
WarwickRacing 0:9fe5d80c3c5e 67 setPoint_ = 0.0;
WarwickRacing 0:9fe5d80c3c5e 68 processVariable_ = 0.0;
WarwickRacing 0:9fe5d80c3c5e 69 prevProcessVariable_ = 0.0;
WarwickRacing 0:9fe5d80c3c5e 70 controllerOutput_ = 0.0;
WarwickRacing 0:9fe5d80c3c5e 71 prevControllerOutput_ = 0.0;
WarwickRacing 0:9fe5d80c3c5e 72
WarwickRacing 0:9fe5d80c3c5e 73 accError_ = 0.0;
WarwickRacing 0:9fe5d80c3c5e 74 bias_ = 0.0;
WarwickRacing 0:9fe5d80c3c5e 75
WarwickRacing 0:9fe5d80c3c5e 76 realOutput_ = 0.0;
WarwickRacing 0:9fe5d80c3c5e 77
WarwickRacing 0:9fe5d80c3c5e 78 }
WarwickRacing 0:9fe5d80c3c5e 79
WarwickRacing 0:9fe5d80c3c5e 80 void PID::setInputLimits(float inMin, float inMax) {
WarwickRacing 0:9fe5d80c3c5e 81
WarwickRacing 0:9fe5d80c3c5e 82 //Make sure we haven't been given impossible values.
WarwickRacing 0:9fe5d80c3c5e 83 if (inMin >= inMax) {
WarwickRacing 0:9fe5d80c3c5e 84 return;
WarwickRacing 0:9fe5d80c3c5e 85 }
WarwickRacing 0:9fe5d80c3c5e 86
WarwickRacing 0:9fe5d80c3c5e 87 //Rescale the working variables to reflect the changes.
WarwickRacing 0:9fe5d80c3c5e 88 prevProcessVariable_ *= (inMax - inMin) / inSpan_;
WarwickRacing 0:9fe5d80c3c5e 89 accError_ *= (inMax - inMin) / inSpan_;
WarwickRacing 0:9fe5d80c3c5e 90
WarwickRacing 0:9fe5d80c3c5e 91 //Make sure the working variables are within the new limits.
WarwickRacing 0:9fe5d80c3c5e 92 if (prevProcessVariable_ > 1) {
WarwickRacing 0:9fe5d80c3c5e 93 prevProcessVariable_ = 1;
WarwickRacing 0:9fe5d80c3c5e 94 } else if (prevProcessVariable_ < 0) {
WarwickRacing 0:9fe5d80c3c5e 95 prevProcessVariable_ = 0;
WarwickRacing 0:9fe5d80c3c5e 96 }
WarwickRacing 0:9fe5d80c3c5e 97
WarwickRacing 0:9fe5d80c3c5e 98 inMin_ = inMin;
WarwickRacing 0:9fe5d80c3c5e 99 inMax_ = inMax;
WarwickRacing 0:9fe5d80c3c5e 100 inSpan_ = inMax - inMin;
WarwickRacing 0:9fe5d80c3c5e 101
WarwickRacing 0:9fe5d80c3c5e 102 }
WarwickRacing 0:9fe5d80c3c5e 103
WarwickRacing 0:9fe5d80c3c5e 104 void PID::setOutputLimits(float outMin, float outMax) {
WarwickRacing 0:9fe5d80c3c5e 105
WarwickRacing 0:9fe5d80c3c5e 106 //Make sure we haven't been given impossible values.
WarwickRacing 0:9fe5d80c3c5e 107 if (outMin >= outMax) {
WarwickRacing 0:9fe5d80c3c5e 108 return;
WarwickRacing 0:9fe5d80c3c5e 109 }
WarwickRacing 0:9fe5d80c3c5e 110
WarwickRacing 0:9fe5d80c3c5e 111 //Rescale the working variables to reflect the changes.
WarwickRacing 0:9fe5d80c3c5e 112 prevControllerOutput_ *= (outMax - outMin) / outSpan_;
WarwickRacing 0:9fe5d80c3c5e 113
WarwickRacing 0:9fe5d80c3c5e 114 //Make sure the working variables are within the new limits.
WarwickRacing 0:9fe5d80c3c5e 115 if (prevControllerOutput_ > 1) {
WarwickRacing 0:9fe5d80c3c5e 116 prevControllerOutput_ = 1;
WarwickRacing 0:9fe5d80c3c5e 117 } else if (prevControllerOutput_ < 0) {
WarwickRacing 0:9fe5d80c3c5e 118 prevControllerOutput_ = 0;
WarwickRacing 0:9fe5d80c3c5e 119 }
WarwickRacing 0:9fe5d80c3c5e 120
WarwickRacing 0:9fe5d80c3c5e 121 outMin_ = outMin;
WarwickRacing 0:9fe5d80c3c5e 122 outMax_ = outMax;
WarwickRacing 0:9fe5d80c3c5e 123 outSpan_ = outMax - outMin;
WarwickRacing 0:9fe5d80c3c5e 124
WarwickRacing 0:9fe5d80c3c5e 125 }
WarwickRacing 0:9fe5d80c3c5e 126
WarwickRacing 0:9fe5d80c3c5e 127 void PID::setTunings(float Kc, float tauI, float tauD) {
WarwickRacing 0:9fe5d80c3c5e 128
WarwickRacing 0:9fe5d80c3c5e 129 //Verify that the tunings make sense.
WarwickRacing 0:9fe5d80c3c5e 130 if (Kc == 0.0 || tauI < 0.0 || tauD < 0.0) {
WarwickRacing 0:9fe5d80c3c5e 131 return;
WarwickRacing 0:9fe5d80c3c5e 132 }
WarwickRacing 0:9fe5d80c3c5e 133
WarwickRacing 0:9fe5d80c3c5e 134 //Store raw values to hand back to user on request.
WarwickRacing 0:9fe5d80c3c5e 135 pParam_ = Kc;
WarwickRacing 0:9fe5d80c3c5e 136 iParam_ = tauI;
WarwickRacing 0:9fe5d80c3c5e 137 dParam_ = tauD;
WarwickRacing 0:9fe5d80c3c5e 138
WarwickRacing 0:9fe5d80c3c5e 139 float tempTauR;
WarwickRacing 0:9fe5d80c3c5e 140
WarwickRacing 0:9fe5d80c3c5e 141 if (tauI == 0.0) {
WarwickRacing 0:9fe5d80c3c5e 142 tempTauR = 0.0;
WarwickRacing 0:9fe5d80c3c5e 143 } else {
WarwickRacing 0:9fe5d80c3c5e 144 tempTauR = (1.0 / tauI) * tSample_;
WarwickRacing 0:9fe5d80c3c5e 145 }
WarwickRacing 0:9fe5d80c3c5e 146
WarwickRacing 0:9fe5d80c3c5e 147 //For "bumpless transfer" we need to rescale the accumulated error.
WarwickRacing 0:9fe5d80c3c5e 148 if (inAuto) {
WarwickRacing 0:9fe5d80c3c5e 149 if (tempTauR == 0.0) {
WarwickRacing 0:9fe5d80c3c5e 150 accError_ = 0.0;
WarwickRacing 0:9fe5d80c3c5e 151 } else {
WarwickRacing 0:9fe5d80c3c5e 152 accError_ *= (Kc_ * tauR_) / (Kc * tempTauR);
WarwickRacing 0:9fe5d80c3c5e 153 }
WarwickRacing 0:9fe5d80c3c5e 154 }
WarwickRacing 0:9fe5d80c3c5e 155
WarwickRacing 0:9fe5d80c3c5e 156 Kc_ = Kc;
WarwickRacing 0:9fe5d80c3c5e 157 tauR_ = tempTauR;
WarwickRacing 0:9fe5d80c3c5e 158 tauD_ = tauD / tSample_;
WarwickRacing 0:9fe5d80c3c5e 159
WarwickRacing 0:9fe5d80c3c5e 160 }
WarwickRacing 0:9fe5d80c3c5e 161
WarwickRacing 0:9fe5d80c3c5e 162 void PID::reset(void) {
WarwickRacing 0:9fe5d80c3c5e 163
WarwickRacing 0:9fe5d80c3c5e 164 float scaledBias = 0.0;
WarwickRacing 0:9fe5d80c3c5e 165
WarwickRacing 0:9fe5d80c3c5e 166 if (usingFeedForward) {
WarwickRacing 0:9fe5d80c3c5e 167 scaledBias = (bias_ - outMin_) / outSpan_;
WarwickRacing 0:9fe5d80c3c5e 168 } else {
WarwickRacing 0:9fe5d80c3c5e 169 scaledBias = (realOutput_ - outMin_) / outSpan_;
WarwickRacing 0:9fe5d80c3c5e 170 }
WarwickRacing 0:9fe5d80c3c5e 171
WarwickRacing 0:9fe5d80c3c5e 172 prevControllerOutput_ = scaledBias;
WarwickRacing 0:9fe5d80c3c5e 173 prevProcessVariable_ = (processVariable_ - inMin_) / inSpan_;
WarwickRacing 0:9fe5d80c3c5e 174
WarwickRacing 0:9fe5d80c3c5e 175 //Clear any error in the integral.
WarwickRacing 0:9fe5d80c3c5e 176 accError_ = 0;
WarwickRacing 0:9fe5d80c3c5e 177
WarwickRacing 0:9fe5d80c3c5e 178 }
WarwickRacing 0:9fe5d80c3c5e 179
WarwickRacing 0:9fe5d80c3c5e 180 void PID::setMode(int mode) {
WarwickRacing 0:9fe5d80c3c5e 181
WarwickRacing 0:9fe5d80c3c5e 182 //We were in manual, and we just got set to auto.
WarwickRacing 0:9fe5d80c3c5e 183 //Reset the controller internals.
WarwickRacing 0:9fe5d80c3c5e 184 if (mode != 0 && !inAuto) {
WarwickRacing 0:9fe5d80c3c5e 185 reset();
WarwickRacing 0:9fe5d80c3c5e 186 }
WarwickRacing 0:9fe5d80c3c5e 187
WarwickRacing 0:9fe5d80c3c5e 188 inAuto = (mode != 0);
WarwickRacing 0:9fe5d80c3c5e 189
WarwickRacing 0:9fe5d80c3c5e 190 }
WarwickRacing 0:9fe5d80c3c5e 191
WarwickRacing 0:9fe5d80c3c5e 192 void PID::setInterval(float interval) {
WarwickRacing 0:9fe5d80c3c5e 193
WarwickRacing 0:9fe5d80c3c5e 194 if (interval > 0) {
WarwickRacing 0:9fe5d80c3c5e 195 //Convert the time-based tunings to reflect this change.
WarwickRacing 0:9fe5d80c3c5e 196 tauR_ *= (interval / tSample_);
WarwickRacing 0:9fe5d80c3c5e 197 accError_ *= (tSample_ / interval);
WarwickRacing 0:9fe5d80c3c5e 198 tauD_ *= (interval / tSample_);
WarwickRacing 0:9fe5d80c3c5e 199 tSample_ = interval;
WarwickRacing 0:9fe5d80c3c5e 200 }
WarwickRacing 0:9fe5d80c3c5e 201
WarwickRacing 0:9fe5d80c3c5e 202 }
WarwickRacing 0:9fe5d80c3c5e 203
WarwickRacing 0:9fe5d80c3c5e 204 void PID::setSetPoint(float sp) {
WarwickRacing 0:9fe5d80c3c5e 205
WarwickRacing 0:9fe5d80c3c5e 206 setPoint_ = sp;
WarwickRacing 0:9fe5d80c3c5e 207
WarwickRacing 0:9fe5d80c3c5e 208 }
WarwickRacing 0:9fe5d80c3c5e 209
WarwickRacing 0:9fe5d80c3c5e 210 void PID::setProcessValue(float pv) {
WarwickRacing 0:9fe5d80c3c5e 211
WarwickRacing 0:9fe5d80c3c5e 212 processVariable_ = pv;
WarwickRacing 0:9fe5d80c3c5e 213
WarwickRacing 0:9fe5d80c3c5e 214 }
WarwickRacing 0:9fe5d80c3c5e 215
WarwickRacing 0:9fe5d80c3c5e 216 void PID::setBias(float bias){
WarwickRacing 0:9fe5d80c3c5e 217
WarwickRacing 0:9fe5d80c3c5e 218 bias_ = bias;
WarwickRacing 0:9fe5d80c3c5e 219 usingFeedForward = 1;
WarwickRacing 0:9fe5d80c3c5e 220
WarwickRacing 0:9fe5d80c3c5e 221 }
WarwickRacing 0:9fe5d80c3c5e 222
WarwickRacing 0:9fe5d80c3c5e 223 float PID::compute() {
WarwickRacing 0:9fe5d80c3c5e 224
WarwickRacing 0:9fe5d80c3c5e 225 //Pull in the input and setpoint, and scale them into percent span.
WarwickRacing 0:9fe5d80c3c5e 226 float scaledPV = (processVariable_ - inMin_) / inSpan_;
WarwickRacing 0:9fe5d80c3c5e 227
WarwickRacing 0:9fe5d80c3c5e 228 if (scaledPV > 1.0) {
WarwickRacing 0:9fe5d80c3c5e 229 scaledPV = 1.0;
WarwickRacing 0:9fe5d80c3c5e 230 } else if (scaledPV < 0.0) {
WarwickRacing 0:9fe5d80c3c5e 231 scaledPV = 0.0;
WarwickRacing 0:9fe5d80c3c5e 232 }
WarwickRacing 0:9fe5d80c3c5e 233
WarwickRacing 0:9fe5d80c3c5e 234 float scaledSP = (setPoint_ - inMin_) / inSpan_;
WarwickRacing 0:9fe5d80c3c5e 235 if (scaledSP > 1.0) {
WarwickRacing 0:9fe5d80c3c5e 236 scaledSP = 1;
WarwickRacing 0:9fe5d80c3c5e 237 } else if (scaledSP < 0.0) {
WarwickRacing 0:9fe5d80c3c5e 238 scaledSP = 0;
WarwickRacing 0:9fe5d80c3c5e 239 }
WarwickRacing 0:9fe5d80c3c5e 240
WarwickRacing 0:9fe5d80c3c5e 241 float error = scaledSP - scaledPV;
WarwickRacing 0:9fe5d80c3c5e 242
WarwickRacing 0:9fe5d80c3c5e 243 //Check and see if the output is pegged at a limit and only
WarwickRacing 0:9fe5d80c3c5e 244 //integrate if it is not. This is to prevent reset-windup.
WarwickRacing 0:9fe5d80c3c5e 245 if (!(prevControllerOutput_ >= 1 && error > 0) && !(prevControllerOutput_ <= 0 && error < 0)) {
WarwickRacing 0:9fe5d80c3c5e 246 accError_ += error;
WarwickRacing 0:9fe5d80c3c5e 247 }
WarwickRacing 0:9fe5d80c3c5e 248
WarwickRacing 0:9fe5d80c3c5e 249 //Compute the current slope of the input signal.
WarwickRacing 0:9fe5d80c3c5e 250 float dMeas = (scaledPV - prevProcessVariable_) / tSample_;
WarwickRacing 0:9fe5d80c3c5e 251
WarwickRacing 0:9fe5d80c3c5e 252 float scaledBias = 0.0;
WarwickRacing 0:9fe5d80c3c5e 253
WarwickRacing 0:9fe5d80c3c5e 254 if (usingFeedForward) {
WarwickRacing 0:9fe5d80c3c5e 255 scaledBias = (bias_ - outMin_) / outSpan_;
WarwickRacing 0:9fe5d80c3c5e 256 }
WarwickRacing 0:9fe5d80c3c5e 257
WarwickRacing 0:9fe5d80c3c5e 258 //Perform the PID calculation.
WarwickRacing 0:9fe5d80c3c5e 259 controllerOutput_ = scaledBias + Kc_ * (error + (tauR_ * accError_) - (tauD_ * dMeas));
WarwickRacing 0:9fe5d80c3c5e 260
WarwickRacing 0:9fe5d80c3c5e 261 //Make sure the computed output is within output constraints.
WarwickRacing 0:9fe5d80c3c5e 262 if (controllerOutput_ < 0.0) {
WarwickRacing 0:9fe5d80c3c5e 263 controllerOutput_ = 0.0;
WarwickRacing 0:9fe5d80c3c5e 264 } else if (controllerOutput_ > 1.0) {
WarwickRacing 0:9fe5d80c3c5e 265 controllerOutput_ = 1.0;
WarwickRacing 0:9fe5d80c3c5e 266 }
WarwickRacing 0:9fe5d80c3c5e 267
WarwickRacing 0:9fe5d80c3c5e 268 //Remember this output for the windup check next time.
WarwickRacing 0:9fe5d80c3c5e 269 prevControllerOutput_ = controllerOutput_;
WarwickRacing 0:9fe5d80c3c5e 270 //Remember the input for the derivative calculation next time.
WarwickRacing 0:9fe5d80c3c5e 271 prevProcessVariable_ = scaledPV;
WarwickRacing 0:9fe5d80c3c5e 272
WarwickRacing 0:9fe5d80c3c5e 273 //Scale the output from percent span back out to a real world number.
WarwickRacing 0:9fe5d80c3c5e 274 return ((controllerOutput_ * outSpan_) + outMin_);
WarwickRacing 0:9fe5d80c3c5e 275
WarwickRacing 0:9fe5d80c3c5e 276 }
WarwickRacing 0:9fe5d80c3c5e 277
WarwickRacing 0:9fe5d80c3c5e 278 float PID::getInMin() {
WarwickRacing 0:9fe5d80c3c5e 279
WarwickRacing 0:9fe5d80c3c5e 280 return inMin_;
WarwickRacing 0:9fe5d80c3c5e 281
WarwickRacing 0:9fe5d80c3c5e 282 }
WarwickRacing 0:9fe5d80c3c5e 283
WarwickRacing 0:9fe5d80c3c5e 284 float PID::getInMax() {
WarwickRacing 0:9fe5d80c3c5e 285
WarwickRacing 0:9fe5d80c3c5e 286 return inMax_;
WarwickRacing 0:9fe5d80c3c5e 287
WarwickRacing 0:9fe5d80c3c5e 288 }
WarwickRacing 0:9fe5d80c3c5e 289
WarwickRacing 0:9fe5d80c3c5e 290 float PID::getOutMin() {
WarwickRacing 0:9fe5d80c3c5e 291
WarwickRacing 0:9fe5d80c3c5e 292 return outMin_;
WarwickRacing 0:9fe5d80c3c5e 293
WarwickRacing 0:9fe5d80c3c5e 294 }
WarwickRacing 0:9fe5d80c3c5e 295
WarwickRacing 0:9fe5d80c3c5e 296 float PID::getOutMax() {
WarwickRacing 0:9fe5d80c3c5e 297
WarwickRacing 0:9fe5d80c3c5e 298 return outMax_;
WarwickRacing 0:9fe5d80c3c5e 299
WarwickRacing 0:9fe5d80c3c5e 300 }
WarwickRacing 0:9fe5d80c3c5e 301
WarwickRacing 0:9fe5d80c3c5e 302 float PID::getInterval() {
WarwickRacing 0:9fe5d80c3c5e 303
WarwickRacing 0:9fe5d80c3c5e 304 return tSample_;
WarwickRacing 0:9fe5d80c3c5e 305
WarwickRacing 0:9fe5d80c3c5e 306 }
WarwickRacing 0:9fe5d80c3c5e 307
WarwickRacing 0:9fe5d80c3c5e 308 float PID::getPParam() {
WarwickRacing 0:9fe5d80c3c5e 309
WarwickRacing 0:9fe5d80c3c5e 310 return pParam_;
WarwickRacing 0:9fe5d80c3c5e 311
WarwickRacing 0:9fe5d80c3c5e 312 }
WarwickRacing 0:9fe5d80c3c5e 313
WarwickRacing 0:9fe5d80c3c5e 314 float PID::getIParam() {
WarwickRacing 0:9fe5d80c3c5e 315
WarwickRacing 0:9fe5d80c3c5e 316 return iParam_;
WarwickRacing 0:9fe5d80c3c5e 317
WarwickRacing 0:9fe5d80c3c5e 318 }
WarwickRacing 0:9fe5d80c3c5e 319
WarwickRacing 0:9fe5d80c3c5e 320 float PID::getDParam() {
WarwickRacing 0:9fe5d80c3c5e 321
WarwickRacing 0:9fe5d80c3c5e 322 return dParam_;
WarwickRacing 0:9fe5d80c3c5e 323
WarwickRacing 0:9fe5d80c3c5e 324 }