Mercurial > cortex
changeset 469:ae10f35022ba
completed first draft of body section.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 28 Mar 2014 16:34:35 -0400 |
parents | 258078f78b33 |
children | 3401053124b0 |
files | thesis/cortex.org |
diffstat | 1 files changed, 91 insertions(+), 90 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/thesis/cortex.org Fri Mar 28 16:25:31 2014 -0400 1.2 +++ b/thesis/cortex.org Fri Mar 28 16:34:35 2014 -0400 1.3 @@ -23,8 +23,6 @@ 1.4 #+ATTR_LaTeX: :width 10cm 1.5 [[./images/aurellem-gray.png]] 1.6 1.7 - 1.8 - 1.9 * COMMENT Empathy and Embodiment as problem solving strategies 1.10 1.11 By the end of this thesis, you will have seen a novel approach to 1.12 @@ -445,7 +443,7 @@ 1.13 simulations of very simple creatures in =CORTEX= generally run at 1.14 40x on my machine! 1.15 1.16 -** What is a sense? 1.17 +** COMMENT What is a sense? 1.18 1.19 If =CORTEX= is to support a wide variety of senses, it would help 1.20 to have a better understanding of what a ``sense'' actually is! 1.21 @@ -523,7 +521,6 @@ 1.22 #+ATTR_LaTeX: :width 10cm 1.23 [[./images/finger-1.png]] 1.24 1.25 - 1.26 ** COMMENT Video game engines are a great starting point 1.27 1.28 I did not need to write my own physics simulation code or shader to 1.29 @@ -590,7 +587,7 @@ 1.30 write my code in clojure, an implementation of =LISP= that runs on 1.31 the JVM. 1.32 1.33 -** =CORTEX= uses Blender to create creature models 1.34 +** COMMENT =CORTEX= uses Blender to create creature models 1.35 1.36 For the simple worm-like creatures I will use later on in this 1.37 thesis, I could define a simple API in =CORTEX= that would allow 1.38 @@ -627,8 +624,7 @@ 1.39 #+ATTR_LaTeX: :width 10cm 1.40 [[./images/empty-sense-nodes.png]] 1.41 1.42 - 1.43 -** Bodies are composed of segments connected by joints 1.44 +** COMMENT Bodies are composed of segments connected by joints 1.45 1.46 Blender is a general purpose animation tool, which has been used in 1.47 the past to create high quality movies such as Sintel 1.48 @@ -690,19 +686,11 @@ 1.49 to simulate retractable claws or =EVE='s hands, which are able to 1.50 coalesce into one object in the movie. 1.51 1.52 -*** Solidifying/Connecting the body 1.53 +*** Solidifying/Connecting a body 1.54 1.55 - #+caption: View of the hand model in Blender showing the main ``joints'' 1.56 - #+caption: node (highlighted in yellow) and its children which each 1.57 - #+caption: represent a joint in the hand. Each joint node has metadata 1.58 - #+caption: specifying what sort of joint it is. 1.59 - #+name: blender-hand 1.60 - #+ATTR_LaTeX: :width 10cm 1.61 - [[./images/hand-screenshot1.png]] 1.62 - 1.63 - =CORTEX= creates a creature in two steps: first, it traverses the 1.64 - nodes in the blender file and creates physical representations for 1.65 - any of them that have mass defined. 1.66 + =CORTEX= creates a creature in two steps: first, it traverses the 1.67 + nodes in the blender file and creates physical representations for 1.68 + any of them that have mass defined in their blender meta-data. 1.69 1.70 #+caption: Program for iterating through the nodes in a blender file 1.71 #+caption: and generating physical jMonkeyEngine3 objects with mass 1.72 @@ -729,20 +717,35 @@ 1.73 #+end_src 1.74 #+end_listing 1.75 1.76 - The next step to making a proper body is to connect those pieces 1.77 - together with joints. jMonkeyEngine has a large array of joints 1.78 - available via =bullet=, such as Point2Point, Cone, Hinge, and a 1.79 - generic Six Degree of Freedom joint, with or without spring 1.80 - restitution. =CORTEX='s procedure for binding the creature together 1.81 - with joints is as follows: 1.82 + The next step to making a proper body is to connect those pieces 1.83 + together with joints. jMonkeyEngine has a large array of joints 1.84 + available via =bullet=, such as Point2Point, Cone, Hinge, and a 1.85 + generic Six Degree of Freedom joint, with or without spring 1.86 + restitution. 1.87 1.88 - - Find the children of the "joints" node. 1.89 - - Determine the two spatials the joint is meant to connect. 1.90 - - Create the joint based on the meta-data of the empty node. 1.91 + Joints are treated a lot like proper senses, in that there is a 1.92 + top-level empty node named ``joints'' whose children each 1.93 + represent a joint. 1.94 1.95 - The higher order function =sense-nodes= from =cortex.sense= 1.96 - simplifies finding the joints based on their parent ``joints'' 1.97 - node. 1.98 + #+caption: View of the hand model in Blender showing the main ``joints'' 1.99 + #+caption: node (highlighted in yellow) and its children which each 1.100 + #+caption: represent a joint in the hand. Each joint node has metadata 1.101 + #+caption: specifying what sort of joint it is. 1.102 + #+name: blender-hand 1.103 + #+ATTR_LaTeX: :width 10cm 1.104 + [[./images/hand-screenshot1.png]] 1.105 + 1.106 + 1.107 + =CORTEX='s procedure for binding the creature together with joints 1.108 + is as follows: 1.109 + 1.110 + - Find the children of the ``joints'' node. 1.111 + - Determine the two spatials the joint is meant to connect. 1.112 + - Create the joint based on the meta-data of the empty node. 1.113 + 1.114 + The higher order function =sense-nodes= from =cortex.sense= 1.115 + simplifies finding the joints based on their parent ``joints'' 1.116 + node. 1.117 1.118 #+caption: Retrieving the children empty nodes from a single 1.119 #+caption: named empty node is a common pattern in =CORTEX= 1.120 @@ -769,20 +772,20 @@ 1.121 #+end_src 1.122 #+end_listing 1.123 1.124 - To find a joint's targets targets, =CORTEX= creates a small cube, 1.125 - centered around the empty-node, and grows the cube exponentially 1.126 - until it intersects two /physical/ objects. The objects are ordered 1.127 - according to the joint's rotation, with the first one being the 1.128 - object that has more negative coordinates in the joint's reference 1.129 - frame. Since the objects must be physical, the empty-node itself 1.130 - escapes detection. Because the objects must be physical, 1.131 - =joint-targets= must be called /after/ =physical!= is called. 1.132 + To find a joint's targets, =CORTEX= creates a small cube, centered 1.133 + around the empty-node, and grows the cube exponentially until it 1.134 + intersects two physical objects. The objects are ordered according 1.135 + to the joint's rotation, with the first one being the object that 1.136 + has more negative coordinates in the joint's reference frame. 1.137 + Since the objects must be physical, the empty-node itself escapes 1.138 + detection. Because the objects must be physical, =joint-targets= 1.139 + must be called /after/ =physical!= is called. 1.140 1.141 - #+caption: Program to find the targets of a joint node by 1.142 - #+caption: exponentiallly growth of a search cube. 1.143 - #+name: joint-targets 1.144 - #+begin_listing clojure 1.145 - #+begin_src clojure 1.146 + #+caption: Program to find the targets of a joint node by 1.147 + #+caption: exponentiallly growth of a search cube. 1.148 + #+name: joint-targets 1.149 + #+begin_listing clojure 1.150 + #+begin_src clojure 1.151 (defn joint-targets 1.152 "Return the two closest two objects to the joint object, ordered 1.153 from bottom to top according to the joint's rotation." 1.154 @@ -807,17 +810,17 @@ 1.155 (.dot (Vector3f. 1 1 1) joint-ref-frame-position)) 1.156 (take 2 targets)) 1.157 (recur (float (* radius 2)))))))) 1.158 - #+end_src 1.159 - #+end_listing 1.160 + #+end_src 1.161 + #+end_listing 1.162 1.163 - Once =CORTEX= finds all joints and targets, it creates them using a 1.164 - simple dispatch on the metadata of the joint node. 1.165 + Once =CORTEX= finds all joints and targets, it creates them using 1.166 + a dispatch on the metadata of each joint node. 1.167 1.168 - #+caption: Program to dispatch on blender metadata and create joints 1.169 - #+caption: sutiable for physical simulation. 1.170 - #+name: joint-dispatch 1.171 - #+begin_listing clojure 1.172 - #+begin_src clojure 1.173 + #+caption: Program to dispatch on blender metadata and create joints 1.174 + #+caption: sutiable for physical simulation. 1.175 + #+name: joint-dispatch 1.176 + #+begin_listing clojure 1.177 + #+begin_src clojure 1.178 (defmulti joint-dispatch 1.179 "Translate blender pseudo-joints into real JME joints." 1.180 (fn [constraints & _] 1.181 @@ -847,17 +850,17 @@ 1.182 rotation rotation) 1.183 (.setLimit (float limit-xz) (float limit-xy) 1.184 (float twist))))) 1.185 - #+end_src 1.186 - #+end_listing 1.187 + #+end_src 1.188 + #+end_listing 1.189 1.190 - All that is left for joints it to combine the above pieces into a 1.191 - something that can operate on the collection of nodes that a 1.192 - blender file represents. 1.193 + All that is left for joints it to combine the above pieces into a 1.194 + something that can operate on the collection of nodes that a 1.195 + blender file represents. 1.196 1.197 - #+caption: Program to completely create a joint given information 1.198 - #+caption: from a blender file. 1.199 - #+name: connect 1.200 - #+begin_listing clojure 1.201 + #+caption: Program to completely create a joint given information 1.202 + #+caption: from a blender file. 1.203 + #+name: connect 1.204 + #+begin_listing clojure 1.205 #+begin_src clojure 1.206 (defn connect 1.207 "Create a joint between 'obj-a and 'obj-b at the location of 1.208 @@ -888,20 +891,20 @@ 1.209 control-a control-b 1.210 pivot-a pivot-b 1.211 joint-rotation)))) 1.212 - #+end_src 1.213 - #+end_listing 1.214 + #+end_src 1.215 + #+end_listing 1.216 1.217 - In general, whenever =CORTEX= exposes a sense (or in this case 1.218 - physicality), it provides a function of the type =sense!=, which 1.219 - takes in a collection of nodes and augments it to support that 1.220 - sense. The function returns any controlls necessary to use that 1.221 - sense. In this case =body!= cerates a physical body and returns no 1.222 - control functions. 1.223 + In general, whenever =CORTEX= exposes a sense (or in this case 1.224 + physicality), it provides a function of the type =sense!=, which 1.225 + takes in a collection of nodes and augments it to support that 1.226 + sense. The function returns any controlls necessary to use that 1.227 + sense. In this case =body!= cerates a physical body and returns no 1.228 + control functions. 1.229 1.230 - #+caption: Program to give joints to a creature. 1.231 - #+name: name 1.232 - #+begin_listing clojure 1.233 - #+begin_src clojure 1.234 + #+caption: Program to give joints to a creature. 1.235 + #+name: name 1.236 + #+begin_listing clojure 1.237 + #+begin_src clojure 1.238 (defn joints! 1.239 "Connect the solid parts of the creature with physical joints. The 1.240 joints are taken from the \"joints\" node in the creature." 1.241 @@ -919,25 +922,23 @@ 1.242 [#^Node creature] 1.243 (physical! creature) 1.244 (joints! creature)) 1.245 - #+end_src 1.246 - #+end_listing 1.247 + #+end_src 1.248 + #+end_listing 1.249 1.250 - All of the code you have just seen amounts to only 130 lines, yet 1.251 - because it builds on top of Blender and jMonkeyEngine3, those few 1.252 - lines pack quite a punch! 1.253 + All of the code you have just seen amounts to only 130 lines, yet 1.254 + because it builds on top of Blender and jMonkeyEngine3, those few 1.255 + lines pack quite a punch! 1.256 1.257 - The hand from figure \ref{blender-hand}, which was modeled after my 1.258 - own right hand, can now be given joints and simulated as a 1.259 - creature. 1.260 + The hand from figure \ref{blender-hand}, which was modeled after 1.261 + my own right hand, can now be given joints and simulated as a 1.262 + creature. 1.263 1.264 - #+caption: With the ability to create physical creatures from blender, 1.265 - #+caption: =CORTEX= gets one step closer to a full creature simulation 1.266 - #+caption: environment. 1.267 - #+name: name 1.268 - #+ATTR_LaTeX: :width 15cm 1.269 - [[./images/physical-hand.png]] 1.270 - 1.271 - 1.272 + #+caption: With the ability to create physical creatures from blender, 1.273 + #+caption: =CORTEX= gets one step closer to becomming a full creature 1.274 + #+caption: simulation environment. 1.275 + #+name: name 1.276 + #+ATTR_LaTeX: :width 15cm 1.277 + [[./images/physical-hand.png]] 1.278 1.279 ** Eyes reuse standard video game components 1.280