# HG changeset patch # User Robert McIntyre # Date 1325055623 25200 # Node ID 257a86328adb1ef5e9963f8da6c606d692d1ac05 # Parent 6f1c86126d51dadd91a3c7f53d8bd5120bf0f6f2 saving progress diff -r 6f1c86126d51 -r 257a86328adb assets/Models/creature1/hand.png Binary file assets/Models/creature1/hand.png has changed diff -r 6f1c86126d51 -r 257a86328adb assets/Models/creature1/one.bk.blend Binary file assets/Models/creature1/one.bk.blend has changed diff -r 6f1c86126d51 -r 257a86328adb assets/Models/creature1/one.blend Binary file assets/Models/creature1/one.blend has changed diff -r 6f1c86126d51 -r 257a86328adb assets/Models/property/test.blend Binary file assets/Models/property/test.blend has changed diff -r 6f1c86126d51 -r 257a86328adb org/body.org --- a/org/body.org Wed Dec 14 17:41:19 2011 -0700 +++ b/org/body.org Wed Dec 28 00:00:23 2011 -0700 @@ -740,7 +740,7 @@ -* COMMENT generate Source. +* COMMENT generate Source #+begin_src clojure :tangle ../src/cortex/body.clj <> <> diff -r 6f1c86126d51 -r 257a86328adb org/integration.org --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/integration.org Wed Dec 28 00:00:23 2011 -0700 @@ -0,0 +1,80 @@ + + +* TODO goals for today + - [X] create falling cube in blender + - [ ] record falling cube animation in blender + - [ ] import falling cube in jMonkeyEngine + - [ ] record jmonkeyEngine cube animation + + +#+name: integration +#+begin_src clojure +(ns cortex.integration + "Enable loading creatures with senses from blender." + {:author "Robert McIntyre"}) + +;; TODO remove this! +(require 'cortex.import) +(cortex.import/mega-import-jme3) +(use '(cortex world util)) + +(rlm.rlm-commands/help) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; this could be a good way to give objects special properties like +;; being eyes and the like +(defn load-blender-model + "Load a .blend file using an asset folder relative path." + [^String model] + (.loadModel + (doto (asset-manager) + (.registerLoader BlenderModelLoader (into-array String ["blend"]))) + model)) + +(defn scene [] + (load-blender-model "Models/property/test.blend")) + +(defn test-GET! [] + (.getUserData + (.getChild + (scene) 0) + "properties")) + +(defn make-eye [] + (println "hi")) + +(defn test-eval-prop [] + (eval (read-string (.findValue (test-GET!) "form")))) + +;; the properties are saved along with the blender file. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + + +;; Sensors are thunk-functions that return sensory data. +;; Effectors take data and cause changes in the results of the sensor +;; functions. + +(defrecord Creature [sensors effectors]) + + + + + + + + + +#+end_src + + + +#+begin_src clojure :tangle ../src/cortex/integration.clj +<> +#+end_src + + + diff -r 6f1c86126d51 -r 257a86328adb org/test-creature.org --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/test-creature.org Wed Dec 28 00:00:23 2011 -0700 @@ -0,0 +1,81 @@ +#+title: First attempt at a creature! +#+author: Robert McIntyre +#+email: rlm@mit.edu +#+description: +#+keywords: simulation, jMonkeyEngine3, clojure +#+SETUPFILE: ../../aurellem/org/setup.org +#+INCLUDE: ../../aurellem/org/level-0.org + +* Intro +So far, I've made the following senses -- + - Vision + - Hearing + - Touch + - Proprioception + +And one effector: + - Movement + +However, the code so far has only enabled these senses, but has not +actually implemented them. For example, there is still a lot of work +to be done for vision. I need to be able to create an /eyeball/ in +simulation that can be moved around and see the world from different +angles. I also need to determine weather to use log-polar or cartesian +for the visual input, and I need to determine how/wether to +disceritise the visual input. + +I also want to be able to visualize both the sensors and the +effectors in pretty pictures. This semi-retarted creature will by my +first attempt at bringing everything together. + +* The creature's body + +Still going to do an eve-like body in blender, but due to problems +importing the joints, etc into jMonkeyEngine3, I',m going to do all +the connecting here in clojure code, using the names of the individual +components and trial and error. Later, I'll maybe make some sort of +creature-building modifications to blender that support whatever +discreitized senses I'm going to make. + +#+name: body-1 +#+begin_src clojure +(ns cortex.silly + "let's play!" + {:author "Robert McIntyre"}) + +;; TODO remove this! +(require 'cortex.import) +(cortex.import/mega-import-jme3) +(use '(cortex world util body hearing touch vision)) + +(use '[clojure.contrib [seq :only [find-first]]]) + + +(rlm.rlm-commands/help) + +(defn load-blender-model + "Load a .blend file using an asset folder relative path." + [^String model] + (.loadModel + (doto (asset-manager) + (.registerLoader BlenderModelLoader (into-array String ["blend"]))) + model)) + + +(defn apply-skeleton + "Given an imported blender model, apply the armature using the + following pattern: if two bones are connected and have the same + names as two shapes, connect the shapes with a joint constraint." + [armature-name creature] + + + +#+end_src + + + +* COMMENT generate source +#+begin_src clojure :tangle ../src/cortex/silly.clj +<> +#+end_src + diff -r 6f1c86126d51 -r 257a86328adb org/util.org --- a/org/util.org Wed Dec 14 17:41:19 2011 -0700 +++ b/org/util.org Wed Dec 28 00:00:23 2011 -0700 @@ -188,7 +188,7 @@ #+results: util : #'cortex.util/apply-map - + *** Creating Basic Shapes @@ -250,7 +250,8 @@ (doto (GImpactCollisionShape. (.getMesh geom)) (.createJmeMesh) - (.setMargin 0)) + ;;(.setMargin 0) + ) (float (:mass d))) ;; otherwise use jme3's default (RigidBodyControl. (float (:mass d))))]