mirror of
https://github.com/WallabyLester/RBF-aPID-Controller.git
synced 2026-06-01 03:56:07 +08:00
Initial call of aPID controller.
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class aPIDController {
|
class aPIDController {
|
||||||
public:
|
public:
|
||||||
aPIDController(double kp, double ki, double kd, double dt)
|
aPIDController(double kp, double ki, double kd, double dt)
|
||||||
@@ -22,6 +24,16 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
int main() {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user