Skip to content

Argo Hello World with Jason

Nilson Lazarin edited this page Sep 29, 2024 · 2 revisions
Examples Tools Wiki

In this tutorial you will learn how to import the Argo BDI-agent Architecture in a Jason-CLI project and execute a Blink Project (hello world).

Dependencies:

  1. Jason Framework already installed.

    Jason-CLI tutorial installation

  2. An IoT device using a serial communication channel, programmed using the Javino Blink Example.

    Arduino SimulIDE
    Blink tutorial with Arduino Board Blink tutorial with SimulIDE

Instructions:

  1. In a terminal command, create a Multiagent System Project, using the command below:

    jason app create jasonWithArgo --console
    
  2. Create a directory lib in the project folder and download the ArgoAgent Library into the library folder, using the command below:

    wget https://github.com/chon-group/Argo/releases/latest/download/ArgoAgent.jar -P jasonWithArgo/lib/
    
    1. Change the file jasonWithArgo/jasonWithArgo.mas2j, including the content below:
    MAS jasonWithArgo {
    	agents: bob agentArchClass jason.Argo;
    	aslSourcePath: "src/agt";
    }
    
  3. Change the file jasonWithArgo/src/agt/bob.asl, including the content below.

    // Agent bob in project jasonWithArgo
    
    /* Initial beliefs and rules */
    serialPort(ttyACM0).            /* physical Arduino Board in /dev/ttyACM0  */
    //serialPort(ttyUSB0).          /* physical Arduino Board in /dev/ttyUSB0  */
    //serialPort(ttyEmulatedPort0). /* simulated arduino with simulIDE         */
    
    /* Initial goals */
    !start.
    
    /* Plans */
    +!start:
    serialPort(Port) <- 
    	.print("Ah, Mr. Anderson, I see you are as predictable in this world as you are in the other.");
    	.argo.port(Port);
    	.argo.percepts(open).
    
    +ledStatus(on) <-
    	.print("Turning ON  the Led in Arduino!");
    	.argo.act(ledOff).
    
    +ledStatus(off) <-
    	.print("Turning OFF the Led in Arduino!");
    	.argo.act(ledOn).
    
    +port(Port,Status):
    Status = off | Status = timeout <-
    	.argo.percepts(close);
    	.print("It's not over, Mr. Anderson! It's not over!").
    
    
  4. Execute the Multiagent System

    jason jasonWithArgo/jasonWithArgo.mas2j
    

The expected output: