Hi Guys!
I am building an autopilot for a boat.
The autopilot itself is already working, but there are problems with the heading:
The cube is the boat, the red circle is the destination and the green line is the perfect route. However, the boat is zigzagging along the red line. Clearly it is always oversteering, so a PID control would be needed.
I plan to use the following library:
I know the following values:
- How many degrees of deviation between the current heading and the target.
- The direction of the deviation. So I know whether to correct 20 degrees to the right or 20 degrees to the left.
Obviously I should aim for the deviation to be 0 degrees. For 0 degrees I set the yaw servo to 90 degrees, this corresponds to the centre position. For example, if there is a 20 degree deviation to the right, I write out about 110 values on the servo, so its gently turn the ship to right.
How should I put the PID parameters together?
Which value is INPUT, which value is OUTPUT
What is Setpoint and Direct?
Am I right in thinking that this is how it works?:
- OUTPUT is the deviation from 0 degrees ?
- And INPUT is the value that is written to the servo?