Waypoint calculation help

Hi

Is there any way that anyone knows of to automatically set a waypoint based on direction of travel?
If anyone has any example code or could point me to an existing project I can pick apart I would appreciate it.

I want to activate a magnetic reed switch, read the current direction of travel (I suppose that would be the bearing) from a self made tilt compensated compass and set the waypoint automatically a set distance directly ahead of the vessle.The majority of the code I find has manually set waypoints included in the code.

I get confused sometimes between all the bearings, heading etc terminology or peoples definitions of them.

I also need a way to determine when I activate the switch that it is the front of the vessle that is pointing in the direction of travel.

Is there an easier way to achieve this?
From previous posts of mine I have determined due to cross currents etc that for steering purposes I do need to use both compass and gps so as I have them already mostly implemented I may as well use them.
Example.
I point my vessel in the direction I want it to go which happens to be 180 degrees. I then need to tell the code that I am pointing at 180 degrees and not 0 degrees and then use that bearing to calculate my waypoint which would invlolve taking my current gps coordinate and adding a fixed value to either the longitude or latitude which shouldn't be too difficult, although I am guessing I would need a lookup table or something to know wether to add or subtract and wether to add or subtract to latitude or longitude.
So I have 2 queries.

  1. How to tell my code which is the front of my vessel and use the subsequent bearing ahead of it.
  2. Use the bearing to automatically set my waypoint a set distance ahead of the current position.

Here goes a morning post beware...I think you could use the TinyGPS library and set your way point by using the variable "course".
http://arduiniana.org/libraries/tinygps/

// course in 100ths of a degree
course = gps.course();

if (button press){ //lock in the course that you want while going the correct direction.
int setcourse = course; // use setcourse to compare against course
}

Thank you. Morning post or not, I will have a look at that.

If you are on a boat, you won't want to take a bearing from a compass. Its not important where the bow is pointing, its important what direction the boat is moving. If you have a GPS, then it will report COG, course over ground. Use that value for your travel bearing. If you want to set a waypoint at a particular lat/lon and determine the bearing, there are a number of ways to do that. Which you might want to use can depend upon how far you are traveling. This algorithm can get complex over long distances. I can give you some links over the next few days.

Thanks. Its not exactly a boat but the same principle.
I will be travelling 1 to 2 km at most.