text: #include "PID.h"
  
  using namespace std;
  
  /*
  * TODO: Complete the PID class.
  */
  
  PID::PID() {}
  
  PID::~PID() {}
  
  void PID::Init(double kp, double ki, double kd) {
    Kp = kp;
    Ki = ki;
    Kd = kd;
  
    p_error = 0;
    i_error = 0;
    d_error = 0;
  }
  
  void PID::UpdateError(double cte) {
    double prev_cte = p_error;
  
    p_error = cte;
    i_error += cte;
    d_error = cte - prev_cte;
  }
  
  double PID::TotalError() {
    return -Kp * p_error - Ki * i_error - Kd * d_error;
  }
  
  