BDI on jadex for android

kozomoja
2012-11-03
2013-06-12
  • kozomoja
    kozomoja
    2012-11-03

    Hi there,
    I'm trying to run a simple BDI agent on jadex for android and what I've tried to do is just change a line in your "Hello world" example from:
    startMicroAgent("HelloWorldAgent " + num, AndroidAgent.class)
    .addResultListener(agentCreatedResultListener);
    to:
    startBPMNAgent("HelloAgent" + num, "jadex/android/application/demo/Agent01.agent.xml").addResultListener(agentCreatedResultListener);

    where Agent01.agent.xml is definition of my BDI agent.

    I can start the platform, but when I try to create an agent, I get ComponentCreationException (No factory found).
    I guess I should change the way of starting jadex platform, but I have no idea how and I was wondering if someone could help me.

    Thanks!
    Bernard

     
  • Hi Bernard,

    yes, you need to enable the BDI kernel.
    How do you start the platform and which Jadex version do you use?

    Cheers,
    Alex

     
  • kozomoja
    kozomoja
    2012-11-05

    I'm using Jadex-Android-2.3, and I'm starting platform with following line (as in your example):
    getJadexContext().startJadexPlatform().addResultListener(platformResultListener);

    Thanks!
    Bernard

     
  • I think you can just supply an array of kernel names to this method, e.g.
    getJadexContext().startJadexPlatform(new String{"component", "micro", "bdi"})

     
  • kozomoja
    kozomoja
    2012-11-05

    Now when starting a platform, I get this exception:
    Exception occurred: jadex.android.application.demo.JadexAndroidHelloWorldActivity$2@44ee87b0, java.io.IOException: File jadex/bdibpmn/KernelBDIBPMN not found in imports

     
  • Julian
    Julian
    2012-11-05

    Please note that BDI is still listed as 'untested' for android.

    However, i think the BDIBPMN kernel is missing in the current Android packages (as the error message indicates).
    You can try to include the BDIBPMN jar (jadex-kernel-bdibpmn-2.3-SNAPSHOT.jar) from the standard jadex package.

    I will look into this tomorrow and test bdi.

     
  • kozomoja
    kozomoja
    2012-11-05

    There isn't jadex-kernel-bdibpmn-2.3-SNAPSHOT.jar in standard jadex package, beacuse latest version is 2.1.1, so it's jadex-kernel-bdibpmn-2.1.1-SNAPSHOT.jar and it doesn't work when I include that jar.

    Hope You'll find solution tomorrow, thank You for Your effort!

     
  • kozomoja
    kozomoja
    2012-11-06

    Just to add, I've done a project with BDI agent on Android about half a year ago, on jadex-android-2.1 version and it worked perfectly fine.
    Now when I try to start that same project, when starting Jadex platform, I get java.lang.OutOfMemoryError at jadex.commons.concurrent.ThreadPool$ServiceThread.run(ThreadPool.java:223)
    and before that:
    java.io.IOException: Unknown format at jadex.commons.concurrent.ThreadPool$ServiceThread.run(ThreadPool.java:223)

    If it is any help to You…
    Hope You can get the new version working!

    Regards!
    Bernard

     
  • Julian
    Julian
    2012-11-06

    Hi,
    thanks for your help.
    I think the last working version (in terms of bdi) could have been the build from 2012-06-12 (which was a 2.1)

    But please try our latest snapshot release  instead, as we have found the problem today.
    We have included a HelloWorld BDI Agent in the demo application.

    Note that the API to launch a Platform has changed since 2.1, see example project.
    Use setPlatformKernels() to enable the bdi kernel (don't forget component and micro, too).

    Regards,
    Julian

    http://www0.activecomponents.org/nightlybuilds/2012-11-06/jadex-android-2.3-SNAPSHOT.zip

     
  • kozomoja
    kozomoja
    2012-11-06

    Hi again,

    I don't know if I'm missing something obvious, but in a file You posted, I can only see jadex.android.exampleproject with two classes: AndroidAgent.java and HelloWorldActivity.java, plus the R.java file is missing so the whole cannot be started.
    There is a package jadex.android.application.demo, but it's empty.

    If I'm not mistaken, BDI agent specification is written in xml format and I don't see that in Your example.
    Would You be so kind to take another look at this and try to help me?

    Thank You!
    Bernard

     
  • Julian
    Julian
    2012-11-06

    I'm sorry that i wasn't clear about that.
    The Demo application i mentioned is hidden in the sources.zip. It's named jadex-android-application-demos and is now used to show different features, while the example project is just a simple template for starters.

    This demo is also compiled and packaged as an .apk in the "apps" directory of the distribution package.

    The mentioned R.java of the example project should be generated by the ADT Plugin, if you're using eclipse, or by the maven-android-plugin, if you're using maven. Try to clean/rebuild the project.
    The R.java file is not shipped, because it's entirely generated from
    (The empty package is nothing to worry about and will be deleted in the next build ;))

    Please keep informing us about your process :)

     
  • kozomoja
    kozomoja
    2012-11-07

    Thank You, it all works great now!

    In the following couple of weeks I'll be working on a context-aware BDI agent for Andorid that will use the context of mobile phone (e.g. GPS location, surrounding sound and light, time, battery level) to modify its sound level and vibration.
    I hope I won't need more help. :)

    Thanks for all Your effort, I really appreciate it!