course-to

wayland/gps/course-to

Calculates course in degrees (North=0, West=270) from position 1 to position 2, both specified as signed decimal-degrees latitude and longitude. Because Earth is no exact sphere, calculated course may be off by a tiny fraction.
course-to
@/course-to
Calculates course in degrees (North=0, West=270) from position 1 to position 2, both specified as signed decimal-degrees latitude and longitude. Because Earth is no exact sphere, calculated course may be off by a tiny fraction.
Lat1number
Latititude (decimal degrees) of position one.
Long1number
Longitude (decimal degrees) of position one.
Lat2number
Latititude (decimal degrees) of position two.
Long2number
Longitude (decimal degrees) of position two.
course-to
Lat1
Long1
Lat2
Long2
Deg
Degnumber
Course (decimal degrees).
To use the node in your project you should have the wayland/gps library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD dirtieness disable
#pragma XOD require "https://github.com/mikalhart/TinyGPSPlus"
#include <TinyGPSPlus.h>

node {
    void evaluate(Context ctx) {
        double lat1 = getValue<input_Lat1>(ctx);
        double long1 = getValue<input_Long1>(ctx);
        double lat2 = getValue<input_Lat2>(ctx);
        double long2 = getValue<input_Long2>(ctx);
        //courseTo is a static method, so we don't need an instance of the class TinyGPSPlus
        emitValue<output_Deg>(ctx, TinyGPSPlus::courseTo(lat1, long1, lat2, long2));
    }
}

Tabular tests

Lat1Long1Lat2Long2Deg
52.00001052.0000200