This repository has been archived on 2025-06-01. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
compLIB/server_v2/include/PID.hpp
2022-05-21 23:31:23 +02:00

32 lines
No EOL
582 B
C++

#ifndef COMPLIB_SERVER_PID_HPP
#define COMPLIB_SERVER_PID_HPP
#include <chrono>
class PID {
public:
PID();
PID(double P, double I, double D, double ramp, double limit);
~PID() = default;
double operator()(double setpoint, double process_variable);
double P = 1;
double I = 0;
double D = 0;
double setpoint_ramp = 0;
double limit = 0;
private:
typedef std::chrono::steady_clock clock;
#
double error_prev = 0;
double setpoint_prev = 0;
double integral_prev = 0;
clock::time_point timestamp_prev = clock::now();
};
#endif // COMPLIB_SERVER_PID_HPP