[1009] | 1 | #############################################
|
---|
| 2 | ## ##
|
---|
| 3 | ## Welcome to Genotype Manipulation Demo! ##
|
---|
| 4 | ## ##
|
---|
| 5 | #############################################
|
---|
| 6 | Found converter accepting f1: "Recursive encoding"
|
---|
| 7 | Found 6 converter(s) producing f0
|
---|
| 8 |
|
---|
| 9 | Source genotype: 'X[|G:1.23]'
|
---|
| 10 | ( format 1 )
|
---|
| 11 | Converted to f0:
|
---|
| 12 | p:vr=0.5, 0.5, 0.5
|
---|
| 13 | p:1.0, vr=0.5, 0.5, 0.5
|
---|
| 14 | j:0, 1, dx=1.0, 0.0, 0.0, vr=0.5, 0.5, 0.5
|
---|
| 15 | n:p=1
|
---|
| 16 | n:j=0, d="|:p=0.25,r=1"
|
---|
| 17 | n:j=0, d=G
|
---|
| 18 | c:0, 2, 1.23
|
---|
| 19 | c:1, 0
|
---|
| 20 |
|
---|
| 21 | Model contains: 2 part(s)
|
---|
| 22 | 1 joint(s)
|
---|
| 23 | 3 neuron(s)
|
---|
| 24 |
|
---|
| 25 | Investigating details...
|
---|
| 26 | #############################################
|
---|
| 27 | ## ##
|
---|
| 28 | ## P A R T O B J E C T ##
|
---|
| 29 | ## ##
|
---|
| 30 | #############################################
|
---|
| 31 | (part # 1)
|
---|
| 32 | Here is the full listing of properties as they are printed in f0
|
---|
| 33 | (please compare with f0 genotype).
|
---|
| 34 | Some properties have special meaning (eg. geometry and connections groups)
|
---|
| 35 | and should be handled with care, because they influence other elements of the model.
|
---|
| 36 |
|
---|
| 37 | [this data is provided by Part::properties() ]
|
---|
| 38 | # id type name group (22 properties)
|
---|
| 39 | 0. x = 1.0 f position.x Geometry
|
---|
| 40 | 1. y = 0.0 f position.y Geometry
|
---|
| 41 | 2. z = 0.0 f position.z Geometry
|
---|
| 42 | 3. sh = 0 d 0 3 0 shape Geometry
|
---|
| 43 | 4. s = 1.0 f 0.1 10.0 1.0 size Geometry
|
---|
[1033] | 44 | 5. sx = 1.0 f 0.05 5.0 1.0 scale.x Geometry
|
---|
| 45 | 6. sy = 1.0 f 0.05 5.0 1.0 scale.y Geometry
|
---|
| 46 | 7. sz = 1.0 f 0.05 5.0 1.0 scale.z Geometry
|
---|
[1009] | 47 | 8. h = 0.0 f 0 1 0 hollow Other properties
|
---|
| 48 | 9. dn = 1.0 f 0.2 5.0 1.0 density Other properties
|
---|
| 49 | 10. fr = 0.4 f 0.0 4.0 0.4 friction Other properties
|
---|
| 50 | 11. ing = 0.25 f 0.0 1.0 0.25 ingestion Other properties
|
---|
| 51 | 12. as = 0.25 f 0.0 1.0 0.25 assimilation Other properties
|
---|
| 52 | 13. rx = 0.0 f rot.x Geometry
|
---|
| 53 | 14. ry = 0.0 f rot.y Geometry
|
---|
| 54 | 15. rz = 0.0 f rot.z Geometry
|
---|
| 55 | 16. i = s info Other properties
|
---|
| 56 | 17. Vstyle = part s 0 0 part vis_style Visual
|
---|
| 57 | 18. vs = 0.2 f 0.05 0.7 0.2 visual thickness Visual
|
---|
| 58 | 19. vr = 0.5 f 0.0 1.0 1.0 red component Visual
|
---|
| 59 | 20. vg = 0.5 f 0.0 1.0 1.0 green component Visual
|
---|
| 60 | 21. vb = 0.5 f 0.0 1.0 1.0 blue component Visual
|
---|
| 61 |
|
---|
| 62 | However, there is a subset of properties which may be modified more freely.
|
---|
| 63 | Properties on this list are related only to this part and can be changed
|
---|
| 64 | without much consideration. They are guaranteed to be always valid; any inconsistencies
|
---|
| 65 | will be silently repaired.
|
---|
| 66 |
|
---|
| 67 | [this data is provided by Part::extraProperties() ]
|
---|
| 68 | # id type name group (9 properties)
|
---|
| 69 | 0. h = 0.0 f 0 1 0 hollow Extra properties
|
---|
| 70 | 1. dn = 1.0 f 0.2 5.0 1.0 density Extra properties
|
---|
| 71 | 2. fr = 0.4 f 0.0 4.0 0.4 friction Extra properties
|
---|
| 72 | 3. ing = 0.25 f 0.0 1.0 0.25 ingestion Extra properties
|
---|
| 73 | 4. as = 0.25 f 0.0 1.0 0.25 assimilation Extra properties
|
---|
| 74 | 5. vs = 0.2 f 0.05 0.7 0.2 visual thickness Extra properties
|
---|
| 75 | 6. vr = 0.5 f 0.0 1.0 1.0 red component Extra properties
|
---|
| 76 | 7. vg = 0.5 f 0.0 1.0 1.0 green component Extra properties
|
---|
| 77 | 8. vb = 0.5 f 0.0 1.0 1.0 blue component Extra properties
|
---|
| 78 |
|
---|
| 79 | This set of properties can vary from release to release,
|
---|
| 80 | but can be safely accessed by using extraProperties() call.
|
---|
| 81 | This method accesses the full set of properies (even those
|
---|
| 82 | which appear in future releases).
|
---|
| 83 | Now we will try to change some of properties:
|
---|
| 84 |
|
---|
[1033] | 85 | Change property #5 to random value from range [0.05..0.7]
|
---|
| 86 | Current value of 'vs' (visual thickness) is '0.2'
|
---|
[1009] | 87 | Setting new value... [ using ParamInterface::set() ]
|
---|
[1033] | 88 | The value is now '0.514873'
|
---|
[1009] | 89 |
|
---|
| 90 | Let's see f0... (check out part #1 !)
|
---|
| 91 |
|
---|
| 92 | p:vr=0.5, 0.5, 0.5
|
---|
[1033] | 93 | p:1.0, vs=0.514873, vr=0.5, 0.5, 0.5
|
---|
[1009] | 94 | j:0, 1, dx=1.0, 0.0, 0.0, vr=0.5, 0.5, 0.5
|
---|
| 95 | n:p=1
|
---|
| 96 | n:j=0, d="|:p=0.25,r=1"
|
---|
| 97 | n:j=0, d=G
|
---|
| 98 | c:0, 2, 1.23
|
---|
| 99 | c:1, 0
|
---|
| 100 |
|
---|
| 101 | #############################################
|
---|
| 102 | ## ##
|
---|
| 103 | ## J O I N T O B J E C T ##
|
---|
| 104 | ## ##
|
---|
| 105 | #############################################
|
---|
| 106 | (joint # 0)
|
---|
| 107 | Similarly as with Part, the full list of properties comes first:
|
---|
| 108 |
|
---|
| 109 | # id type name group (27 properties)
|
---|
| 110 | 0. p1 = 0 d -1 999999 -1 part1 ref# Connections
|
---|
| 111 | 1. p2 = 1 d -1 999999 -1 part2 ref# Connections
|
---|
| 112 | 2. rx = 0.0 f rotation.x Geometry
|
---|
| 113 | 3. ry = 0.0 f rotation.y Geometry
|
---|
| 114 | 4. rz = 0.0 f rotation.z Geometry
|
---|
| 115 | 5. dx = 1.0 f -2 2 0 delta.x Geometry
|
---|
| 116 | 6. dy = 0.0 f -2 2 0 delta.y Geometry
|
---|
| 117 | 7. dz = 0.0 f -2 2 0 delta.z Geometry
|
---|
| 118 | 8. sh = 0 d 0 3 0 shape Geometry
|
---|
| 119 | 9. hx = 0.0 f hinge position.x Geometry
|
---|
| 120 | 10. hy = 0.0 f hinge position.y Geometry
|
---|
| 121 | 11. hz = 0.0 f hinge position.z Geometry
|
---|
| 122 | 12. hrx = 0.0 f hinge rotation.x Geometry
|
---|
| 123 | 13. hry = 0.0 f hinge rotation.y Geometry
|
---|
| 124 | 14. hrz = 0.0 f hinge rotation.z Geometry
|
---|
| 125 | 15. hxn = -1.5708 f -6.2832 0 -1.5708 hinge x negative limit Geometry
|
---|
| 126 | 16. hxp = 1.5708 f 0 6.2832 1.5708 hinge x positive limit Geometry
|
---|
| 127 | 17. hyn = -1.5708 f -6.2832 0 -1.5708 hinge y negative limit Geometry
|
---|
| 128 | 18. hyp = 1.5708 f 0 6.2832 1.5708 hinge y positive limit Geometry
|
---|
| 129 | 19. stif = 1.0 f 0.0 1.0 1.0 stiffness Other properties
|
---|
| 130 | 20. rotstif = 1.0 f 0.0 1.0 1.0 rotation stiffness Other properties
|
---|
| 131 | 21. stam = 0.25 f 0.0 1.0 0.25 stamina Other properties
|
---|
| 132 | 22. i = s info Other properties
|
---|
| 133 | 23. Vstyle = joint s 0 0 joint vis_style Visual
|
---|
| 134 | 24. vr = 0.5 f 0.0 1.0 1.0 red component Visual
|
---|
| 135 | 25. vg = 0.5 f 0.0 1.0 1.0 green component Visual
|
---|
| 136 | 26. vb = 0.5 f 0.0 1.0 1.0 blue component Visual
|
---|
| 137 |
|
---|
| 138 | Actually, there are two kinds of Joints: delta and absolute.
|
---|
| 139 | For this object, Joint::isDelta() returns 1, so this is the delta Joint.
|
---|
| 140 |
|
---|
| 141 | Delta fields (dx,dy,dz) describe relative location of the second part.
|
---|
| 142 | This joint will change the second Part's positions to preserve delta distance.
|
---|
| 143 | Let's move the first Part (#0) along y axis (+0.1) and change delta.z (dz) by 0.1.
|
---|
| 144 | Position of the second Part referenced by this joint (part #1) is now changed:
|
---|
| 145 |
|
---|
| 146 | p:y=0.1, vr=0.5, 0.5, 0.5
|
---|
[1033] | 147 | p:1.0, 0.1, 0.1, vs=0.514873, vr=0.5, 0.5, 0.5
|
---|
[1009] | 148 | j:0, 1, dx=1.0, 0.0, 0.1, vr=0.5, 0.5, 0.5
|
---|
| 149 | n:p=1
|
---|
| 150 | n:j=0, d="|:p=0.25,r=1"
|
---|
| 151 | n:j=0, d=G
|
---|
| 152 | c:0, 2, 1.23
|
---|
| 153 | c:1, 0
|
---|
| 154 |
|
---|
| 155 | If no delta fields are defined, they will be computed automatically.
|
---|
| 156 | You can always delete existing delta values by using Joint::resetDelta().
|
---|
| 157 | Now we will change the second Part's z position by -0.2 and call resetDelta()...
|
---|
| 158 | As you can see, Joint's delta fields have altered:
|
---|
| 159 |
|
---|
| 160 | p:y=0.1, vr=0.5, 0.5, 0.5
|
---|
[1033] | 161 | p:1.0, 0.1, -0.1, vs=0.514873, vr=0.5, 0.5, 0.5
|
---|
[1009] | 162 | j:0, 1, dx=1.0, 0.0, -0.1, vr=0.5, 0.5, 0.5
|
---|
| 163 | n:p=1
|
---|
| 164 | n:j=0, d="|:p=0.25,r=1"
|
---|
| 165 | n:j=0, d=G
|
---|
| 166 | c:0, 2, 1.23
|
---|
| 167 | c:1, 0
|
---|
| 168 |
|
---|
| 169 | How would this joint look like with delta option disabled?
|
---|
| 170 | [ by calling Joint::useDelta(0) ]
|
---|
| 171 | f0 is now:
|
---|
| 172 |
|
---|
| 173 | p:y=0.1, vr=0.5, 0.5, 0.5
|
---|
[1033] | 174 | p:1.0, 0.1, -0.1, vs=0.514873, vr=0.5, 0.5, 0.5
|
---|
[1009] | 175 | j:0, 1, vr=0.5, 0.5, 0.5
|
---|
| 176 | n:p=1
|
---|
| 177 | n:j=0, d="|:p=0.25,r=1"
|
---|
| 178 | n:j=0, d=G
|
---|
| 179 | c:0, 2, 1.23
|
---|
| 180 | c:1, 0
|
---|
| 181 |
|
---|
| 182 | ...so this is an absolute joint.
|
---|
| 183 |
|
---|
| 184 | Absolute Joints adapt to its Parts' positions.
|
---|
| 185 | We can move a Part, and it does not influence the second part, nor the Joint.
|
---|
| 186 | Let's move the first Part along y axis by -0.1...
|
---|
| 187 | The Part's position is changed, but everything else stays intact:
|
---|
| 188 |
|
---|
| 189 | p:vr=0.5, 0.5, 0.5
|
---|
[1033] | 190 | p:1.0, 0.1, -0.1, vs=0.514873, vr=0.5, 0.5, 0.5
|
---|
[1009] | 191 | j:0, 1, vr=0.5, 0.5, 0.5
|
---|
| 192 | n:p=1
|
---|
| 193 | n:j=0, d="|:p=0.25,r=1"
|
---|
| 194 | n:j=0, d=G
|
---|
| 195 | c:0, 2, 1.23
|
---|
| 196 | c:1, 0
|
---|
| 197 |
|
---|
| 198 | Part references and delta fields are the 'core' properties of the Joint.
|
---|
| 199 | The other properties are available from Joint::extraProperties()
|
---|
| 200 | and at the moment are defined as follows:
|
---|
| 201 |
|
---|
| 202 | # id type name group (5 properties)
|
---|
| 203 | 0. stif = 1.0 f 0.0 1.0 1.0 stiffness Extra properties
|
---|
| 204 | 1. rotstif = 1.0 f 0.0 1.0 1.0 rotation stiffness Extra properties
|
---|
| 205 | 2. vr = 0.5 f 0.0 1.0 1.0 red component Extra properties
|
---|
| 206 | 3. vg = 0.5 f 0.0 1.0 1.0 green component Extra properties
|
---|
| 207 | 4. vb = 0.5 f 0.0 1.0 1.0 blue component Extra properties
|
---|
| 208 |
|
---|
| 209 | They can be changed just like Part's extra properties:
|
---|
[1033] | 210 | Change property #3 to random value from range [0..1]
|
---|
| 211 | Current value of 'vg' (green component) is '0.5'
|
---|
[1009] | 212 | Setting new value... [ using ParamInterface::set() ]
|
---|
[1033] | 213 | The value is now '0.857946'
|
---|
[1009] | 214 | And after that we have this genotype:
|
---|
| 215 |
|
---|
| 216 | p:vr=0.5, 0.5, 0.5
|
---|
[1033] | 217 | p:1.0, 0.1, -0.1, vs=0.514873, vr=0.5, 0.5, 0.5
|
---|
| 218 | j:0, 1, vr=0.5, 0.857946, 0.5
|
---|
[1009] | 219 | n:p=1
|
---|
| 220 | n:j=0, d="|:p=0.25,r=1"
|
---|
| 221 | n:j=0, d=G
|
---|
| 222 | c:0, 2, 1.23
|
---|
| 223 | c:1, 0
|
---|
| 224 |
|
---|
| 225 | #############################################
|
---|
| 226 | ## ##
|
---|
| 227 | ## N E U R O O B J E C T ##
|
---|
| 228 | ## ##
|
---|
| 229 | #############################################
|
---|
[1033] | 230 | (neuro # 1)
|
---|
[1009] | 231 | Basic features of Neuro object are similar to those of Part and Joint.
|
---|
| 232 | We can request a property list:
|
---|
| 233 |
|
---|
| 234 | # id type name group (10 properties)
|
---|
[1033] | 235 | 0. p = -1 d -1 999999 -1 part ref# Connections
|
---|
| 236 | 1. j = 0 d -1 999999 -1 joint ref# Connections
|
---|
| 237 | 2. d = |:p=0.25,r=1 s details Other
|
---|
[1009] | 238 | 3. i = s info Other
|
---|
| 239 | 4. Vstyle = neuro s 0 0 neuro vis_style Visual
|
---|
| 240 | 5. getInputCount = 1 d input count Connections
|
---|
| 241 | 9. classObject = null oNeuroClass neuron class Connections
|
---|
| 242 |
|
---|
| 243 | ...and extra properties (which are designed to be always valid and easy to change):
|
---|
| 244 |
|
---|
| 245 | # id type name group (0 properties)
|
---|
| 246 |
|
---|
| 247 | As usual, we will change something:
|
---|
| 248 | Each neuron can have any number of inputs = weighted connections
|
---|
| 249 | with other neurons.
|
---|
| 250 | According to Neuro::getInputCount(), this one has 1 inputs.
|
---|
| 251 | Standard API is provided for accessing those inputs (getInput(int)),
|
---|
| 252 | adding inputs (addInput(Neuro*)) and removing them (removeInput(int)).
|
---|
| 253 |
|
---|
| 254 |
|
---|
| 255 | The most unusual thing is 'details' field (d).
|
---|
| 256 | It is something like separate object with its own set of properties.
|
---|
[1033] | 257 | Currently the value of 'd' is '|:p=0.25,r=1'.
|
---|
| 258 | '|' is the class name (Neuro::getClassName() == '|') and means 'Bend muscle'.
|
---|
[1009] | 259 | Neuro::getClass() gives you information about basic characteristic
|
---|
| 260 | of the class, that can be analyzed automatically.
|
---|
[1033] | 261 | For the current object we can learn that it supports 1 inputs (getPreferredInputs()) and doesn't provide useful output signal (getPreferredOutput()==0).
|
---|
| 262 | Instances of '|' can be used in models having shape types: 'ball-and-stick'.
|
---|
| 263 | Instances of '|' can be attached to Joints having any shapes.
|
---|
[1009] | 264 | The class defines its own properties:
|
---|
| 265 |
|
---|
| 266 | [ data provided by Neuro::classProperties() ]
|
---|
[1033] | 267 | # id type name group (2 properties)
|
---|
| 268 | 0. p = 0.25 f 0.01 1.0 0.25 power Bend muscle
|
---|
| 269 | 1. r = 1.0 f 0.0 1.0 1.0 bending range Bend muscle
|
---|
[1009] | 270 | and they can be changed:
|
---|
[1033] | 271 | Change property #1 to random value from range [0..1]
|
---|
| 272 | Current value of 'r' (bending range) is '1.0'
|
---|
[1009] | 273 | Setting new value... [ using ParamInterface::set() ]
|
---|
[1033] | 274 | The value is now '0.423655'
|
---|
| 275 | After that, 'details' contains the new object: '|:r=0.423655'.
|
---|
[1009] | 276 | The class of this object can be changed using Neuro::setClassName()
|
---|
| 277 | The following classes are available:
|
---|
| 278 | [ data provided by Neuro::getClassInfo()->getProperties() ]
|
---|
| 279 |
|
---|
| 280 | # class description properties
|
---|
| 281 | 0. N Neuron 4
|
---|
| 282 | 1. Nu Unipolar neuron [EXPERIMENTAL!] 4
|
---|
| 283 | 2. G Gyroscope 0
|
---|
| 284 | 3. Gpart Part Gyroscope 2
|
---|
| 285 | 4. T Touch 3
|
---|
| 286 | 5.Tcontact Touch contact 0
|
---|
| 287 | 6.Tproximity Touch proximity 3
|
---|
| 288 | 7. S Smell 0
|
---|
| 289 | 8. * Constant 0
|
---|
| 290 | 9. | Bend muscle 2
|
---|
| 291 | 10. @ Rotation muscle 1
|
---|
| 292 | 11. M Muscle for solids 2
|
---|
| 293 | 12. D Differentiate 0
|
---|
| 294 | 13. Fuzzy Fuzzy system [EXPERIMENTAL!] 4
|
---|
| 295 | 14. Sti Sticky [EXPERIMENTAL!] 0
|
---|
| 296 | 15. LMu Linear muscle [EXPERIMENTAL!] 1
|
---|
| 297 | 16. Water Water detector 0
|
---|
| 298 | 17.Energy Energy level 0
|
---|
| 299 | 18. Ch Channelize 0
|
---|
| 300 | 19. ChMux Channel multiplexer 0
|
---|
| 301 | 20. ChSel Channel selector 1
|
---|
| 302 | 21. Rnd Random noise 0
|
---|
| 303 | 22. Sin Sinus generator 2
|
---|
| 304 |
|
---|
[1033] | 305 | Let's change the Neuro's class to 'Sti'...
|
---|
| 306 | [WARN] Param.loadSingleLine: Unknown property 'Sti.r' (ignored)
|
---|
[1009] | 307 | Info for input #0 = ""
|
---|
| 308 | Info for input #0, field "abc" = ""
|
---|
[1033] | 309 | The final object description will be then: 'Sti'
|
---|
[1009] | 310 | And the full f0 genotype:
|
---|
| 311 |
|
---|
| 312 | p:vr=0.5, 0.5, 0.5
|
---|
[1033] | 313 | p:1.0, 0.1, -0.1, vs=0.514873, vr=0.5, 0.5, 0.5
|
---|
| 314 | j:0, 1, vr=0.5, 0.857946, 0.5
|
---|
| 315 | n:p=1
|
---|
| 316 | n:j=0, d=Sti
|
---|
[1009] | 317 | n:j=0, d=G
|
---|
[1033] | 318 | c:0, 2, 1.23
|
---|
| 319 | c:1, 0, i="test=44,abc=yeah"
|
---|
[1009] | 320 |
|
---|
| 321 |
|
---|
| 322 | ######### THE END ###########
|
---|
| 323 |
|
---|
| 324 | Hints:
|
---|
| 325 | 1. You can redirect output: genomanipulation >filename.txt
|
---|
| 326 | 2. Each run can yield different results and new behaviors, but you
|
---|
[1033] | 327 | need to uncomment rndRandomizeSeed() in genomanipulation.cpp.
|
---|
[1009] | 328 | 3. This application will use custom genotype passed as
|
---|
| 329 | a commandline parameter: genomanipulation "/*9*/FULU"
|
---|
| 330 |
|
---|
| 331 |
|
---|