           percept-chan (chan)
           state-chan (chan)
           display-chan (chan)
-          anger-chan (chan)
-          lonely-chan (chan)
           head-chan (chan)
           hand-chan (chan)
           foot-chan (chan)
-          clients-atom (atom [display-chan anger-chan lonely-chan])]
+          clients-atom (atom [display-chan])]
       (nao/say robot "I'm starting to feel quite emotional")
       (let [ev-robot
             (-> robot

    :desire 0.0 :decay-rate 0.01 :max-delta 0.3}
   {:id :soc-lonely :name "lonely" :layer :social
    :valence -0.6 :arousal -0.6
    :desire 0.0 :decay-rate 0.1 :max-delta 0.3}
   ])

(def demo-control-points

             (println "--\n")
             (recur (<! display-chan)))))

(defn reaction-process
  "Triggers a reaction and the resulting percept when a predicate is met"
  [robot percept-chan predicate reaction percept]
  (let [state-chan (chan)
        reaction-complete-chan (chan)]
    (go (while true
          (let [state (<! state-chan)]
            (if (predicate state)
              (reaction robot reaction-complete-chan)))))
    (go (while true
          (let [done (<! reaction-complete-chan)]
            (>! percept-chan (percept done)))))
    state-chan))

(defn react-angrily?
  [state]
  (> (get-in state [:sv :phys-anger] 0.0) 0.75))

(defn anger-reaction
  [robot complete-chan]
  (nao/run-behaviour robot "dsnowdon-angry" complete-chan))

(defn anger-reaction-percept
  [done-signal]
  {:name "Got angry" :satisfaction-vector
   {:phys-anger -0.5
    :saf-bored -0.3}})

(defn anger-management
  [robot percept-chan]
  (reaction-process robot percept-chan
                    react-angrily? anger-reaction anger-reaction-percept))

(defn react-lonely?
  [state]
  (> (get-in state [:sv :soc-lonely] 0.0) 0.5))

(defn lonely-reaction
  [robot complete-chan]
  (->
   (nao/say robot "Is anyone there? I'm feeling lonely.")
   (nao/future-callback-wrapper
    (nao/callback->channel complete-chan))))

(defn lonely-reaction-percept
  [done-signal]
  {:name "Very lonely" :satisfaction-vector
   {:soc-lonely -0.4
    :saf-bored 0.1}})

(defn loneliness-management
  [robot percept-chan]
  (reaction-process robot percept-chan
                    react-lonely? lonely-reaction lonely-reaction-percept))

(defn react-bored?
  [state]
  (> (get-in state [:sv :saf-bored] 0.0) 0.75))

(defn bored-reaction
  [robot complete-chan]
  (->
   (nao/say robot "Ho hum! I'm bored.")
   (nao/future-callback-wrapper
    (nao/callback->channel complete-chan))))

(defn bored-reaction-percept
  [done-signal]
  {:name "Bored" :satisfaction-vector
   {:soc-lonely 0.05
    :saf-bored -0.1}})

(defn boredom-management
  [robot percept-chan]
  (reaction-process robot percept-chan
                    react-bored? bored-reaction bored-reaction-percept))

(defn head-touch-process
  [event-chan percept-chan]
