                 :command-queue (ref '())
                 :ref (atom {})
                 :pcmd (atom {})
+                :disable-emergency? (atom false)
                 :seq-num (ref 1)
                 :connected? (atom false)
                 :event-handler event-handler

(defn connect! [drone]
  (reset! (:socket drone) (network/make-datagram-socket (:port drone)))
  (navdata/start-navdata-stream @(:navdata-stream drone))
  (command drone :ctrl 5 0)
  (command drone :navdata-demo true)
  (let [thread-pool (util/make-sched-thread-pool 1)]
    (reset! (:thread-pool drone) thread-pool)
    (reset! (:command-executor drone)

  (fn [navdata]
    (reset! (:navdata drone) navdata)
    (reset! (:connected? drone) true)
    (let [disable-emergency? (:disable-emergency? drone)
          state (:state navdata)]
      (if (and state (= (:emergency-landing state) :on) @disable-emergency?)
        (swap! (:ref drone) assoc :emergency true)
        (do
          (swap! (:ref drone) assoc :emergency false)
          (reset! disable-emergency? false))))
    (raise-event drone :navdata navdata)))


