code: def energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD):
      '''return energy error matching APM internals
      This is positive when we are too low or going too slow
      '''
      aspeed_energy_error = airspeed_energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD)
      alt_error = NAV_CONTROLLER_OUTPUT.alt_error*100
      energy_error = aspeed_energy_error + alt_error*0.098
      return energy_errof energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD):
      '''return energy error matching APM internals
      This is positive when we are too low or going too slow
      '''
      aspeed_energy_error = airspeed_energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD)
      alt_error = NAV_CONTROLLER_OUTPUT.alt_error*100
      energy_error = aspeed_energy_error + alt_error*0.098
      return energy_error
docs: return energy error matching APM internals
      This is positive when we are too low or going too slow