![]() | ![]() | ![]() |
| | |||||||
| Robotics Chat Specific to discussions about robots and the making of. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hello I need to build a line follower, based on PIC16F84A. I was asked to depend on designing the program with P & PD trasnfer functions. I need to know the algorithms that interpret P & PD transfer functions into flowcharts at least. I use PIC Basic Pro to write PIC programs, so any flowchart, but right one will be easily done. Thanks in advance | |
| |
| | (permalink) |
| Implementing a PID controller in code is fairly easy; you just need to translate the equasions into code. Error signal e: e = setpoint - measured_location. Proportional control: P is a constant that you detirmine through testing. control_output = P*e. Derivative control: You can aproximate the derivative by calculating the difference between the newest error sample and the previous error sample. derivative(e) = e - previous_e. D is another constant that you detirmine through testing. PD controller: control_output = P*e + D*derivative(e) Make sure you get the sign correct on P and D. The sign depends on the order you do the subtraction for e and derivative(e). P should cause a push towards the setpoint. D should oppose the direction of motion. | |
| |
| | (permalink) |
| Hello Thanks for this reply, I was going to abandon the whole idea, but you gave me a step forward to continue. I am using PICBasic Pro compiler to write my program and PIC microcontroller, the two rear motors are those types found in toys. If I want to use three infra-red transceivers as sensors for my robot "Left - Middle - Right", considering the output of each sensor as logic 1 or logic 0, depending on whether the line exists beneath the sensor or not. Then, I will have eight possible states for these three sensors. Shall I consider these eight outputs the measured location, or not. The setpoint, what is it practically in my robot, is it a predefined constant, a variable, or one of the measured locations that I will consider to be a reference for instance. I need more explaination please. Now, when I get the error sample, how can I perform subtraction of the new and the previous value, to obtain derivative control part. The control output is simply the direction of each rear motor, how can I sum P and D control parts to obtain PD control algorithm. Thanks | |
| |
| | (permalink) |
| Using a PID controller with your sensors really doesn't make sense. You need a better position sensor for PID to be useful. I think you're overcomplicating your solution. With your 3 sensors a simple algoritm should do a decent job of line following. If the middle sensor is on turn both motors on. If the Left sensor is on turn the right motor on. If the Right sensor is on turn the left motor on. | |
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |