home › Forums › # Technical Support › Convert fuzzylite with Arduino FIST: MATLAB Fuzzy Inference System to Arduino C
Tagged: Arduino C MATLAB
- This topic has 6 replies, 3 voices, and was last updated 5 years, 9 months ago by
Unknown.
-
AuthorPosts
-
June 6, 2014 at 08:23 #1089
Unknown
MemberIf I take an example qtfuzzylite file (mamdanifolder/SimpleDimmer.fis) and use the online Arduino FIST: MATLAB Fuzzy Inference System to Arduino C Converter (http://www.makeproto.com/projects/fuzzy/matlab_arduino_FIST/index.php) in order to get C code I can copy into the Arduino IDE I get the following errors when I VERIFY the Arduino Sketch:
‘fis_’ was not declared in this scope
sketch_jun05c.ino: In function ‘void fis_evaluate()’:
sketch_jun05c:244: error: ‘fis_’ was not declared in this scope
sketch_jun05c:246: error: ‘fis_’ was not declared in this scope
sketch_jun05c:248: error: ‘fis_’ was not declared in this scope
sketch_jun05c:258: error: ‘fis_’ was not declared in this scope
sketch_jun05c:260: error: ‘fis_’ was not declared in this scope
sketch_jun05c:262: error: ‘fis_’ was not declared in this scopeHow do I correct this? My question is can Arduino FIST: MATLAB Fuzzy Inference System to Arduino C Converter convert a qtfuzzylite .fis file? I realize the converter was built for MATLAB, is there some editing I can do on a qtfuzzylite .fis file to make it convert?
June 6, 2014 at 14:40 #1090Juan Rada-Vilela (admin)
KeymasterHi Scott,
I am not familiar with the converter you are talking about, but please have in mind that fuzzylite provides more features than Matlab’s toolbox, for which there are some keywords that are not supported by Matlab and issues occur when importing with them. Specifically, you will need to remove the following keywords from the fis files that are exported using qtfuzzylite:
- Enabled=1
- Default=nan
- LockValid=0
- LockRange=0
Please, make sure these lines are not present in the fis files before using your converter. Let me know if this works for you.
Cheers, Juan
June 7, 2014 at 04:55 #1091Unknown
MemberHi Juan,
I opened the saved qtfuzzylite .fis file with a text editor app (TextWrangler) and deleted all the
Enabled=1
Default=nan
LockValid=0
LockRange=0as suggested.
Next, I converted the file using Karthik Nadig’s online converter (http://www.makeproto.com/projects/fuzzy/matlab_arduino_FIST/index.php ) and copied its code content as instructed into the Arduino IDE. Result is the same set of errors when VERIFIED as before. Do you know of a easy way to take a qtfuzzylite .fis and change it to C language so the Arduino Uno microprocessor can run it? Try doing what I’m attempting with your SimpleDimmer.fis example and Karthik Nadig’s Converter (http://www.makeproto.com/projects/fuzzy/matlab_arduino_FIST/index.php ). Then try creating an Arduino .ino sketch IDE and VERIFY. Thanks for helping.
June 7, 2014 at 07:04 #1092Unknown
MemberGot the Karthik Nadig’s online converter to work by making the following edits. Here is an example of code edits made to the SimpleDimmer.fis file.
[System]
Name=’simple-dimmer’
Type=’mamdani’
NumInputs=1
NumOutputs=1
NumRules=3
AndMethod=’prod’
OrMethod=’add’
ImpMethod=’min’
AggMethod=’max’
DefuzzMethod=’centroid’[Input1]
Name=’Ambient’
Range=[0.000 1.000]
NumMFs=3
MF1=’DARK’:’trimf’,[0.000 0.250 0.500]
MF2=’MEDIUM’:’trimf’,[0.250 0.500 0.750]
MF3=’BRIGHT’:’trimf’,[0.500 0.750 1.000][Output1]
Name=’Power’
Range=[0.000 1.000]
NumMFs=3
MF1=’LOW’:’trimf’,[0.000 0.250 0.500]
MF2=’MEDIUM’:’trimf’,[0.250 0.500 0.750]
MF3=’HIGH’:’trimf’,[0.500 0.750 1.000][Rules]
1.000 , 3.000 (1.000) : 1
2.000 , 2.000 (1.000) : 1
3.000 , 1.000 (1.000) : 1Comparing this to the qtfuzzylite SimpleDimmer.fis code notice all instances of
Enabled=1
Default=nan
LockValid=0
LockRange=0was removed and these changes made:
AndMethod=’prod’
OrMethod=’add’This VERIFIED in Arduino’s IDE with no error. Sweet!
June 7, 2014 at 09:43 #1093Juan Rada-Vilela (admin)
KeymasterHi Scott,
thank you for posting your solution! I will create a document later outlining the requirements of a conjunction and disjunction operator for fis files. Strictly speaking, you only need such operators if the rules contain “and” or “or” connectors, which is why those properties are empty in SimpleDimmer. However, I think I recall that Matlab also requires valid conjunction and disjunction operators regardless of the presence of connectors. Anyway, good you made it work!
December 5, 2017 at 04:54 #2650Unknown
MemberHi Scott,
The last code you have wrotten in Matlab or Arduino ?
If isn’t in Arduino, how can i write the rules in fuzzy controler in Arduino ?December 5, 2017 at 05:11 #2651Unknown
MemberPlease help me, it’s very urgent
-
AuthorPosts
- You must be logged in to reply to this topic.