I have such a problem, namely I would like to go straight from point A to point B with my boat. The boat is steered by two engines. I have tried many things but unfortunately I am too weak to comprehend it. The boat is flowing like a sine wave http://212.59.240.9/boat.png).
I am looking for a person who would help me understand how to correctly calculate the data for the boat to go straight, i.e. the shortest route between points A and B. The code in Arduino is enough for me. Any platform: Arduino, STM32, ESP32 The current code that I use for testing is attached. http://212.59.240.9/sketch.ino
I tried to use the compass, the boat hits the target perfectly but unfortunately it flows in a curve http://212.59.240.9/boat2.png
I have time to complete the project by October.
Budget: 300USD
This is the second case when the boat veers off course, the bow is always straight on the target but will depart from the line on which it is sailing.
You calculate the GPS heading (my CMG) and subtract from Beranig from the compass. The difference goes to the engines http://212.59.240.9/boat2.png
The boat then goes like this if there is a wave. The boat does not know if it is going straight on the designated line from A to B it only always checks where the target is From the place where it is
I know that the wind, the wave has an influence, even uneven running of engines.
I tried to calculate the offset distance from the XTE line, but unfortunately the GPS can give a point of 2m on the right or left side of the line.
So I am supposed to understand it like this:
TRACK-COURSE = 0 AND HEADING-BEARING = 0
Which difference should I prioritize? can the result just divide by two ?? And give the difference to the engines ??
I'll try to test it tomorrow.
I have a starting point and an ending point on the lake, I sail the boat forward and deviate off course then turn on the autopilot and watch what happens. In addition, an LCD display that shows me the data. In addition, I have telemetry turned on.
I check the calculations first through the simulation: sketch.ino - Wokwi Arduino and ESP32 Simulator
I've been testing this for over five months ... tomorrow I can make a video if it helps. Without real testing, I don't even know how else you can test it, you have to check it on the water and I always do it.
I assumed that I am adding up two errors, both Heading-bearing and Course-Track, and divide by 2 so as not to amplify the error on the motors too much.
The yacht I raced on had a similar need, although the desire was to arrive at a specific point, preferably by the straight line between points but not necessarily vital to do so.
We displayed the current bearing to the mark and the helmsman would try to keep it constant with steering adjustments.
I did the calculations to get the XTE and the result was correct it always showed how many meters I am from the right or left line.
I made CMG and DTK calculations to determine where the boat is. But I see that my assumption was very wrong because the boat did not know where the bow was.
And it flowed in this way for me with the appropriate Kp http://212.59.240.9/boat.png
I was supposed to test today but it's raining terribly for me. But tomorrow I will do it in the morning and record a video of how I did I have two things to test, I will check how it behaves in the case of calculating (Bearing-Heading) and (CMG-DTK) and the second test for calculating (Bearing-Heading) and XTE.
When I tested XTE, this bug was very small so you will definitely need to strengthen it with Kp. But I will test it.
As I wrote incorrectly, I made assumptions and now I can see it in yours posts. I wanted to give up the compass and calculate everything from GPS.
Damn, I'm shocked it flows as straight as an arrow thank you in particular @jremington@J-M-L@paulpaulson
Thank you all
Later I will paste the video when I process it
1.5 years from the flashing diode to the boat flowing straight;)
Of course, the lake was calm, so I will check how it will be in the side wind, but I will control the PID maybe ... but this is enough for me now.
Yes, I know. For those, of course, who want to understand how PID works, apart from the theory, a nice video that allows you to understand how to control PID.