<commit_before>class PID {
  float kP, kI, kD;
  float minOutput, maxOutput;
  float prevError, integral;
  float lastTime;

  PID(float kP_, float kI_, float kD_) {
    kP = kP_;
    kI = kI_;
    kD = kD_;

    minOutput = -1;
    maxOutput = 1;

    prevError = 0;
    integral = 0;

    lastTime = millis();
  }

  void setMinMaxOut(float min, float max) {
    minOutput = min;
    maxOutput = max;
  }

  float compute(float input, float setPoint) {
    float now = millis();
    float deltaTime = now - lastTime;

    float error = setPoint - input;

    integral += error * kI;

    float output = error * kP + integral + kI + ((error - prevError) / deltaTime) * kD;

    prevError = error;
    lastTime = now;<commit_msg>Corrected fucking huge shit mistake of pid integral,forgot that one<commit_after>class PID {
  float kP, kI, kD;
  float minOutput, maxOutput;
  float prevError, integral;
  float lastTime;

  PID(float kP_, float kI_, float kD_) {
    kP = kP_;
    kI = kI_;
    kD = kD_;

    minOutput = -1;
    maxOutput = 1;

    prevError = 0;
    integral = 0;

    lastTime = millis();
  }

  void setMinMaxOut(float min, float max) {
    minOutput = min;
    maxOutput = max;
  }

  float compute(float input, float setPoint) {
    float now = millis();
    float deltaTime = now - lastTime;

    float error = setPoint - input;

    integral += error * deltaTime;

    float output = error * kP + integral * kI + ((error - prevError) / deltaTime) * kD;

    prevError = error;
    lastTime = now;
{'fraction_non_alphanumeric': 0.10730743910467412, 'fraction_numerical': 0.005266622778143515, 'mean_word_length': 2.5185185185185186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 1, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4716618', 'n_tokens_mistral': 549, 'n_tokens_neox': 518, 'n_words': 164}