comparison org/worm_learn.clj @ 443:d3c5f9b70574

workling on thesis render.
author Robert McIntyre <rlm@mit.edu>
date Tue, 25 Mar 2014 00:20:01 -0400
parents 5205535237fb
children ea0bcd47d55b
comparison
equal deleted inserted replaced
442:eaf8c591372b 443:d3c5f9b70574
162 (* 10) 162 (* 10)
163 (- 1) 163 (- 1)
164 (Math/abs))) 164 (Math/abs)))
165 165
166 (defn resting? 166 (defn resting?
167 "Is the worm straight?" 167 "Is the worm resting on the ground?"
168 [experiences] 168 [experiences]
169 (every? 169 (every?
170 (fn [touch-data] 170 (fn [touch-data]
171 (< 0.9 (contact worm-segment-bottom touch-data))) 171 (< 0.9 (contact worm-segment-bottom touch-data)))
172 (:touch (peek experiences)))) 172 (:touch (peek experiences))))
259 file) 259 file)
260 260
261 (defn record-experience! [experiences data] 261 (defn record-experience! [experiences data]
262 (swap! experiences #(conj % data))) 262 (swap! experiences #(conj % data)))
263 263
264
265
264 (defn worm-world 266 (defn worm-world
265 [& {:keys [record motor-control keybindings view experiences 267 [& {:keys [record motor-control keybindings view experiences
266 worm-model end-frame experience-watch] :as settings}] 268 worm-model end-frame experience-watch] :as settings}]
267 (let [{:keys [record motor-control keybindings view experiences 269 (let [{:keys [record motor-control keybindings view experiences
268 worm-model end-frame experience-watch]} 270 worm-model end-frame experience-watch]}
275 touch-display (view-touch) 277 touch-display (view-touch)
276 prop-display (view-proprioception) 278 prop-display (view-proprioception)
277 muscle-display (view-movement) 279 muscle-display (view-movement)
278 280
279 floor (box 10 1 10 :position (Vector3f. 0 -10 0) 281 floor (box 10 1 10 :position (Vector3f. 0 -10 0)
280 :color ColorRGBA/Gray :mass 0) 282 :color ColorRGBA/Gray :mass 0
283 :texture "Textures/greenGrid.png")
281 timer (IsoTimer. 60)] 284 timer (IsoTimer. 60)]
282 285
283 (world 286 (world
284 (nodify [worm floor]) 287 (nodify [worm floor])
285 (merge standard-debug-controls keybindings) 288 (merge standard-debug-controls keybindings)
286 (fn [world] 289 (fn [world]
290 (.setDisplayStatView world false)
291 (.setDisplayFps world false)
287 (position-camera world view) 292 (position-camera world view)
288 (.setTimer world timer) 293 (.setTimer world timer)
289 (display-dilated-time world timer) 294 (display-dilated-time world timer)
290 (when record 295 (when record
291 (Capture/captureVideo 296 (Capture/captureVideo