Gulfport, MS...I am originally from Jackson.
Anyway, I am fairly new to the microcontroller/PID scene as this is a first for me. To answer some questions, I am using a Roboclaw 2x5A with the arduino uno. I am using two arduinos with xbee's to communicate wirelessly. I have the inputs(steering, the 'target') going into one arduino and sending to the second arduino(I have this code written for both). I have the pot at the wheels sent to the second arduino also so now the second arduino has the 'target' and 'curent' values.
I have a detailed explanation of trying to write the code if you don't mind looking over it and seeing if I have it correct.
First question dealing with the 'target' pot with the steering wheel. The way I understand it is I will have a 'proportional range', since the pot on the steering will have a range of 0-1023. I figured the range will be about 300 - 900. Reason I say this is I have a pin in the steering wheel which only allows the wheel to turn so far to the left and right. I will calculate this range of the pot using my code to see the values.
Pin view:
http://img560.imageshack.us/img560/7...ngwheelpin.jpg
So, I will need to read in the proportional values of the range and try to get it to where it is a very close range when comparing the left to right. So, range from 200 to 500(center) to 800...where 300 is the range on each side(example). Am I off track right now?
Next, I will convert this range to an 'error range' where 0 is the center and the range is from -300 and +300 using the above example. I will then take the value of the steering pot(target) and subtract it from the current value of the 'feedback' pot to get the error, then compare it to the 'error range'. This value will be negative or positive, small or large.
I will need to get the constant K to use: Turn=K*error, where error is the target-current . With K being (0-800)/(-300-0) = 2.6.. (using example, not sure if K is correct)? I assume, Turn is the value that will be sent to the motor controller(using roboclaw 2x5a) to determine the left/right and how fast (depending on how far away the Turn value is on the 'error range' graph), correct?
This is my idea, correct me if I am wrong or if there is an easier way(I am new to this), is this over complicating it? The roboclaw has PID algorithm itself, so I assume it will receive the Turn value and interpret the number and tell the wiper motor what to do and how fast.
If this is a correct way, I am currently trying to right the code to incorporate this and determining how to send the value to the roboclaw. Any input, correction, would help. Thanks