Calculation of the correct course (autonomous) boat.

Hi.

How to calculate the correct course of the boat with the following data:

  1. Current angle from the compass bearing.
  2. GPS coordinates of the destination point
  3. GPS coordinates of the point where the boat is currently located.
  4. Calculated angle from the current GPS point to the target GPS point.
  5. The current angle at which the boat flows based on the current GPS coordinates e.g. refreshed every second (in case the compass is incorrectly calibrated)

Does it make sense to compare points 4 - 5 in real time? (difference creates compass rotation correction)

What patterns should I follow, what should I pay special attention to?

Thanks for help.

prem111:
Hi.

How to calculate the correct course of the boat with the following data:

  1. Current angle from the compass bearing.
  2. GPS coordinates of the destination point
  3. GPS coordinates of the point where the boat is currently located.
  4. Calculated angle from the current GPS point to the target GPS point.
  5. The current angle at which the boat flows based on the current GPS coordinates e.g. refreshed every second (in case the compass is incorrectly calibrated)

Does it make sense to compare points 4 - 5 in real time? (difference creates compass rotation correction)

What patterns should I follow, what should I pay special attention to?

Thanks for help.

For #1, anyway, be sure to use + and - values from due North, by the compass, not just the angle value.

Paul

Most of the Arduino GPS libraries have a function that calculates the bearing from one GPS (lat, lon) point to another. Here is how the function works.

Then, most people use a PID loop to steer. Usually, you want heading or compass reading to match the bearing, so the PID setpoint is zero, and the PID process variable is (heading - bearing). Of course the compass has to be carefully calibrated, corrected for your local magnetic declination and aligned with the boat so 0 heading means the boat is pointing due North.

Wind and currents move the boat off course, so the bearing needs to be recalculated from time to time, using the current GPS location and the target location.

Mind compass wrap. Most people keep both heading and bearing angles in the range 0 to 359 integer degrees.

Thanks for the answer. I have a question about the PID loop itself. What are the possibilities of auto-tuning. I want the boat to flow perfectly straight. Sometimes it happens that PID points to 10-30 degrees (pid - I translate it into% of engine power - I have two right and left engines) and it is not enough for the engine to level the course. Need to sample and possibly add pid.Kp ?

The PID loop will look something like the following.

   heading = get_heading();
   float error = heading - bearing;  //make sure sign is correct
   float correction = Kp*error;
   set_left_speed(base_speed + correction);
   set_right_speed(base_speed - correction);

For a boat, increase Kp until the steering can correctly fix the heading error without much overshoot. You probably won't need Kd and Ki, because water is so viscous.

Short video example of exactly the above method: http://www.uoxray.uoregon.edu/orangutan/boat2.mp4

Ok, but when adding Kp + 0.10 and PID is still greater than> 1 again adding 0.10 then everything will take too much time. I need to quickly find out about the sensitivity of Kp. Some sampling mechanism?

I need to quickly find out about the sensitivity of Kp

What is the hurry?

Just try some different values and observe the behavior. The "best" value is not critical.

How to increase the strength of Kp. relative to behavior?

Just try some different values and observe the behavior. The "best" value is not critical.