view org/joint.org @ 347:ef958c44563d

created test script for new joint creature.
author Robert McIntyre <rlm@mit.edu>
date Sun, 22 Jul 2012 11:30:19 -0500
parents 83afb1fcc999
children 5405f369f4a0
line wrap: on
line source


3 * A self learning joint
5 #+name: load-creature
6 #+begin_src clojure
7 (in-ns 'cortex.joint)
9 (def joint "Models/joint/joint.blend")
11 (defn load-creature []
12 (load-blender-model joint))
15 (defn test-creature []
17 (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
18 creature (doto (load-creature) (body!))
20 ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21 touch (touch! creature)
22 touch-display (view-touch)
24 ;;vision (vision! creature)
25 ;;vision-display (view-vision)
27 ;;hearing (hearing! creature)
28 ;;hearing-display (view-hearing)
30 prop (proprioception! creature)
31 prop-display (view-proprioception)
33 muscles (movement! creature)
34 muscle-display (view-movement)
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
37 fix-display (gen-fix-display)
39 floor (box 10 2 10 :position (Vector3f. 0 -9 0)
40 :color ColorRGBA/Gray :mass 0)
42 timer (RatchetTimer. 60)
43 ]
46 (world
47 (nodify [floor me creature])
48 standard-debug-controls
49 (fn [world]
50 (.setTimer world timer)
51 )
52 (fn [world tpf]
53 (fix-display world)))))
58 #+end_src
65 * Headers
66 #+name: joint-header
67 #+begin_src clojure
68 (ns cortex.joint
69 (:require cortex.import)
70 (:use (cortex world util import body sense
71 hearing touch vision proprioception movement))
72 (:import java.io.File)
73 (:import (com.aurellem.capture RatchetTimer IsoTimer)))
76 (cortex.import/mega-import-jme3)
77 (rlm.rlm-commands/help)
78 #+end_src
81 * COMMENT Generate Source
83 #+begin_src clojure :tangle ../src/cortex/joint.clj
84 <<joint-header>>
85 <<load-creature>>
86 #+end_src