Help needed with an Autonomous rc car to travel between waypoints using GPS

Hey there. I’ve removed the pcb from an RC car and am using arduino and a GPS receiver to make it autonomous. I’ve only just started writing Arduino code for the first time, and I’ve modified a code I found online to fit my needs. however, theres some error in the code which is preventing me from compiling.

Im using the TinyGPS++ library and the error is :

" autonomous_car_project:58: error: no matching function for call to ‘TinyGPSPlus::courseTo(double&, double&)’ "

The entire code is below. the line which appears to be giving me trouble is highlighted in bold,
I’d appreciate any advice that points in the right direction.

#include “TinyGPS++.h”
#include <SoftwareSerial.h>

TinyGPSPlus gps;
SoftwareSerial ss(2,3);
int wpt = 0; // define variable wpt and assign a value of zero
double dest_latitude; // define floating point variable destination latitude
double dest_longitude; // define floating point variable destination longitude
int WPT_IN_RANGE= 12;

int pwmDrive = 11;
int pwmTurn = 10;
int driveDir = 13;
int leftRight = 12;
float dir;

/* DEFINE GPS WPTS HERE - Create more cases as needed */
void trackWpts() {
switch(wpt) {
case 0:
dest_latitude = 1.0; // switch…case statement used.switch statement compares the value of a variable to the values specified in case statements. When a case statement is found whose value matches that of the variable, the code in that case statement is run.
dest_longitude = 8.0;
break;
case 1:
dest_latitude = 2.0;
dest_longitude = 3.0;
break;
default:
dest_latitude = 4.0;
dest_longitude = 5.0;
break;
}
if (gps.distanceBetween(gps.location.lat(),gps.location.lng(),dest_latitude,dest_longitude) < WPT_IN_RANGE)
wpt++; // important statement - compares data from gprmc string with destination coordinates and switches the dest_lat and dest_lon
}

void setup() {
Serial.begin(9600);
ss.begin(9600);
pinMode(driveDir,OUTPUT);
pinMode(leftRight,OUTPUT);
}

void loop() { // important loop - trackWpts switches between waypoints depending on distance from current position to waypoint
trackWpts();
trackGPS(); // important statement in loop - trackGPS
}

void trackGPS() {
if (dest_latitude != 0 && dest_longitude != 0)

{if(ss.available()>0)

{
char c = ss.read();
if (gps.encode(c))
{if (gps.location.isUpdated()){

double dir=gps.courseTo(dest_latitude,dest_longitude)-gps.course();

if (dir < 0)
dir += 360; // increments dir by 360
if (dir > 180)
dir -= 360; // subtracts 360 from dir

if (dir < -75) // after incrementing or decrementing,conditions for turning left or right
left();
else if (dir>75)
right();
else
center();
}else
stop();
}
}
}
else stop();
}

void drive_forward(){
digitalWrite(driveDir, HIGH);
analogWrite(pwmDrive, 255);
delay(25);
}
void drive_backward(){
digitalWrite(driveDir, LOW);
analogWrite(pwmDrive, 255);
delay(25);
}

void right(){
digitalWrite(leftRight, HIGH);
analogWrite(pwmTurn, 255);
drive_forward();
delay(25);
}
void left(){
digitalWrite(leftRight, LOW);
analogWrite(pwmTurn, 255);
drive_forward();
delay(25);
}
void center(){
digitalWrite(leftRight, HIGH);
analogWrite(pwmTurn, 0);
delay(25);
}

TinyGPSPlus.h contains:

  static double courseTo(double lat1, double long1, double lat2, double long2);

So, why are you not passing it 4 values?

Thanks for your info,Paul.

Ah. I think I see what you mean. I may have misunderstood the courseTo statement.

If I enter courseTo(lat1,long1,lat2,long2), will it return the angle of a line drawn between points (lat1,long1) and (lat2,long2)? is that how it works?

That will be real useful, for a car.