Arduino Hading determination only from GPS data

Job ID: 35921914

Budget: $30 – $250 USD

I would like to execute code in arduino that allows you to get to your destination from point A to point B using only GPS (without any IMU).
We have a starting point A and a destination point B. The vehicle's task is to go from point A to point B.
For those who say it's impossible:
https://www.youtube.com/watch?v=vAiZuJWzUTE

I have this autopilot and there is no IMU, only the GPS module is connected

I tried something like this but no result :)




void loop() {

while (gpsSerial.available()) {
gps.encode(gpsSerial.read());
}

if (gps.location.isValid()) {
currentLat = gps.location.lat();
currentLon = gps.location.lng();



if (currentLat != 0 && currentLon != 0 && lastLat != 0 && lastLon != 0) {
Heading = TinyGPSPlus::bearing(lastLat, lastLon, currentLat, currentLon);
Bearing = gps.courseTo(currentLat, currentLon, gotoLat, gotoLon);

}


lastLat = currentLat;
lastLon = currentLon;

}

errorBH = heading_error(int(Bearing), int(Heading));

motorSpeed1 = (motorSpeed - errorBH *2);
motorSpeed2 = (motorSpeed + errorBH *2);
}


int heading_error(int headGPS, int current_heading)
{
int error = current_heading - headGPS;
error = (error + 540)%360-180;
return error;
}
Related categories: GPS Arduino A-GPS