Lesson 1: Agilla Installation

The following instructions assume you have a working version of TinyOS installed on your machine. If you do not, either follow the official instructions on the TinyOS website, or view the instructions here.

Step 1: Download

Download the tarball of Agilla's source code from here. Alternatively, you can grab an older version of Agilla via the TinyOS 1.x CVS repository.

Step 2: Extract

Agilla is located in a directory called 'agilla'. This directory has subdirectories for agilla's NesC code, Agilla agents, and the Java code. Move the Agilla tarball into the location in which you want to install Agilla. The path to this directory should NOT have spaces in it (this is just to make your life easier). From now on, this directory will be referred to $AGILLA. I recommend creating an environment variable, $AGILLA, with Agilla's directory being its value (See optional step 2 below).

Once you have extracted the tarball, Agilla's source code will be located in the following directories:

Step 3: Create Makefile.Agilla

Create a file called "Makefile.Agilla" that contains local settings in $AGILLA/nesc/agilla. To do this, you can simply copy the example file that comes with Agilla.

See $AGILLA/nesc/agilla/README for details on how to customize this file.

Step 4: Compile and Install Agilla on a Mote

Compile and install Agilla onto every mote including the one that is attached to the programming board. Be sure that every mote has a unique TinyOS address.

The actual command will differ slightly between Windows XP and Linux/OSX platforms, and on the type of programming board used. Here are some examples. Please consult the manual for your specific programming board and operating system to determine your exact syntax!

TelosB mote on COM5 with TinyOS address 0:

Mica2 mote on COM1 with TinyOS address 1 and MIB510 programming board:

MicaZ mote on COM3 with TinyOS address 0 and MIB510 programming board:

Step 5: Compile the AgentInjector

The AgentInjector is a Java application that enables users to inject mobile agents into an Agilla WSN. It is located in $AGILLA/java/. The main class is agilla.AgentInjector. In order to compile the AgentInjector, $AGILLA/java must be in the classpath. View the classpath using the following command:

If it is not in the classpath, add it:

Once the classpath is set, create a file called "Makefile.Agilla" within the directory from which you launch the AgentInjector (by default $AGILLA) using the following commands:

$AGILLA/java/agilla/Makefile.Agilla defines the MIG variable, which specifies the target environment that the AgentInjector is connecting to. By default, this file contains:

If the AgentInjector is to connect to a real WSN, leave the default content as it is. If it is going to be used with TOSSIM, uncomment the first line and comment out the second line.

Once you have configured Makefile.Agilla, compile the AgentInjector:

This will generate all of Agilla's messages and compile the AgentInjector.

Step 6: Create an agilla.properties File

Create a file called "agilla.properties" within that directory from which you will launch the AgentInjector, e.g., $AGILLA/java/. This file contains local settings for the AgentInjector. You can copy an example file as follows:

Step 7: Adding RMI Support

This step is only required if you plan on remotely injecting agents using Java RMI. To enable the RMI feature, create a file called "java.policy" in the directory from which you will launch the AgentInjector (e.g., $AGILLA/java) with the following text:

grant {
   permission java.net.SocketPermission "*:1024-65535","accept,connect,listen,resolve";
   permission java.io.FilePermission "<<ALL FILES>>","read,write,execute"; 
   permission java.util.PropertyPermission "user.dir","read,write";
};

You are now ready to inject mobile agents into the WSN! See lesson 2 of the tutorial on how to inject a mobile agent into the WSN.


Optional Step 1: Creating a Makelocal file

A Makelocal file is used by TinyOS to record settings that are specific to the local platform. Here are instructions on how to install a Makelocal file.

Optional Step 2: Configuring Environment Variables

There are several environment variables that will make using Agilla easier. They are not required, but provide shortcuts when performing common tasks. In a Windows XP/Cygwin environment, the following commands may be included in a file called "Agilla.sh" within /etc/profile.d/. In a Linux or OSX environment, they can be included in ~/.bash_profile or ~/.bashrc depending on your specific shell.

export AGILLA=[directory to Agilla's root directory]
alias cda="cd $AGILLA"
alias cdaa="cd $AGILLA/agents"
alias cdaj="cd $AGILLA/java/agilla"

For example, if Agilla is installed in C:\agilla, you would add the following in your /etc/profile.d/Agilla.sh:

export AGILLA=/cygdrive/c/agilla
alias cda="cd $AGILLA"
alias cdaa="cd $AGILLA/agents"
alias cdaj="cd $AGILLA/java/agilla" 

NOTE: To make your life easier, do not have spaces in the path to Agilla's root directory!

Optional Step 3: Enabling direct serial communication between Mica2 and Cricket motes

In order for Mica2 and MicaZ motes to communicate with Cricket motes, you need to change their UART ports to operate at 115.2kbps (the default is 57.6kbps). To change this, open $TOSROOT/tos/platforms/<platform>/HPLUART0M.nc and change outp(15, UBRR0L); to outp(7, UBRR0L);. Note that MicaZ motes use the same HPLUART0M.nc as Mica2 motes.

Optional Step 4: Configuring a Text Editor to Edit Agilla Agents

For Windows users, I recommend using TextPad to edit NesC and Mobile Agent files. Here are the color-syntax configurations for NesC and Agilla Agent files. Install them in <Program Files>\TextPad 4\system.

If you are using Linux, I recommend gEdit. Here are the syntax files. Install them in /usr/share/gtksourceview-1.0/language-specs/

This page was last Updated on July 7, 2008 4:23 PM .


This work is supported by the ONR MURI Project CONTESSA and the NSF under grant number CCR-9970939.