Example Agilla agents can be found in $AGILLA/agents
.
Read the README file within this directory for a description of each
agent.
The AgentInjector searches for an agilla.properties
file in the
directory from which you launched it. This file contains local settings. Possible settings and their default values are listed below.
initDir specifies the initial directory to display when opening a mobile agent. defaultAgent specifies the agent that is automatically loaded when AgentInjector is launched. runTest specifies whether a test should be run. This is used only for experimental purposes. numCol specifies the number of columns there are in the network. This affect the addressing scheme within the network and is only used when grid routing is enabled in Makefile.Agilla. enableClustering controls whether clustering is enabled. Clustering is used in Agilla's location directory service. By default, clustering is disabled. nwName specifies the name of the network. This is used when there are multiple Agilla networks running and a single directory service spans multiple networks. The default value of this is unknown.
$ cd $AGILLA $ java agilla.AgentInjector -comm COM1:57600
// This agent blink all three LEDs, migrates to mote 1, and // then blinks all three LEDs again. // // It should be injected onto the mote that is directly // attached to the programming board. // // Author: Chien-Liang Fok #define SLEEP_PERIOD 10 BEGIN pushc 31 putled // toggle all three LEDs pushc SLEEP_PERIOD sleep pushc 31 putled // toggle all three LEDs pushc 1 smove // strong move to mote 1 pushc 31 putled // toggle all three LEDs pushc SLEEP_PERIOD sleep pushc 31 putled // toggle all three LEDs halt
// This agent blinks the LED three times on the mote that is // attached to the base station, then migrates onto mote 1. // Once it arrives at mote 1, it blinks its LEDs again three // times. // // Author: Chien-Liang Fok #define SLEEP_PERIOD 1 BEGIN pushc RETURN1 pushc THREEBLINK jumps // blink LEDs three times RETURN1 pushc 1 smove // strong move to mote 1 pushc RETURN2 pushc THREEBLINK jumps // blink LEDs three times RETURN2 halt THREEBLINK pushc 0 TBLOOP copy pushc 6 cneq rjumpc TBCONT pop jumps TBCONT pushc 31 putled // toggle all three LEDs pushc SLEEP_PERIOD sleep inc rjump TBLOOPInject this agent onto the mote that is attached to your programming board. Observe how the agent blinks the LEDs three times, migrates onto mote 1, and then blinks all three LEDs three times again.