Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when I want to use file importer (FLL format) #14

Open
ghost opened this issue May 2, 2019 · 5 comments
Open

Error when I want to use file importer (FLL format) #14

ghost opened this issue May 2, 2019 · 5 comments

Comments

@ghost
Copy link

ghost commented May 2, 2019

I'm trying to use the next code in Java for Android:

InputStream inputStream = context.getAssets().open("FuzzyRules.fll");
String content = IOUtils.toString(inputStream);
Engine engine = new FllImporter().fromString(content);

The content of file is the example ObstacleAvoidance (I just copy and paste). I validated the content in String and it is correct. I get and error when the Engine is built. The error obtained is:
java.lang.RuntimeException: [import error] expected a colon at here:

Is there any clue about that Error? thanks

@jcrada
Copy link
Member

jcrada commented May 4, 2019

Can you please post the FLL code?

@ghost
Copy link
Author

ghost commented May 4, 2019

Sure, this is the content

#File: ObstacleAvoidance.fll
Engine: ObstacleAvoidance
InputVariable: obstacle
enabled: true
range: 0.000 1.000
lock-range: false
term: left Ramp 1.000 0.000
term: right Ramp 0.000 1.000
OutputVariable: mSteer
enabled: true
range: 0.000 1.000
lock-range: false
aggregation: Maximum
defuzzifier: Centroid 100
default: nan
lock-previous: false
term: left Ramp 1.000 0.000
term: right Ramp 0.000 1.000
RuleBlock: mamdani
enabled: true
conjunction: none
disjunction: none
implication: AlgebraicProduct
activation: General
rule: if obstacle is left then mSteer is right
rule: if obstacle is right then mSteer is left

@jcrada
Copy link
Member

jcrada commented May 4, 2019

Could you please debug it? The exception is thrown here:

https://github.com/fuzzylite/jfuzzylite/blob/master/jfuzzylite/src/main/java/com/fuzzylite/imex/FllImporter.java#L109

Not sure what the problem is. Can you check in which line of the FLL the exception is thrown?

@ghost
Copy link
Author

ghost commented May 4, 2019

This is the error that I get, I don't know if you need more information or do you need I debug using the source corde?

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.rockbass2560.megacode, PID: 3151
java.lang.RuntimeException: Unable to create application com.rockbass2560.megacode.base.ApplicationBase: java.lang.RuntimeException: [import error] expected a colon at here:
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5364)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.RuntimeException: [import error] expected a colon at here:
at com.fuzzylite.imex.FllImporter.fromString(FllImporter.java:109)
at com.rockbass2560.megacode.ia.FuzzyLogic.init(FuzzyLogic.java:39)
at com.rockbass2560.megacode.base.ApplicationBase.onCreate(ApplicationBase.java:66)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5361)
at android.app.ActivityThread.-wrap2(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6077) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 

@jcrada
Copy link
Member

jcrada commented May 7, 2019

It seems that the problem is an empty line. Would you try removing every empty line in the FLL file?
Otherwise, I am afraid you will need to debug with source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant