Difference between revisions of "Agilla Tutorial Lesson 2: Injecting an Agent"

From Cyber-Physical Systems Laboratory
Jump to navigationJump to search
m
Line 1: Line 1:
Example agents can be found in $TOSROOT/contrib/wustl/apps/AgillaAgents. Read the README file within this directory for a description of each agent.
+
Example agents are in $TOSROOT/contrib/wustl/apps/AgillaAgents. Read the README file within this directory for a description of each agent.
  
 
== Configuring the AgentInjector ==
 
== Configuring the AgentInjector ==

Revision as of 19:09, 10 December 2007

Example agents are in $TOSROOT/contrib/wustl/apps/AgillaAgents. Read the README file within this directory for a description of each agent.

Configuring the AgentInjector

The AgentInjector searches for an agilla.properties file in the directory from which you launched it. This file may contain the following properties:

initDir=../../apps/AgillaAgents
defaultAgent=3Blink.ma
runTest=false
  • initDir specifies the directory that the open dialog should be at when it is opened for the first time.
  • defaultAgent specifies the agent that should be opened when the AgentInjector starts. This agent must be located in the initDir.
  • runTest specifies whether an experiment should be run. This is only used for debugging and evaluation purposes and should remain off in normal use.

Injecting an Agent

To inject an agent into the network, you have open them using the AgentInjector, and select the destination location.

Step 1: Run the Agent Injector

Attach a mote to the PC and launch the AgentInjector using the appropriate COM port. The following example assumes the mote is attached to COM1.

cd $TOSROOT/contrib/wustl/tools/java
java -Djava.security.policy=java.policy edu.wustl.mobilab.agilla.AgentInjector \
  -comm COM1:57600 -d &

You should see the following GUI:

The Agilla AgentInjector with agent 3Blink.ma opened.

Type Ctrl+r while looking at the motes. They should all turn on all 3 LEDs on for 1 second indicating that they are resetting. If this does not occur, ensure that a mote is correctly attached to the PC. Refer to the troubleshooting section if you continue to have problems injecting agents.

Type the address of the mote attached to the PC in the TOS Address box, and then click on the Inject Agent!! button. The 3Blink agent will then be compiled and injected into the network. Watch the mote attached to the PC. It should blink its LEDs 3 times each time you inject this agent.