Go Down

Topic: PID library (Read 515 times) previous topic - next topic

xulingxuling23

i want to make PID linefollower so i use the library of PID_V1 http://playground.arduino.cc/Code/PIDLibrary
make an PID linefollower i must make a formula for PID count like
KP KD KI
for example:
void pid_calc()
{ position = int(sensors_average / sensors_sum);
proportional = position - set_point; // Replace set_point by your set point
integral = integral + proportional;
derivative = proportional - last_proportional;
last_proportional = proportional;
void calc_turn()
{ //Restricting the error value between +256.
if (error_value < -256)
{
error_value = -256;
}
if (error_value > 256)
{
error_value = 256;
}
// If error_value is less than zero calculate right turn speed values
if (error_value < 0)
{
right_speed = max_speed + error_value;
left_speed = max_speed;
}
// If error_value is greater than zero calculate left turn values
else
{
right_speed = max_speed;
left_speed = max_speed - error_value;
}
}

the code i have copied from pdf build auto linefollower PID ,its famous PDF arduino but i cant use it and understand it because itus very complicated with too many errors

now i wanna use PID_V1 library but i dont understand what the function mean it eventhough i read from the arduino playround but i cant applicated to code above

can some one help to me?sorry if my english noob


Khalid


can some one help to me?sorry if my english noob

First help us.. Try to put your sketch using #
Code: [Select]

Go Up