              30
              (fn []
                (try
-                 (command drone :ref @(:ref drone))
-                 (command drone :pcmd @(:pcmd drone))
+                 (ref drone @(:ref drone))
+                 (pcmd drone :pcmd @(:pcmd drone))
                  (send-commands drone)
                  (catch Throwable e
                    (log/error e "Error sending commands"))))

  drone)


(defn- assoc-exclusive
  "Sets k1 to v and removes k2 from a map."
  [map k1 k2 v]

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