- Timestamp:
- 02/04/20 19:18:52 (5 years ago)
- Location:
- cpp/frams/neuro/impl
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/neuro/impl/neuroimpl-body-sdk.h
r791 r907 11 11 { 12 12 public: 13 NeuroImpl* makeNew() { return new NI_Gyro(); } // for NeuroFactory13 NeuroImpl* makeNew() { return new NI_Gyro(); } // for NeuroFactory 14 14 int lateinit() { if (!neuro->joint) return 0; simorder = 0; return 1; } 15 15 void go() { setState(0); } … … 21 21 public: 22 22 double range; 23 NeuroImpl* makeNew() { return new NI_Touch(); } // for NeuroFactory23 NeuroImpl* makeNew() { return new NI_Touch(); } // for NeuroFactory 24 24 int lateinit() { if (!neuro->part) return 0; simorder = 0; return 1; } 25 25 void go() { setState(0); } … … 30 30 { 31 31 public: 32 NeuroImpl* makeNew() { return new NI_Smell(); } // for NeuroFactory32 NeuroImpl* makeNew() { return new NI_Smell(); } // for NeuroFactory 33 33 void go() { setState(0); } 34 34 int lateinit() { if (!neuro->part) return 0; simorder = 0; return 1; } … … 40 40 public: 41 41 double power, bendrange; 42 NeuroImpl* makeNew() { return new NI_BendMuscle(); } // for NeuroFactory42 NeuroImpl* makeNew() { return new NI_BendMuscle(); } // for NeuroFactory 43 43 NI_BendMuscle() { paramentries = NI_BendMuscle_tab; } 44 44 int lateinit() { if (!neuro->joint) return 0; simorder = 2; return 1; } … … 51 51 public: 52 52 double power; 53 NeuroImpl* makeNew() { return new NI_RotMuscle(); } // for NeuroFactory53 NeuroImpl* makeNew() { return new NI_RotMuscle(); } // for NeuroFactory 54 54 NI_RotMuscle() { paramentries = NI_RotMuscle_tab; } 55 55 int lateinit() { if (!neuro->joint) return 0; simorder = 2; return 1; } … … 62 62 public: 63 63 double power; 64 NeuroImpl* makeNew() { return new NI_RotMuscle(); } // for NeuroFactory64 NeuroImpl* makeNew() { return new NI_RotMuscle(); } // for NeuroFactory 65 65 NI_LinearMuscle() { paramentries = NI_RotMuscle_tab; } 66 66 int lateinit() { if (!neuro->joint) return 0; simorder = 2; return 1; } … … 72 72 public: 73 73 double power; 74 NeuroImpl* makeNew() { return new NI_Sticky(); } // for NeuroFactory74 NeuroImpl* makeNew() { return new NI_Sticky(); } // for NeuroFactory 75 75 int lateinit() { if (!neuro->part) return 0; simorder = 0; return 1; } 76 76 void go() {} … … 80 80 { 81 81 public: 82 NeuroImpl* makeNew() { return new NI_WaterDetect(); } // for NeuroFactory82 NeuroImpl* makeNew() { return new NI_WaterDetect(); } // for NeuroFactory 83 83 int lateinit() { if (!neuro->part) return 0; simorder = 0; return 1; } 84 84 void go() { setState(0); } … … 88 88 { 89 89 public: 90 NeuroImpl* makeNew() { return new NI_Energy(); } // for NeuroFactory90 NeuroImpl* makeNew() { return new NI_Energy(); } // for NeuroFactory 91 91 void go() { setState(0); } 92 92 }; -
cpp/frams/neuro/impl/neuroimpl-channels.cpp
r791 r907 20 20 s = (max(-1.0, min(1.0, s)) + 1.0) / 2.0; // 0..1 21 21 int i1; 22 i1 = (int)(s *(c - 1)); i1 = max(0, min(i1, c - 2));22 i1 = (int)(s * (c - 1)); i1 = max(0, min(i1, c - 2)); 23 23 double sw = 1.0 / (c - 1); 24 double s1 = sw *i1;24 double s1 = sw * i1; 25 25 double w1 = fabs((s - s1) / sw); 26 26 double w2 = 1.0 - w1; 27 27 double is1 = getWeightedInputState(1, i1); 28 28 double is2 = getWeightedInputState(1, i1 + 1); 29 setState(is1 *w2 + is2*w1);29 setState(is1 * w2 + is2 * w1); 30 30 } 31 31 -
cpp/frams/neuro/impl/neuroimpl-channels.h
r791 r907 11 11 { 12 12 public: 13 NeuroImpl* makeNew() { return new NI_Channelize(); } // for NeuroFactory13 NeuroImpl* makeNew() { return new NI_Channelize(); } // for NeuroFactory 14 14 void go(); 15 15 }; … … 18 18 { 19 19 public: 20 NeuroImpl* makeNew() { return new NI_ChMux(); } // for NeuroFactory20 NeuroImpl* makeNew() { return new NI_ChMux(); } // for NeuroFactory 21 21 void go(); 22 22 }; … … 29 29 int ch; // channel 30 30 NI_ChSel() :ch(0) { paramentries = NI_ChSel_tab; } 31 NeuroImpl* makeNew() { return new NI_ChSel(); } // for NeuroFactory31 NeuroImpl* makeNew() { return new NI_ChSel(); } // for NeuroFactory 32 32 void go(); 33 33 }; … … 35 35 36 36 #endif 37 -
cpp/frams/neuro/impl/neuroimpl-fuzzy.cpp
r791 r907 105 105 nrIn = rulesDef[2 * i]; // nr of inputs in rule #i 106 106 minimumCut = 2; // the highest value of membership function is 1.0, so this value will definitely change 107 for (j = 0; (j < nrIn) && (minimumCut >0); j++) //minimumCut can not be <0, so if =0 then stop calculations107 for (j = 0; (j < nrIn) && (minimumCut > 0); j++) //minimumCut can not be <0, so if =0 then stop calculations 108 108 { 109 109 nrFuzzySet = rules[i][j * 2 + 1]; // j*2 moves pointer through each output, +1 moves to nr of fuzzy set … … 111 111 minimumCut = min(minimumCut, TrapeziumFuzz(nrFuzzySet, getWeightedInputState(inputNr))); // value of membership function for this input and given fuzzy set 112 112 } 113 if ((minimumCut >1) || (minimumCut < 0))113 if ((minimumCut > 1) || (minimumCut < 0)) 114 114 return 1; 115 115 defuzzParam[i] = minimumCut; -
cpp/frams/neuro/impl/neuroimpl-simple.cpp
r791 r907 21 21 { 22 22 double sum = getWeightedInputSum(); 23 velocity = force *(sum - istate) + inertia*velocity;23 velocity = force * (sum - istate) + inertia * velocity; 24 24 istate += velocity; 25 25 if (istate > NEURO_MAX) istate = NEURO_MAX; -
cpp/frams/neuro/impl/neuroimpl-simple.h
r896 r907 23 23 paramentries = NI_StdNeuron_tab; 24 24 } 25 NeuroImpl* makeNew() { return new NI_StdNeuron(); } // for NeuroFactory25 NeuroImpl* makeNew() { return new NI_StdNeuron(); } // for NeuroFactory 26 26 int lateinit(); 27 27 void go(); … … 37 37 paramentries = NI_StdUNeuron_tab; 38 38 } 39 NeuroImpl* makeNew() { return new NI_StdUNeuron(); } // for NeuroFactory39 NeuroImpl* makeNew() { return new NI_StdUNeuron(); } // for NeuroFactory 40 40 void calcOutput(); 41 41 }; … … 44 44 { 45 45 public: 46 NeuroImpl* makeNew() { return new NI_Const(); } // for NeuroFactory46 NeuroImpl* makeNew() { return new NI_Const(); } // for NeuroFactory 47 47 int lateinit() 48 48 {
Note: See TracChangeset
for help on using the changeset viewer.