source: cpp/tests/genomanipulation-complex.goal @ 1128

Last change on this file since 1128 was 1067, checked in by sz, 4 years ago

sdk tests updated (remove Part.vs)

File size: 15.0 KB
RevLine 
[1009]1    #############################################
2   ##                                           ##
3  ##    Welcome to Genotype Manipulation Demo!    ##
4   ##                                           ##
5    #############################################
6Found converter accepting f1: "Recursive encoding"
7Found 6 converter(s) producing f0
8
9Source genotype: 'FIX[@,p:0.6543,1:-1.23456]X[G]'
10                  ( format 1 )
11Converted to f0:
12p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
13p:1.0, fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
14p:2.0, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
15j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
16j:1, 2, dx=1.0, 0.0, 0.0, stam=0.175, vr=0.5, 0.5, 0.5
17n:j=0, d=@:p=0.6543
18n:j=1, d=G
19c:0, 1, -1.23456
20
21Model contains: 3 part(s)
22                2 joint(s)
23                2 neuron(s)
24
25Investigating details...
26    #############################################
27   ##                                           ##
28  ##    P A R T    O B J E C T                   ##
29   ##                                           ##
30    #############################################
[1033]31            (part # 1)
[1009]32Here is the full listing of properties as they are printed in f0
33 (please compare with f0 genotype).
34Some properties have special meaning (eg. geometry and connections groups)
35and should be handled with care, because they influence other elements of the model.
36
37 [this data is provided by Part::properties() ]
[1067]38 #        id                      type  name        group (21 properties)
[1033]39 0.        x = 1.0                  f   position.x  Geometry 
[1009]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
[1033]4910.       fr = 1.12                 f 0.0 4.0 0.4 friction    Other properties
5011.      ing = 0.53125              f 0.0 1.0 0.25 ingestion   Other properties
5112.       as = 0.15625              f 0.0 1.0 0.25 assimilation  Other properties
[1009]5213.       rx = 0.0                  f   rot.x       Geometry 
5314.       ry = 0.0                  f   rot.y       Geometry 
5415.       rz = 0.0                  f   rot.z       Geometry 
5516.        i =                      s   info        Other properties
5617.   Vstyle = part                 s 0 0 part vis_style   Visual   
[1067]5718.       vr = 0.5                  f 0.0 1.0 1.0 red component  Visual   
5819.       vg = 0.5                  f 0.0 1.0 1.0 green component  Visual   
5920.       vb = 0.5                  f 0.0 1.0 1.0 blue component  Visual   
[1009]60
61However, there is a subset of properties which may be modified more freely.
62Properties on this list are related only to this part and can be changed
63without much consideration. They are guaranteed to be always valid; any inconsistencies
64will be silently repaired.
65
66 [this data is provided by Part::extraProperties() ]
[1067]67 #        id                      type  name        group (8 properties)
[1009]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
[1033]70 2.       fr = 1.12                 f 0.0 4.0 0.4 friction    Extra properties
71 3.      ing = 0.53125              f 0.0 1.0 0.25 ingestion   Extra properties
72 4.       as = 0.15625              f 0.0 1.0 0.25 assimilation  Extra properties
[1067]73 5.       vr = 0.5                  f 0.0 1.0 1.0 red component  Extra properties
74 6.       vg = 0.5                  f 0.0 1.0 1.0 green component  Extra properties
75 7.       vb = 0.5                  f 0.0 1.0 1.0 blue component  Extra properties
[1009]76
77This set of properties can vary from release to release,
78but can be safely accessed by using extraProperties() call.
79This method accesses the full set of properies (even those
80which appear in future releases).
81Now we will try to change some of properties:
82
[1067]83      Change property #4 to random value from range [0..1]
84      Current value of 'as' (assimilation) is '0.15625'
[1009]85      Setting new value... [ using ParamInterface::set() ]
[1067]86      The value is now '0.715189'
[1009]87
[1033]88Let's see f0... (check out part #1 !)
[1009]89
90p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
[1067]91p:1.0, fr=1.12, ing=0.53125, as=0.715189, vr=0.5, 0.5, 0.5
[1033]92p:2.0, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
[1009]93j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
94j:1, 2, dx=1.0, 0.0, 0.0, stam=0.175, vr=0.5, 0.5, 0.5
95n:j=0, d=@:p=0.6543
96n:j=1, d=G
97c:0, 1, -1.23456
98
99    #############################################
100   ##                                           ##
101  ##    J O I N T    O B J E C T                 ##
102   ##                                           ##
103    #############################################
[1033]104            (joint # 1)
[1009]105Similarly as with Part, the full list of properties comes first:
106
107 #        id                      type  name        group (27 properties)
[1033]108 0.       p1 = 1                    d -1 999999 -1 part1 ref#  Connections
109 1.       p2 = 2                    d -1 999999 -1 part2 ref#  Connections
[1009]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 
11810.       hy = 0.0                  f   hinge position.y  Geometry 
11911.       hz = 0.0                  f   hinge position.z  Geometry 
12012.      hrx = 0.0                  f   hinge rotation.x  Geometry 
12113.      hry = 0.0                  f   hinge rotation.y  Geometry 
12214.      hrz = 0.0                  f   hinge rotation.z  Geometry 
12315.      hxn = -1.5708              f -6.2832 0 -1.5708 hinge x negative limit  Geometry 
12416.      hxp = 1.5708               f 0 6.2832 1.5708 hinge x positive limit  Geometry 
12517.      hyn = -1.5708              f -6.2832 0 -1.5708 hinge y negative limit  Geometry 
12618.      hyp = 1.5708               f 0 6.2832 1.5708 hinge y positive limit  Geometry 
12719.     stif = 1.0                  f 0.0 1.0 1.0 stiffness   Other properties
12820.  rotstif = 1.0                  f 0.0 1.0 1.0 rotation stiffness  Other properties
[1033]12921.     stam = 0.175                f 0.0 1.0 0.25 stamina     Other properties
[1009]13022.        i =                      s   info        Other properties
13123.   Vstyle = joint                s 0 0 joint vis_style   Visual   
13224.       vr = 0.5                  f 0.0 1.0 1.0 red component  Visual   
13325.       vg = 0.5                  f 0.0 1.0 1.0 green component  Visual   
13426.       vb = 0.5                  f 0.0 1.0 1.0 blue component  Visual   
135
136Actually, there are two kinds of Joints: delta and absolute.
137For this object, Joint::isDelta() returns 1, so this is the delta Joint.
138
139Delta fields (dx,dy,dz) describe relative location of the second part.
140This joint will change the second Part's positions to preserve delta distance.
[1033]141Let's move the first Part (#1) along y axis (+0.1) and change delta.z (dz) by 0.1.
142Position of the second Part referenced by this joint (part #2) is now changed:
[1009]143
[1033]144p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
[1067]145p:1.0, fr=1.12, ing=0.53125, as=0.715189, vr=0.5, 0.5, 0.5
[1033]146p:2.0, z=0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
147j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
148j:1, 2, dx=1.0, 0.0, 0.1, stam=0.175, vr=0.5, 0.5, 0.5
[1009]149n:j=0, d=@:p=0.6543
150n:j=1, d=G
151c:0, 1, -1.23456
152
153If no delta fields are defined, they will be computed automatically.
154You can always delete existing delta values by using Joint::resetDelta().
155Now we will change the second Part's z position by -0.2 and call resetDelta()...
156As you can see, Joint's delta fields have altered:
157
[1033]158p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
[1067]159p:1.0, fr=1.12, ing=0.53125, as=0.715189, vr=0.5, 0.5, 0.5
[1033]160p:2.0, z=-0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
161j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
162j:1, 2, dx=1.0, 0.0, -0.1, stam=0.175, vr=0.5, 0.5, 0.5
[1009]163n:j=0, d=@:p=0.6543
164n:j=1, d=G
165c:0, 1, -1.23456
166
167How would this joint look like with delta option disabled?
168[ by calling Joint::useDelta(0) ]
169f0 is now:
170
[1033]171p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
[1067]172p:1.0, fr=1.12, ing=0.53125, as=0.715189, vr=0.5, 0.5, 0.5
[1033]173p:2.0, z=-0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
174j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
175j:1, 2, stam=0.175, vr=0.5, 0.5, 0.5
[1009]176n:j=0, d=@:p=0.6543
177n:j=1, d=G
178c:0, 1, -1.23456
179
180...so this is an absolute joint.
181
182Absolute Joints adapt to its Parts' positions.
183We can move a Part, and it does not influence the second part, nor the Joint.
184Let's move the first Part along y axis by -0.1...
185The Part's position is changed, but everything else stays intact:
186
187p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
[1067]188p:1.0, fr=1.12, ing=0.53125, as=0.715189, vr=0.5, 0.5, 0.5
[1033]189p:2.0, z=-0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
190j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
191j:1, 2, stam=0.175, vr=0.5, 0.5, 0.5
[1009]192n:j=0, d=@:p=0.6543
193n:j=1, d=G
194c:0, 1, -1.23456
195
196Part references and delta fields are the 'core' properties of the Joint.
197The other properties are available from Joint::extraProperties()
198and at the moment are defined as follows:
199
200 #        id                      type  name        group (5 properties)
201 0.     stif = 1.0                  f 0.0 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 1.0 red component  Extra properties
204 3.       vg = 0.5                  f 0.0 1.0 1.0 green component  Extra properties
205 4.       vb = 0.5                  f 0.0 1.0 1.0 blue component  Extra properties
206
207They can be changed just like Part's extra properties:
[1033]208      Change property #3 to random value from range [0..1]
209      Current value of 'vg' (green component) is '0.5'
[1009]210      Setting new value... [ using ParamInterface::set() ]
[1033]211      The value is now '0.857946'
[1009]212And after that we have this genotype:
213
214p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
[1067]215p:1.0, fr=1.12, ing=0.53125, as=0.715189, vr=0.5, 0.5, 0.5
[1033]216p:2.0, z=-0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
217j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
218j:1, 2, stam=0.175, vr=0.5, 0.857946, 0.5
[1009]219n:j=0, d=@:p=0.6543
220n:j=1, d=G
221c:0, 1, -1.23456
222
223    #############################################
224   ##                                           ##
225  ##    N E U R O    O B J E C T                 ##
226   ##                                           ##
227    #############################################
[1033]228            (neuro # 1)
[1009]229Basic features of Neuro object are similar to those of Part and Joint.
230We can request a property list:
231
232 #        id                      type  name        group (10 properties)
233 0.        p = -1                   d -1 999999 -1 part ref#   Connections
[1033]234 1.        j = 1                    d -1 999999 -1 joint ref#  Connections
235 2.        d = G                    s   details     Other     
[1009]236 3.        i =                      s   info        Other     
237 4.   Vstyle = neuro                s 0 0 neuro vis_style   Visual   
[1033]238 5. getInputCount = 0                    d   input count  Connections
[1009]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
245As usual, we will change something:
246Each neuron can have any number of inputs = weighted connections
247 with other neurons.
[1033]248According to Neuro::getInputCount(), this one has 0 inputs.
[1009]249Standard API is provided for accessing those inputs (getInput(int)),
250adding inputs (addInput(Neuro*)) and removing them (removeInput(int)).
251
252
253The most unusual thing is 'details' field (d).
254It is something like separate object with its own set of properties.
[1033]255Currently the value of 'd' is 'G'.
256'G' is the class name (Neuro::getClassName() == 'G') and means 'Gyroscope'.
[1009]257Neuro::getClass() gives you information about basic characteristic
258of the class, that can be analyzed automatically.
[1033]259For the current object we can learn that it supports no inputs (getPreferredInputs()) and provides meaningful output signal (getPreferredOutput()==1).
260Instances of 'G' can be used in models having shape types: 'ball-and-stick'.
261Instances of 'G' can be attached to Joints having any shapes.
262(This class does not have its own properties
263 - Neuro::classProperties().getPropCount()==0)
[1009]264The class of this object can be changed using Neuro::setClassName()
265The following classes are available:
266 [ data provided by Neuro::getClassInfo()->getProperties() ]
267
268 #  class  description       properties
269 0.     N  Neuron                 4
270 1.    Nu  Unipolar neuron [EXPERIMENTAL!]   4
271 2.     G  Gyroscope              0
272 3. Gpart  Part Gyroscope         2
273 4.     T  Touch                  3
274 5.Tcontact  Touch contact          0
275 6.Tproximity  Touch proximity        3
276 7.     S  Smell                  0
277 8.     *  Constant               0
278 9.     |  Bend muscle            2
27910.     @  Rotation muscle        1
28011.     M  Muscle for solids      2
28112.     D  Differentiate          0
28213. Fuzzy  Fuzzy system [EXPERIMENTAL!]   4
28314.   Sti  Sticky [EXPERIMENTAL!]   0
28415.   LMu  Linear muscle [EXPERIMENTAL!]   1
28516. Water  Water detector         0
28617.Energy  Energy level           0
28718.    Ch  Channelize             0
28819. ChMux  Channel multiplexer    0
28920. ChSel  Channel selector       1
29021.   Rnd  Random noise           0
29122.   Sin  Sinus generator        2
292
[1033]293Let's change the Neuro's class to 'ChMux'...
294The final object description will be then: 'ChMux'
[1009]295And the full f0 genotype:
296
297p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
[1067]298p:1.0, fr=1.12, ing=0.53125, as=0.715189, vr=0.5, 0.5, 0.5
[1033]299p:2.0, z=-0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
300j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
301j:1, 2, stam=0.175, vr=0.5, 0.857946, 0.5
302n:j=0, d=@:p=0.6543
303n:j=1, d=ChMux
304c:0, 1, -1.23456
[1009]305
306
307######### THE END ###########
308
309Hints:
310  1. You can redirect output: genomanipulation >filename.txt
311  2. Each run can yield different results and new behaviors, but you
[1033]312     need to uncomment rndRandomizeSeed() in genomanipulation.cpp.
[1009]313  3. This application will use custom genotype passed as
314     a commandline parameter: genomanipulation "/*9*/FULU"
315
316
Note: See TracBrowser for help on using the repository browser.