src/automodelcar/src/lane_follower/lane_follower.h
/*
  * Calculates the servo PWM accordingly to the center_deviation,
  * the curvature degree and the last center deviation using a PD
  * control.
  */
Calculates the servo PWM accordingly to the center_deviation,
the curvature degree and the last center deviation using a PD
control.
Calculates the servo PWM accordingly to the center_deviation the curvature degree and the last center deviation using a PD control .
int CalculateServoPWM(
    int curvature_degree,
    int center_deviation, 
    int last_center_deviation) 
{
    float pe;
    float pp;
    int output;  
    if (curvature_degree > 100 || curvature_degree<80)
    {
        pp = 0.88;
        pe = 1.25;
    }
    else    
    {
        pe = 0.3;
        pp = 1.02;
    }
    output = 
        center_deviation * pe + 
        curvature_degree * pp + 
        (center_deviation - last_center_deviation) * 1.35;
    return output;
}
int CalculateServoPWM ( int curvature_degree , int center_deviation , int last_center_deviation ) { float pe ; float pp ; int output ; if ( curvature_degree > 100 || curvature_degree < 80 ) { pp = 0.88 ; pe = 1.25 ; } else { pe = 0.3 ; pp = 1.02 ; } output = center_deviation * pe + curvature_degree * pp + ( center_deviation - last_center_deviation ) * 1.35 ; return output ; }
Calculates the servo PWM accordingly to the center_deviation,
 the curvature degree and the last center deviation using a PD
 control.
Calculates the servo PWM accordingly to the center_deviation the curvature degree and the last center deviation using a PD control .