# HG changeset patch # User Robert McIntyre # Date 1328786109 25200 # Node ID d3a2abfac405763b0b1e97d5c4aa6d3b3b6592a9 # Parent 162b24a8271222948670a7d1e9fcecb9649e7423 fixed tangling in body.org, added dialated time HUD display in cortex.util diff -r 162b24a82712 -r d3a2abfac405 assets/Models/test-creature/worm.blend Binary file assets/Models/test-creature/worm.blend has changed diff -r 162b24a82712 -r d3a2abfac405 org/body.org --- a/org/body.org Wed Feb 08 09:10:23 2012 -0700 +++ b/org/body.org Thu Feb 09 04:15:09 2012 -0700 @@ -60,14 +60,8 @@ If we load it directly into jMonkeyEngine, we get this: -#+name: test-0 +#+name: test-1 #+begin_src clojure -(ns cortex.test.body - (:use (cortex world util body)) - (:import (com.aurellem.capture Capture RatchetTimer) - (com.jme3.math Quaternion Vector3f) - java.io.File)) - (def hand-path "Models/test-creature/hand.blend") (defn hand [] (load-blender-model hand-path)) @@ -150,7 +144,7 @@ CollisionShapes for each geometry with the mass specified in that geometry's meta-data. -#+name: test-1 +#+name: test-2 #+begin_src clojure (in-ns 'cortex.test.body) @@ -409,6 +403,7 @@ Creating joints is now a matter applying =(connect)= to each joint node. +#+name: joints-5 #+begin_src clojure (defn joints! "Connect the solid parts of the creature with physical joints. The @@ -427,21 +422,20 @@ Now we can test the hand in all its glory. +#+name: test-3 #+begin_src clojure (in-ns 'cortex.test.body) (def debug-control {"key-h" (fn [world val] (if val (enable-debug world))) - - "key-u" (fn [world _] (set-gravity world Vector3f/ZERO)) - }) + "key-u" (fn [world _] (set-gravity world Vector3f/ZERO))}) (defn test-three [] (world (nodify [(doto (hand) - (physical!) - (joints!) ) + (physical!) + (joints!)) (floor)]) (merge standard-debug-controls debug-control normal-gravity) @@ -456,7 +450,6 @@ =(physical!)= makes the hand solid, then =(joints!)= connects each piece together. - #+begin_html
@@ -478,7 +471,7 @@ It is convienent to combine =(physical!)= and =(joints!)= into one function that completely creates the creature's physical body. -#+name: joints-4 +#+name: joints-6 #+begin_src clojure (defn body! "Endow the creature with a physical body connected with joints. The @@ -489,11 +482,55 @@ (joints! creature)) #+end_src +* The Worm + +Going forward, I will use a model that is less complicated than the +hand. It has two segments and one joint, and I call it the worm. All +of the senses described in the following posts will be applied to this +worm. + +#+name: test-4 +#+begin_src clojure +(in-ns 'cortex.test.body) + +(defn worm-1 [] + (let [timer (RatchetTimer. 60)] + (world + (nodify + [(doto + (load-blender-model + "Models/test-creature/worm.blend") + (body!)) + (floor)]) + (merge standard-debug-controls debug-control) + #(do + (speed-up %) + (light-up-everything %) + (.setTimer % timer) + (cortex.util/display-dialated-time % timer) + (Capture/captureVideo + % (File. "/home/r/proj/cortex/render/body/4"))) + no-op))) +#+end_src + +#+begin_html +
+
+ +
+

This worm model will be the platform onto which future senses will +be grafted.

+
+#+end_html + * Bookkeeping Header; here for completeness. -#+name: body-0 +#+name: body-header #+begin_src clojure (ns cortex.body "Assemble a physical creature using the definitions found in a @@ -514,6 +551,16 @@ com.jme3.bullet.collision.shapes.HullCollisionShape)) #+end_src +#+name: test-header +#+begin_src clojure +(ns cortex.test.body + (:use (cortex world util body)) + (:import + (com.aurellem.capture Capture RatchetTimer) + (com.jme3.math Quaternion Vector3f ColorRGBA) + java.io.File)) +#+end_src + * Source Dylan -- I'll fill these in later @@ -525,16 +572,6 @@ #+name: test-body #+begin_src clojure -(ns cortex.test.body - (:use (cortex world util body)) - (:require cortex.silly) - (:import - com.jme3.math.Vector3f - com.jme3.math.ColorRGBA - com.jme3.bullet.joints.Point2PointJoint - com.jme3.bullet.control.RigidBodyControl - com.jme3.system.NanoTimer - com.jme3.math.Quaternion)) (defn worm-segments "Create multiple evenly spaced box segments. They're fabulous!" @@ -1253,11 +1290,21 @@ * COMMENT generate Source #+begin_src clojure :tangle ../src/cortex/body.clj -<> +<> +<> +<> +<> +<> +<> +<> #+end_src #+begin_src clojure :tangle ../src/cortex/test/body.clj -<> +<> +<> +<> +<> +<> #+end_src diff -r 162b24a82712 -r d3a2abfac405 org/ideas.org --- a/org/ideas.org Wed Feb 08 09:10:23 2012 -0700 +++ b/org/ideas.org Thu Feb 09 04:15:09 2012 -0700 @@ -64,7 +64,7 @@ * goals ** have to get done before winston - - [ ] write an explination for why greyscale bitmaps for senses is + - [X] write an explination for why greyscale bitmaps for senses is appropiate -- 1/2 day - [X] muscle control -- day - [X] proprioception sensor map in the style of the other senses -- day @@ -90,36 +90,13 @@ ** don't have to get done before winston - [ ] write tests for integration -- 3 days - - [ ] usertime/gametime clock HUD display -- day + - [X] usertime/gametime clock HUD display -- day - [ ] find papers for each of the senses justifying my own representation -- week - [ ] show sensor maps in HUD display? -- 4 days - [ ] show sensor maps in AWT display? -- 2 days - [ ] add iteraterator constructs to Vector3f, Vector2f, etc. -* refactoring objectives - - [X] consistent, high-quality names - - [X] joint-creation function in the style of others, kill blender-creature - - [X] docstrings for every function - - [X] common image-loading code - - [X] refactor display/debug code - - [X] refactor the "get the XX nodes functions" - - - -these are the sense-functions --- they each take a Node which -repepsents the creature - - - - [X] body! - - [X] joints! - - - [X] touch! - - [X] hearing! - - [X] vision! - - [X] proprioception! - - [X] movement! - ;;In the elder days of Art, ;;Builders wrought with greatest care diff -r 162b24a82712 -r d3a2abfac405 org/util.org --- a/org/util.org Wed Feb 08 09:10:23 2012 -0700 +++ b/org/util.org Thu Feb 09 04:15:09 2012 -0700 @@ -475,8 +475,26 @@ intilization world-loop*])) +(import com.jme3.font.BitmapText) +(import com.jme3.scene.control.AbstractControl) +(import com.aurellem.capture.IsoTimer) - +(defn display-dialated-time + "Shows the time as it is flowing in the simulation on a HUD display. + Useful for making videos." + [world timer] + (let [font (.loadFont (asset-manager) "Interface/Fonts/Default.fnt") + text (BitmapText. font false)] + (.setLocalTranslation text 300 (.getLineHeight text) 0) + (.addControl + text + (proxy [AbstractControl] [] + (controlUpdate [tpf] + (.setText text (format + "%.2f" + (float (/ (.getTime timer) 1000))))) + (controlRender [_ _]))) + (.attachChild (.getGuiNode world) text))) #+end_src