From 5d807ecdb3d981dd5c14a0219cfbf768c78f3a9c Mon Sep 17 00:00:00 2001 From: Andru Liu <90433630+WallabyLester@users.noreply.github.com> Date: Tue, 8 Oct 2024 00:36:03 -0700 Subject: [PATCH] Initial call of aPID controller. --- CPP_Implementation/RBF_aPID.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CPP_Implementation/RBF_aPID.cpp b/CPP_Implementation/RBF_aPID.cpp index db40363..ae1c409 100644 --- a/CPP_Implementation/RBF_aPID.cpp +++ b/CPP_Implementation/RBF_aPID.cpp @@ -1,6 +1,8 @@ #include #include + + class aPIDController { public: aPIDController(double kp, double ki, double kd, double dt) @@ -22,6 +24,16 @@ private: }; int main() { + // PID parameters + double Kp = 1.0, Ki = 0.1, Kd = 0.01, dt = 0.1; + + aPIDController apid(Kp, Ki, Kd, dt); + + double target = 1.0, measured_value = 0.0; + + double control_signal = apid.update(target, measured_value); + + std::cout << "Output: " << control_signal << std::endl; return 0; }