From e776bfa026a75d4807e01e3057336009d38e33d9 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Thu, 4 Apr 2019 18:29:21 -0500 Subject: [PATCH 01/19] Unique name --- PID_v1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PID_v1.h b/PID_v1.h index 9cba046..42851e4 100644 --- a/PID_v1.h +++ b/PID_v1.h @@ -2,7 +2,7 @@ #define PID_v1_h #define LIBRARY_VERSION 1.2.1 -class PID +class PID2 { From aff2e8e688091e33a3c8f28f22690d83d55a7844 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Thu, 4 Apr 2019 18:57:32 -0500 Subject: [PATCH 02/19] Update to 1.2.2 --- PID_v1.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PID_v1.h b/PID_v1.h index 42851e4..f63d05d 100644 --- a/PID_v1.h +++ b/PID_v1.h @@ -1,6 +1,6 @@ #ifndef PID_v1_h #define PID_v1_h -#define LIBRARY_VERSION 1.2.1 +#define LIBRARY_VERSION 1.2.2 class PID2 { @@ -17,11 +17,11 @@ class PID2 #define P_ON_E 1 //commonly used functions ************************************************************************** - PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and + PID2(double*, double*, double*, // * constructor. links the PID to the Input, Output, and double, double, double, int, int);// Setpoint. Initial tuning parameters are also set here. // (overload for specifying proportional mode) - PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and + PID2(double*, double*, double*, // * constructor. links the PID to the Input, Output, and double, double, double, int); // Setpoint. Initial tuning parameters are also set here void SetMode(int Mode); // * sets PID to either Manual (0) or Auto (non-0) From a2764c9461094ae1df22fe539ede0bdabbb538d3 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Thu, 4 Apr 2019 19:05:44 -0500 Subject: [PATCH 03/19] Update to my version - 1.2.2. --- PID_v1.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PID_v1.cpp b/PID_v1.cpp index cb6637c..27175b7 100644 --- a/PID_v1.cpp +++ b/PID_v1.cpp @@ -17,7 +17,7 @@ * The parameters specified here are those for for which we can't set up * reliable defaults, so we need to have the user set them. ***************************************************************************/ -PID::PID(double* Input, double* Output, double* Setpoint, +PID2::PID2(double* Input, double* Output, double* Setpoint, double Kp, double Ki, double Kd, int POn, int ControllerDirection) { myOutput = Output; @@ -41,7 +41,7 @@ PID::PID(double* Input, double* Output, double* Setpoint, * to use Proportional on Error without explicitly saying so ***************************************************************************/ -PID::PID(double* Input, double* Output, double* Setpoint, +PID2::PID2(double* Input, double* Output, double* Setpoint, double Kp, double Ki, double Kd, int ControllerDirection) :PID::PID(Input, Output, Setpoint, Kp, Ki, Kd, P_ON_E, ControllerDirection) { @@ -55,7 +55,7 @@ PID::PID(double* Input, double* Output, double* Setpoint, * pid Output needs to be computed. returns true when the output is computed, * false when nothing has been done. **********************************************************************************/ -bool PID::Compute() +bool PID2::Compute() { if(!inAuto) return false; unsigned long now = millis(); @@ -99,7 +99,7 @@ bool PID::Compute() * it's called automatically from the constructor, but tunings can also * be adjusted on the fly during normal operation ******************************************************************************/ -void PID::SetTunings(double Kp, double Ki, double Kd, int POn) +void PID2::SetTunings(double Kp, double Ki, double Kd, int POn) { if (Kp<0 || Ki<0 || Kd<0) return; @@ -124,14 +124,14 @@ void PID::SetTunings(double Kp, double Ki, double Kd, int POn) /* SetTunings(...)************************************************************* * Set Tunings using the last-rembered POn setting ******************************************************************************/ -void PID::SetTunings(double Kp, double Ki, double Kd){ +void PID2::SetTunings(double Kp, double Ki, double Kd){ SetTunings(Kp, Ki, Kd, pOn); } /* SetSampleTime(...) ********************************************************* * sets the period, in Milliseconds, at which the calculation is performed ******************************************************************************/ -void PID::SetSampleTime(int NewSampleTime) +void PID2::SetSampleTime(int NewSampleTime) { if (NewSampleTime > 0) { @@ -151,7 +151,7 @@ void PID::SetSampleTime(int NewSampleTime) * want to clamp it from 0-125. who knows. at any rate, that can all be done * here. **************************************************************************/ -void PID::SetOutputLimits(double Min, double Max) +void PID2::SetOutputLimits(double Min, double Max) { if(Min >= Max) return; outMin = Min; @@ -172,7 +172,7 @@ void PID::SetOutputLimits(double Min, double Max) * when the transition from manual to auto occurs, the controller is * automatically initialized ******************************************************************************/ -void PID::SetMode(int Mode) +void PID2::SetMode(int Mode) { bool newAuto = (Mode == AUTOMATIC); if(newAuto && !inAuto) @@ -186,7 +186,7 @@ void PID::SetMode(int Mode) * does all the things that need to happen to ensure a bumpless transfer * from manual to automatic mode. ******************************************************************************/ -void PID::Initialize() +void PID2::Initialize() { outputSum = *myOutput; lastInput = *myInput; @@ -200,7 +200,7 @@ void PID::Initialize() * know which one, because otherwise we may increase the output when we should * be decreasing. This is called from the constructor. ******************************************************************************/ -void PID::SetControllerDirection(int Direction) +void PID2::SetControllerDirection(int Direction) { if(inAuto && Direction !=controllerDirection) { From f2ebd6e9cdac439de79ebe3374224ead9d2c9471 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Thu, 4 Apr 2019 19:11:57 -0500 Subject: [PATCH 04/19] Microscopic --- PID_v1.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PID_v1.cpp b/PID_v1.cpp index 27175b7..600e163 100644 --- a/PID_v1.cpp +++ b/PID_v1.cpp @@ -14,7 +14,7 @@ #include /*Constructor (...)********************************************************* - * The parameters specified here are those for for which we can't set up + * The parameters specified here are those for which we can't set up * reliable defaults, so we need to have the user set them. ***************************************************************************/ PID2::PID2(double* Input, double* Output, double* Setpoint, @@ -26,9 +26,9 @@ PID2::PID2(double* Input, double* Output, double* Setpoint, inAuto = false; PID::SetOutputLimits(0, 255); //default output limit corresponds to - //the arduino pwm limits + //the arduino pwm limits - SampleTime = 100; //default Controller Sample Time is 0.1 seconds + SampleTime = 100; //default Controller Sample Time is 0.1 seconds PID::SetControllerDirection(ControllerDirection); PID::SetTunings(Kp, Ki, Kd, POn); @@ -75,7 +75,7 @@ bool PID2::Compute() else if(outputSum < outMin) outputSum= outMin; /*Add Proportional on Error, if P_ON_E is specified*/ - double output; + double output; if(pOnE) output = kp * error; else output = 0; From 71e47598f03c8d4435c6f67e20a5122ac1eafe04 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Thu, 4 Apr 2019 19:12:26 -0500 Subject: [PATCH 05/19] Update PID_v1.cpp --- PID_v1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PID_v1.cpp b/PID_v1.cpp index 600e163..a403c12 100644 --- a/PID_v1.cpp +++ b/PID_v1.cpp @@ -1,5 +1,5 @@ /********************************************************************************************** - * Arduino PID Library - Version 1.2.1 + * Arduino PID Library - Version 1.2.2 * by Brett Beauregard brettbeauregard.com * * This Library is licensed under the MIT License From bb7fb20cd2ba639a510178e8fe127dca62fa3f3f Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 05:20:24 -0500 Subject: [PATCH 06/19] Update README.txt --- README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.txt b/README.txt index 3f2fb63..74a4ba8 100644 --- a/README.txt +++ b/README.txt @@ -1,5 +1,5 @@ *************************************************************** -* Arduino PID Library - Version 1.2.1 +* Arduino PID Library - Version 1.2.2 * by Brett Beauregard brettbeauregard.com * * This Library is licensed under the MIT License From 621c989a28684bced400224c847f9256c5305f8d Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 05:40:44 -0500 Subject: [PATCH 07/19] Update PID_v1.cpp --- PID_v1.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/PID_v1.cpp b/PID_v1.cpp index a403c12..02cecab 100644 --- a/PID_v1.cpp +++ b/PID_v1.cpp @@ -25,13 +25,13 @@ PID2::PID2(double* Input, double* Output, double* Setpoint, mySetpoint = Setpoint; inAuto = false; - PID::SetOutputLimits(0, 255); //default output limit corresponds to + PID2::SetOutputLimits(0, 255); //default output limit corresponds to //the arduino pwm limits SampleTime = 100; //default Controller Sample Time is 0.1 seconds - PID::SetControllerDirection(ControllerDirection); - PID::SetTunings(Kp, Ki, Kd, POn); + PID2::SetControllerDirection(ControllerDirection); + PID2::SetTunings(Kp, Ki, Kd, POn); lastTime = millis()-SampleTime; } @@ -43,7 +43,7 @@ PID2::PID2(double* Input, double* Output, double* Setpoint, PID2::PID2(double* Input, double* Output, double* Setpoint, double Kp, double Ki, double Kd, int ControllerDirection) - :PID::PID(Input, Output, Setpoint, Kp, Ki, Kd, P_ON_E, ControllerDirection) + :PID2::PID2(Input, Output, Setpoint, Kp, Ki, Kd, P_ON_E, ControllerDirection) { } @@ -216,9 +216,9 @@ void PID2::SetControllerDirection(int Direction) * functions query the internal state of the PID. they're here for display * purposes. this are the functions the PID Front-end uses for example ******************************************************************************/ -double PID::GetKp(){ return dispKp; } -double PID::GetKi(){ return dispKi;} -double PID::GetKd(){ return dispKd;} -int PID::GetMode(){ return inAuto ? AUTOMATIC : MANUAL;} -int PID::GetDirection(){ return controllerDirection;} +double PID2::GetKp(){ return dispKp; } +double PID2::GetKi(){ return dispKi;} +double PID2::GetKd(){ return dispKd;} +int PID2::GetMode(){ return inAuto ? AUTOMATIC : MANUAL;} +int PID2::GetDirection(){ return controllerDirection;} From c12674033e45ea9492bdb88f96a2ad1865d0ab83 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 05:50:27 -0500 Subject: [PATCH 08/19] Update library.json --- library.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.json b/library.json index cf2510c..43b0ab9 100644 --- a/library.json +++ b/library.json @@ -1,5 +1,5 @@ { - "name": "PID", + "name": "PID2", "keywords": "PID, controller, signal", "description": "A PID controller seeks to keep some input variable close to a desired setpoint by adjusting an output. The way in which it does this can be 'tuned' by adjusting three parameters (P,I,D).", "url": "http://playground.arduino.cc/Code/PIDLibrary", From 47b47824f23d46ebb09e95bdda60a583d7ba4ebf Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 06:14:16 -0500 Subject: [PATCH 09/19] Update library.properties --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 4b3fadf..b35a18c 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=PID -version=1.2.1 +version=1.2.2 author=Brett Beauregard maintainer=Brett Beauregard sentence=PID controller From 443a42753197bc4889bb1606f417d1c956d90129 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 06:17:51 -0500 Subject: [PATCH 10/19] Update library.properties --- library.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library.properties b/library.properties index b35a18c..7e938b1 100644 --- a/library.properties +++ b/library.properties @@ -1,9 +1,9 @@ -name=PID +name=PID2 version=1.2.2 author=Brett Beauregard -maintainer=Brett Beauregard +maintainer=r2d2orc2po@yahoo.com sentence=PID controller paragraph=A PID controller seeks to keep some input variable close to a desired setpoint by adjusting an output. The way in which it does this can be 'tuned' by adjusting three parameters (P,I,D). -category=Signal Input/Output +category=Input/Output url=http://playground.arduino.cc/Code/PIDLibrary architectures=* From 056663812b22fe49511f7dce0a86165f4ce7cf24 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 09:00:50 -0500 Subject: [PATCH 11/19] Update library.properties --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 7e938b1..dc236f1 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=PID2 -version=1.2.2 +version=0.0.1 author=Brett Beauregard maintainer=r2d2orc2po@yahoo.com sentence=PID controller From de756cab8657f1732c898065f14965c425fbc2ae Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 09:04:00 -0500 Subject: [PATCH 12/19] PID2 0.0.1 --- keywords.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keywords.txt b/keywords.txt index 330d7fc..997da1a 100644 --- a/keywords.txt +++ b/keywords.txt @@ -1,4 +1,4 @@ -####################################### +####################################### PID2 0.0.1 # Syntax Coloring Map For PID Library ####################################### From 09de1b46ef66432b882cc8a3ca47873eb1605bc9 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 09:05:45 -0500 Subject: [PATCH 13/19] PID2 0.0.1 --- library.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.json b/library.json index 43b0ab9..cd5cfb0 100644 --- a/library.json +++ b/library.json @@ -1,5 +1,5 @@ { - "name": "PID2", + "name": "PID2", "keywords": "PID, controller, signal", "description": "A PID controller seeks to keep some input variable close to a desired setpoint by adjusting an output. The way in which it does this can be 'tuned' by adjusting three parameters (P,I,D).", "url": "http://playground.arduino.cc/Code/PIDLibrary", From f87617f9ae457813b537374194086ecb48b050c2 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 09:07:52 -0500 Subject: [PATCH 14/19] Update to Makeblock 0.0.1 --- PID_v1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PID_v1.cpp b/PID_v1.cpp index 02cecab..744b896 100644 --- a/PID_v1.cpp +++ b/PID_v1.cpp @@ -1,5 +1,5 @@ /********************************************************************************************** - * Arduino PID Library - Version 1.2.2 + * Arduino Makeblock PID Library - Version 0.0.1 * by Brett Beauregard brettbeauregard.com * * This Library is licensed under the MIT License From 9ea971b24fd204d945620807b6d3725965b74c0f Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 09:10:02 -0500 Subject: [PATCH 15/19] Update to Makeblock 0.0.1 --- README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.txt b/README.txt index 74a4ba8..c276293 100644 --- a/README.txt +++ b/README.txt @@ -1,5 +1,5 @@ *************************************************************** -* Arduino PID Library - Version 1.2.2 +* Arduino Makeblock PID Library - Version 0.0.1 * by Brett Beauregard brettbeauregard.com * * This Library is licensed under the MIT License From 428087f16a0d92cade9a593322d29b60b4c50a8b Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 09:45:29 -0500 Subject: [PATCH 16/19] MakeblockPID --- library.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.json b/library.json index cd5cfb0..6c3df1a 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "keywords": "PID, controller, signal", "description": "A PID controller seeks to keep some input variable close to a desired setpoint by adjusting an output. The way in which it does this can be 'tuned' by adjusting three parameters (P,I,D).", "url": "http://playground.arduino.cc/Code/PIDLibrary", - "include": "PID_v1", + #"include": "PID_v1", "authors": [ { From 381dad63f93c9ba1e42a4deed03290b1c823cd87 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 09:56:10 -0500 Subject: [PATCH 17/19] MakeblockPID --- PID_v1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PID_v1.cpp b/PID_v1.cpp index 744b896..0008253 100644 --- a/PID_v1.cpp +++ b/PID_v1.cpp @@ -204,7 +204,7 @@ void PID2::SetControllerDirection(int Direction) { if(inAuto && Direction !=controllerDirection) { - kp = (0 - kp); + kp = (0 - kp); ki = (0 - ki); kd = (0 - kd); } From 1785439d1ebac549ae51dd7f43da50a6effb1752 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 10:33:28 -0500 Subject: [PATCH 18/19] Back to the original --- library.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.json b/library.json index 6c3df1a..cd5cfb0 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "keywords": "PID, controller, signal", "description": "A PID controller seeks to keep some input variable close to a desired setpoint by adjusting an output. The way in which it does this can be 'tuned' by adjusting three parameters (P,I,D).", "url": "http://playground.arduino.cc/Code/PIDLibrary", - #"include": "PID_v1", + "include": "PID_v1", "authors": [ { From dd51ba73494d4ed8b3a24dfc55773c0a48117b13 Mon Sep 17 00:00:00 2001 From: clplaneguy Date: Fri, 5 Apr 2019 10:35:45 -0500 Subject: [PATCH 19/19] One more correction --- PID_v1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PID_v1.cpp b/PID_v1.cpp index 0008253..3fa08fe 100644 --- a/PID_v1.cpp +++ b/PID_v1.cpp @@ -177,7 +177,7 @@ void PID2::SetMode(int Mode) bool newAuto = (Mode == AUTOMATIC); if(newAuto && !inAuto) { /*we just went from manual to auto*/ - PID::Initialize(); + PID2::Initialize(); } inAuto = newAuto; }