I'm trying to write a program but I encounter some issues. I try to define 2 fuzzy controllers in the same set-up of a program. Both share an input and have one more input different from each other. This is the initialization of the input/output. The second controller, fuzzydist output returns 0.00. It should not. I am using the eFLL library Did anybody do that? How I am supposed do to it?
Fuzzy *fuzzy = new Fuzzy();
Fuzzy *fuzzydist = new Fuzzy();
void setup() {
FuzzyInput *velocity = new FuzzyInput(1);
fuzzy->addFuzzyInput(velocity);
fuzzydist-> addFuzzyInput(velocity);
FuzzyInput *weather = new FuzzyInput(2);
fuzzy->addFuzzyInput(weather);
FuzzyInput *road = new FuzzyInput(3);
fuzzydist->addFuzzyInput(road);
FuzzyOutput *reaction = new FuzzyOutput(1);
fuzzy->addFuzzyOutput(reaction);
FuzzyOutput *reaction = new FuzzyOutput(1);
fuzzy->addFuzzyOutput(reaction);
}
void loop (){
fuzzy->setInput(1, velocity);
fuzzy->setInput(2, road);
fuzzy->fuzzify();
float tau1 = fuzzy->defuzzify(1);
fuzzydist->setInput(1, velocity);
fuzzydist->setInput(3, road);
fuzzydist->fuzzify();
float a = fuzzydist->defuzzify(2);
}
I am expecting that the second controller should return a float <10, >0. I tried to write the program in which the FLL won't share the input but it dosen't work either, it returns 0.00 also.