I have to make a bot which has front wheel steering by one servo motor like real cars..and one driving motor to run the robot..by rotating the servo the bot will turn right and left..there is Two SONAR on the left and right side to detect the distance from left and right wall. By taking the distance from both sides of the wall the robot has to be moved continuously forward at the middle position by steering the front wheel with help of the Servo.
How can I rotate the servo with PID for smooth turning? At 118degree the servo is straight and the robot is entirely forward. that means at 118degree of servo the robot will be completely straight.
How can I code the PID algorithm to rotate the servo by taking the distance from two SONAR?