text: #include "PID.h"
  
  /**
   * TODO: Complete the PID class. You may add any additional desired functions.
   */
  
  PID::PID() {}
  
  PID::~PID() {}
  
  void PID::Init(double Kp_, double Ki_, double Kd_) {
    /**
     * TODO: Initialize PID coefficients (and errors, if needed)
     */
    Kp = Kp_;
    Ki = Ki_;
    Kd = Kd_;
  }
  
  void PID::UpdateError(double cte) {
    /**
     * TODO: Update PID errors based on cte.
     */
    double prev_cte = cte_;
    cte_ = cte;
    
    p_error = cte_;
    i_error += cte_;
    d_error = cte_ - prev_cte;
  
  }
  
  double PID::TotalError() {
    /**
     * TODO: Calculate and return the total error
     */
    return -Kp * p_error - Ki * i_error - Kd * d_error;  // TODO: Add your total error calc here!
  }
  