module Speed where

import Unit
import GPS
import Type
import CommandControl

type Speed = Double


-- | Default, unmodified speed in km/h
speedDefault :: Type -> Speed
speedDefault _ = 20


speedApplyCommandControl :: Speed -> CommandControlStatus -> Speed
speedApplyCommandControl s cnc = s * coeff
  where
    coeff = case cnc of
      CommandControlGood -> 1
      CommandControlAverage -> 0.8
      CommandControlBad -> 0.6
      CommandControlOffline -> 0.5

