Steve,
Obviously there are two basic approaches, use ROS or don't. =)
For us non-ROS types, the way to calculate course & distance to your next waypoint is basically what Alan said.
You can calculate the new course and distance to your next waypoint (wayPointIndex + 1) from your current GPS coordinates (wayPointIndex) like so:
#include <math.h>
// waypoint[0] is starting point
int wayPointIndex; // to track next waypoint destination
float wayPoint[8][2] = {0,0}; // lat (n/s) & lon (e/w) gps coords for path planning
int wpCone[8]; // is there a cone at next wp?
float deltaLAT, deltaLATdistance; // change in lat, distance in feet to next waypoint
float deltaLON, deltaLONdistance; // change in lon, distance in feet to next waypoint
int newCourse; // North is 0°, east is 90°, south is 180°, and west is 270°.
float distance; // in feet
long ftpdegLat = 364320L; // feet per degree of latitude
long ftpdegLon = 289800L; // feet per degree of longitude in San Jose, CA
// determine lat/lon changes from GPS coordinates for new course
deltaLAT = wayPoint[(wayPointIndex + 1)][0] - wayPoint[wayPointIndex][0];
deltaLON = wayPoint[(wayPointIndex + 1)][1] - wayPoint[wayPointIndex][1];
// calculate course to destination waypoint
newCourse = int(atan2(deltaLON, deltaLAT) * 57.296); // 360/2pi // lon/lat to match compass headings
// newCourse = atan2(deltaLAT, deltaLON) * 57.296; // 360/2pi
if (newCourse < 0) {
newCourse = 360 + newCourse; // North is 0°, east is 90°, south is 180°, and west is 270°
}
//How many feet are in 0.001 minutes? 6.074, 4.83
deltaLATdistance = deltaLAT * ftpdegLat;
deltaLONdistance = deltaLON * ftpdegLon;
distance = sqrt(sq(deltaLATdistance) + sq(deltaLONdistance)); // a^2 + b^2 = c^2 for a right triangle
As Sergei & Chris have mentioned, there are issues with raw GPS for navigation and the trick is to figure out how you want to solve that problem.
You can spend big $$ on exotic cm accurate RX, or use kalman filters and/or ROS, etc., etc.
I tried a relatively low cost GPS RX from DF Robot and it was basically useless due to the scattering issue, so the struggle is real.