SignalK / signalk-derived-data

Generates deltas for values derived from signalk values
Apache License 2.0
18 stars 32 forks source link

signalk-derived-data

Generates deltas for values derived from signalk values

It currently calculates:

To add new calculations, just create a new file under the ./calcs directory.

For example. This is the VMG calculator.

module.exports = function(app) {
  return {
    group: 'vmg',
    optionKey: 'vmg',
    title: "Velocity Made Goog (based on courseGreatCircle.nextPoint.bearingTrue heading true and speedOverGround)",
    derivedFrom: [ "navigation.courseGreatCircle.nextPoint.bearingTrue",
                   "navigation.headingTrue",
                   "navigation.speedOverGround" ],
    calculator: function (bearingTrue, headingTrue, speedOverGround)
    {
      var angle = Math.abs(bearingTrue-headingTrue)
      return [{ path: "navigation.courseGreatCircle.nextPoint.velocityMadeGood",
                value: Math.cos(bearingTrue-headingTrue) * speedOverGround}]
    }
  };
}