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