Lesson 2: Injecting an agents into a Network
This tutorial assumes you have installed Agilla and set the aliases as
described in Tutorial Lesson 1.
Conventions:
- <agilla> is the location
of Agilla's NesC files, typically /opt/tinyos-1.x/myApps/Agilla and
is quickly reached by typing cda.
- <tos> is the root location of Tinyos, typically /opt/tinyos-1.x/ and is quickly reached by typing cdtos.
Example Agents:
Agilla comes with several example agents in <agilla>/Examples.
Each file is one agent. Some
of the simpler ones include:
- 3Blink.ma - Blinks all three LEDs three times, pauses, repeats
- Bounce0to1.ma - An agent that bounces between nodes
(0,0) and (1,1), blinking the red LED on each node when it arrives.
- Bounce1to2.ma - An agent that bounces between nodes
(1,1) and (2,1), blinking the red LED on each node when it arrives.
- CntToLedsHP.ma - Count up using the heap to store the counter,
displays the last three bits of the counter on the LEDs.
- CntToLedsTS.ma - Count up using a tuple to store the counter,
displays the last three bits of the counter on the LEDs.
- RandomWalk.ma - Randomly walks around the network, blinking all
LEDs three times upon arrival.
- Traverse column.ma - Moves down a column of nodes, each time
turning on the red LED.
- Traverse perimeter.ma - Traverses the perimeter of the network
in a counter-clockwise fashion, each time turning on the red LED.
- Traverse row.ma - Moves down a row, each time
turning on the red LED.
- VisitAll_L2R.ma - Visits every node in the network by sequentially
cloning itself on each row from left to right. Blinks the green
LED after cloning itself.
Injecting an Agent
To inject an agent into the network, you have
open them using the AgentInjector, and select the destination location.
- Run the Agent Injector by typing ri.
You should see:

- Go to File, Open, and choose 3Blink.ma.
You should see the following:

- The instructions shown in the main text area are
the 3Blink agent's. 3Blink simply blinks all 3 LEDs
three times, pauses, and repeats. Below this text area is a panel
that allows you to specify which location to inject the agents
into. Currently, it's set to node (0,0) which has an TOS Address
of 0. The location and TOS Address are related as described here.
If this is not correct, check the
size
of the network by going to
WSN and selecting Grid Size.
- Hit the Inject
Agent! button at the bottom of the Agent Injector and the
agent should be injected into the network. If you selected a destination
location that is several hops away, you should be able to monitor
its progress by seeing the green and red LEDs blink for half a
second as the agent bounces off a node. You can disable
this indicator by commenting out #define SHOW_BOUNCE_LED in <agilla>/types/Agilla.h (Note:
You will have to reinstall Agilla on all of the motes for this
to take effect). When the
arrives, the 3 LEDs should repeately
blink 3 times.
|