Pages: [1]   Go Down
Author Topic: PID library  (Read 462 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

up
Logged

Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

can some one help to me?sorry if my english noob
First help us.. Try to put your sketch using #
Code:
Logged


Pages: [1]   Go Up
Jump to: