code: def airspeed_energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD):
      '''return airspeed energy error matching APM internals
      This is positive when we are going too slow
      '''
      aspeed_cm = VFR_HUD.airspeed*100
      target_airspeed = NAV_CONTROLLER_OUTPUT.aspd_error + aspeed_cm
      airspeed_energy_error = ((target_airspeed*target_airspeed) - (aspeed_cm*aspeed_cm))*0.00005
      return airspeed_energy_errof airspeed_energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD):
      '''return airspeed energy error matching APM internals
      This is positive when we are going too slow
      '''
      aspeed_cm = VFR_HUD.airspeed*100
      target_airspeed = NAV_CONTROLLER_OUTPUT.aspd_error + aspeed_cm
      airspeed_energy_error = ((target_airspeed*target_airspeed) - (aspeed_cm*aspeed_cm))*0.00005
      return airspeed_energy_error
docs: return airspeed energy error matching APM internals
      This is positive when we are going too slow