mobilewireless.php3 29.4 KB
Newer Older
1
2
3
<?php
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2004-2010 University of Utah and the Flux Group.
5
6
7
8
9
# All rights reserved.
#
chdir("..");
require("defs.php3");

10
11
12
13
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("printable",  PAGEARG_BOOLEAN);
14
15
16
17
18
19
20
21
22
23
24

if (!isset($printable))
    $printable = 0;

#
# Standard Testbed Header
#
if (!$printable) {
    PAGEHEADER("Emulab Tutorial - Mobile Wireless Networking");
}

Timothy Stack's avatar
   
Timothy Stack committed
25
26
27
28
29
30
31
echo "
  <head>
  <style text='text/css'>
  @import url(\"$BASEPATH/style-doc.css\");
  </style>
  </head>";

32
33
34
35
36
if (!$printable) {
    echo "<b><a href=$REQUEST_URI?printable=1>
             Printable version of this document</a></b><br>\n";
}

37
38
39
40
41
42
43
44
45
46
function NLCLINKFIG2($link, $value, $caption, $explanation)
{
	echo "<td valign=\"top\" class=\"stealth\" width='50%'>
                <a href=\"$link\" border=\"1\">
                  <center>$value</center></a>
                  <font size=\"-2\"><b>$caption:</b>
                $explanation</font>
              </td>";
}

47
48
49
50
#
# Drop into html mode
#
?>
51
52
<h1 id="doctitle">
THIS PAGE IS OBSOLETE; MOBILE WIRELESS NO LONGER SUPPORTED</h1>
53

Timothy Stack's avatar
   
Timothy Stack committed
54
<h2 id="doctitle">Emulab Tutorial - Mobile Wireless Networking</h2>
55

56
57
<script type="text/javascript">
default_text = "Click on an image to enlarge.";
58

59
60
61
62
if (document.all || document.getElementById || document.layers) {
  has_scripting = true;
  default_text = "(Move mouse over an image to see a caption here; click to enlarge.)";
}
63

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
captions = new Array();
//captions[0] = 'Three of our Acroname Garcia robots.  Each robot has a ' + 
//	      'blue and orange marker from which the localization system ' +
//	      'extracts position and orientation.  All robots have a one ' +
//	      'antenna riser, beneath which is an Intel Stargate and ' +
//	      'Crossbow Mica2 mote.';
captions[0] = 'Three of our modified Acroname Garcia robots.  Fiducials for ' +
	      'vision system atop antenna riser mount; Intel ' +
	      'Stargate and Crossbow Mica2 beneath riser.';
captions[1] = 'A wall-mounted mote.  Mote is behind the serial programming ' +
	      'board; a sensor board is visible in front.';
captions[2] = 'A screenshot of our Java applet motion control interface, ' +
	      'enlarged webcam showing robot motion and position.';
captions[3] = 'Robots prior to antenna riser modifications.  Crosshatch ' +
	      'pattern used for localization system calibration.';
captions[4] = 'A ceiling-mounted mote.';

function imageinfo(msg) {
  mmsg = '<div style="text-align: center; font-size: 10px; font-style: italic;">' + msg +'</div>';
  //mmsg = msg;
  elm = (document.getElementById)?document.getElementById('captionLayer'):(document.all)?document.all['captionLayer']:null;

  if (elm && typeof elm.innerHTML != "undefined") {
    elm.innerHTML = mmsg;
  }
  else if (document.layers) {
    document.layers['captionLayer'].document.write(mmsg);
  }

//  if (document.all) {
//    elm.innerHTML = mmsg;
//  }
//  else if (document.getElementById) {
//    range = document.createRange();
//    range.setStartBefore(elm);
//    html = range.createContextualFragment(mmsg);
//    while (elm.hasChildNodes()) {
//      elm.removeChild(elm.lastChild);
//    }
//    elm.appendChild(html);
//  }
//  else {
//    elm.document.write(mmsg);
//  }
}

</script>
111

Timothy Stack's avatar
   
Timothy Stack committed
112
113
114
115
116
<div class="docsection">
<ul id="robothumbs">
<li><a href="3bots.jpg" onmouseover="imageinfo(captions[0])" onmouseout="imageinfo(default_text)">
<img src="3bots_thumb.jpg" border=1 alt="Our Robots.">
</a></li>
117

Timothy Stack's avatar
   
Timothy Stack committed
118
<li><a href="wall_mote.jpg" onmouseover="imageinfo(captions[1])" onmouseout="imageinfo(default_text)">
119
  <img src="wall_mote_thumb.jpg" border=1 alt="Our Robots.">
Timothy Stack's avatar
   
Timothy Stack committed
120
121
122
</a></li>

<li><a href="interface1.jpg" onmouseover="imageinfo(captions[2])" onmouseout="imageinfo(default_text)">
123
  <img src="interface1_thumb.jpg" border=1 alt="User Interface.">
Timothy Stack's avatar
   
Timothy Stack committed
124
125
126
  </a></li>

<li><a href="5bots.jpg" onmouseover="imageinfo(captions[3])" onmouseout="imageinfo(default_text)">
127
  <img src="5bots_thumb.jpg" border=1 alt="Our Robots.">
Timothy Stack's avatar
   
Timothy Stack committed
128
  </a></li>
129

Timothy Stack's avatar
   
Timothy Stack committed
130
131
132
133
<li><a href="ceiling_mote.jpg" onmouseover="imageinfo(captions[4])" onmouseout="imageinfo(default_text)">
  <img src="ceiling_mote_thumb.jpg" border=1 alt="Our Robots.">
  </a></li>
</ul>
134

Timothy Stack's avatar
   
Timothy Stack committed
135
136
137
138
139
140
<div id="captionLayer" name="captionLayer">
  <script type="text/javascript">
    imageinfo(default_text);
  </script>
</div>
</div>
141

Timothy Stack's avatar
   
Timothy Stack committed
142
143
<div class="docsection">
<h1>Preface</h1>
144

Timothy Stack's avatar
   
Timothy Stack committed
145
146
<div id="toollist">
<h3>Tools:</h3>
147

Timothy Stack's avatar
   
Timothy Stack committed
148
149
150
151
152
153
154
155
156
157
<ul>
<li><a href="<?php echo $TBBASE?>/robotrack/robotrack.php3">Real-time Robot Tracking Applet</a></li>
<li><a href="<?php echo $TBBASE ?>/webcam.php3">Live Webcams</a></li>
<li><a href="<?php echo $TBBASE ?>/robotmap.php3">Static Robot Map</a></li>
<li><a href="<?php echo $TBBASE ?>/newimageid_ez.php3?nodetype=mote">Mote Image
Creation Page</a></li>
<li><a href="<?php echo $TBBASE ?>/wireless-stats/statsapp.php3">WSN Connectivity
Statistics Applet</a></li>
</ul>
</div>
158

Timothy Stack's avatar
   
Timothy Stack committed
159
<p>
Jay Lepreau's avatar
Tweak    
Jay Lepreau committed
160
We have deployed and opened to public external use a small version of
161
what will grow into a large mobile robotic wireless testbed.  The
162
small version (6 Motes and 6 Stargates on 6 robots, all remotely
163
controllable, plus 25 static Motes) is in an open area within our offices;
164
the big one will be elsewhere.
Timothy Stack's avatar
   
Timothy Stack committed
165
</p>
166

167
168
<p>
This manual is broken up into the following sections:
Timothy Stack's avatar
   
Timothy Stack committed
169
</p>
170

Timothy Stack's avatar
   
Timothy Stack committed
171
<ol id="sectionlist">
172
173
<li><a href="#INTRO">Introduction</a>
<li><a href="#MOBILE">Mobile Experiments</a>
174
<li><a href="#WIRELESS">Wireless Traffic (Mobile motes and fixed motes)</a>
175
176
177
<li><a href="#FAQ">Frequently Asked Questions</a>
</ol>

Timothy Stack's avatar
Timothy Stack committed
178
179
<p>
If you are interested in how the mobile testbed works, you can read the
180
181
following paper (to appear at <a href="http://www.ieee-infocom.org/2006/">IEEE
Infocom</a>, April 2006):
Timothy Stack's avatar
   
Timothy Stack committed
182
</p>
Timothy Stack's avatar
Timothy Stack committed
183
184

<blockquote>
185
186
<a href="http://www.cs.utah.edu/flux/papers/robots-infocom06-base.html">
Mobile Emulab: A Robotic Wireless and Sensor Network Testbed</a> 
Timothy Stack's avatar
Timothy Stack committed
187
188
</blockquote>

189
190
<p>
You can read a shorter overview of the mobile testbed in this article:
Timothy Stack's avatar
   
Timothy Stack committed
191
</p>
192
193
194
195
196
197

<blockquote>
<a href="http://www.cs.utah.edu/flux/testbed-docs/teapot05-emulab-only.pdf">
Real Mobility, Real Wireless: A New Kind of Testbed</a>
</blockquote>

Timothy Stack's avatar
   
Timothy Stack committed
198
</div>
199

Timothy Stack's avatar
   
Timothy Stack committed
200
201
202
<div class="docsection">
<h1>Introduction</h1>
<p>
203
<a name="INTRO"></a>
204
In addition to <a href="<? echo "$WIKIDOCURL/wireless" ?>">fixed wireless
205
206
nodes</a> (currently predominantly 802.11), Emulab also features wireless nodes attached
to robots that can move
207
208
209
210
around a small area.  These robots consist of a small body (shown on the right)
with an <a href="http://www.xbow.com/Products/XScale.htm">Intel Stargate</a>
that hosts a mote with a wireless network interface.  The goal of this "mobile
wireless testbed" is to give users an opportunity to conduct experiments with
211
wireless nodes that are truly mobile. 
212
213
<!-- in configurable physical locations and while in motion. -->
For
214
example, mobile nodes could be used to realistically test and evaluate an
215
ad-hoc routing algorithm in a fairly repeatable manner.  This document is
216
intended as a tutorial for those interested in making use of this testbed;
217
there is also a short <a href="<? echo "$WIKIDOCURL/wireless" ?>">reference manual</a>
218
available that gives a few details about the workings of the system.
Timothy Stack's avatar
   
Timothy Stack committed
219
</p>
220

Timothy Stack's avatar
   
Timothy Stack committed
221
<h2>Features</h2>
222

Timothy Stack's avatar
   
Timothy Stack committed
223
224
225
226
227
228
<div class="docfig">
<a href="http://www.acroname.com/garcia/garcia.html">
<img src="garcia-thumb.jpg" alt="Acroname Garcia">
<span class="caption">[Acroname Garcia]</span>
</a>
</div>
229

Timothy Stack's avatar
   
Timothy Stack committed
230
<p>
231
The current features of the mobile wireless testbed are:
Timothy Stack's avatar
   
Timothy Stack committed
232
</p>
233
234
235
236

<ul>
<li>Four <a href="http://www.acroname.com">Acroname Garcia</a> robots
<li><a href="http://www.xbow.com/Products/XScale.htm">Intel Stargate</a> single
Kirk Webb's avatar
   
Kirk Webb committed
237
board computers for each robot. (<b><a href="<?php echo $TBBASE?>/doc/docwrapper.php3?docname=stargatenotes.html">Important Notes!</a></b>)
238
<li>Roaming an area about 8 x 3.5 meters with a sheetrock-covered steel pillar in the middle.
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<li>Each robot has its own
    <a href="http://www.xbow.com/Products/productsdetails.aspx?sid=72">
    900MHz Mica2 mote</a> attached to the Stargate.
<li>25 statically-placed
    <a href="http://www.xbow.com/Products/productsdetails.aspx?sid=72">
    900MHz Mica2 motes</a>, two of which are attached to
    <a href="http://www.xbow.com/Products/productsdetails.aspx?sid=90">
    E-Mote</a> Ethernet gateways for Berkeley Motes.
<li><a href=http://www.xbow.com/Products/productsdetails.aspx?sid=75>
    Mica2 Multi-Sensor Module</a> boards attached to 10 floor level Motes,
    and to each Robot (Stargate) Mote.
<li>Six overhead cameras for vision-based position tracking of the robots.
<li>Three <a href="<?php echo $TBBASE ?>/webcam.php3">webcams</a> for viewing 
the robots in their habitat.
253
254
<li>An <a href="<?php echo $TBBASE ?>/robotmap.php3">abstract map</a> of the
current locations of the robots.
255
256
257
258
<li>A <a href="<?php echo $TBBASE ?>/robotrack/robotrack.php3">live robot
motion control applet</a> for drag and drop control and monitoring of robots.
<li>An <a href="<?php echo $TBBASE ?>/wireless-stats/statsapp.php3">applet for
viewing wireless link connectivity</a> in our WSN testbed.
259
<li>Open for public use weekdays 8am-6pm MST, with operations support.
260
261
</ul>

Timothy Stack's avatar
   
Timothy Stack committed
262
<h2>Limitations</h2>
263

Timothy Stack's avatar
   
Timothy Stack committed
264
<p>
265
266
Due to the "brand-new" nature of this part of Emulab, there are some
limitations you should be aware of:
Timothy Stack's avatar
   
Timothy Stack committed
267
</p>
268
269

<ul>
270
271
272
<li>Before you can use the mobile testbed, your project must be granted the
appropriate privileges.  You can request access by sending mail to <a
href="mailto:testbed-ops@flux.utah.edu">Testbed Operations</a>.
273
274
275
<li>The mobile testbed is currently open on non-holiday weekdays between
8am and 6pm mountain time, so we have staff available to assist with problems.
<li>There is no space sharing; only one mobile experiment can be swapped-in at
276
a time.
Timothy Stack's avatar
   
Timothy Stack committed
277
<li>Batteries must be replaced manually by the operator when levels are low.
278
279
</ul>

280
We expect to overcome these limitations over time; however, we are also eager to
281
282
283
introduce external users to the mobile testbed early on so we can integrate
their feedback.

Timothy Stack's avatar
   
Timothy Stack committed
284
</div>
285

Timothy Stack's avatar
   
Timothy Stack committed
286
287
<div class="docsection">
<h1>Mobile Experiments</h1>
288

Timothy Stack's avatar
   
Timothy Stack committed
289
290
291
292
293
294
295
<div class="docfig">
<span class="caption">Sample Movie</span>
<img src="robot_anim.gif" alt="Robot Movie">
<a href="robot_divx.avi">[DiVX (1.2M)]</a>
<a href="robot.mpg">[MPG (5.3M)]</a>
</a>
</div>
296

Timothy Stack's avatar
   
Timothy Stack committed
297
<p>
298
<a name="MOBILE"></a>
299
300
301
302
Creating a mobile wireless experiment is very similar to creating a regular
Emulab experiment: you construct an NS file, swap in the experiment, and then
you can log into the nodes to run your programs.  There are, of course, some
extra commands and settings that pertain to the physical manifestations of the
Timothy Stack's avatar
   
Timothy Stack committed
303
304
305
306
robots.  This tutorial will take you through the process of: creating a mobile
experiment, moving the robots to various destinations, creating random motion
scenarios, and "attaching" transmitter and receiver motes to the robots in your
experiment.
Timothy Stack's avatar
   
Timothy Stack committed
307
</p>
308

Timothy Stack's avatar
   
Timothy Stack committed
309
<h2>A First Experiment</h2>
310
311
312
313

Lets start with a simple NS script that will allocate a single robot located in
our building:

Timothy Stack's avatar
   
Timothy Stack committed
314
315
<code class="samplecode">
set ns [new Simulator]
316
317
318
319
320
321
322
323
324
325
326
327
source tb_compat.tcl

set topo [new Topography]
$topo load_area MEB-ROBOTS

$ns node-config -topography $topo

set node(0) [$ns node]

$node(0) set X_ 3.01
$node(0) set Y_ 2.49

Timothy Stack's avatar
   
Timothy Stack committed
328
$ns run
329

Timothy Stack's avatar
   
Timothy Stack committed
330
331
332
333
</code>
<span class="caption">Figure 1: Example NS file with mobile nodes.</span>

<p>
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
Some parts of that example should be familiar to regular experimenters, so we
will focus mainly on the new bits of code.  First, we specified the physical
area where the robots will be roaming by creating a "topography" object and
loading it with the dimensions of that area:

<blockquote>
<pre><i>Line 4:</i>  set topo [new Topography]
<i>Line 5:</i>  $topo load_area MEB-ROBOTS</pre>
</blockquote>

In this case, the "MEB-ROBOTS" area is the name given to part of our office
space in the Merrill Engineering Building.  Next, we change the default node
configuration so any subsequent calls to "<code>[$ns node]</code>" will
automatically attach the node to the topography we just created:

<blockquote>
<pre><i>Line 7:</i>  $ns node-config -topography $topo</pre>
</blockquote>

Finally, after creating the robot, we need to set the initial position in the
area:

<blockquote>
<pre><i>Line 11:</i> $node set X_ 3.01
<i>Line 12:</i> $node set Y_ 2.49</pre>
</blockquote>

The values specified above are measured in meters and based on the map located
362
363
364
<a href="<?php echo $TBBASE ?>/robotmap.php3">here</a>, where the origin is in
the upper left hand corner, with positive X going right and positive Y going
down.  You can also click on the map to get a specific set of coordinates.
365
366
Note that any coordinates you specify must not fall inside an obstacle, or they will
be rejected by the system.  A Java applet that updates in real time is linked
Leigh B. Stoller's avatar
Leigh B. Stoller committed
367
368
from the above page, or can be accessed directly
<a href="<?php echo $TBBASE ?>/robotrack/robotrack.php3">here.</a>
369
370
371
372
373
374

<p>
With this NS file you can now create your first mobile experiment.  Actually
creating the experiment is the same as any other, except you might want to
check the "Do Not Swapin" checkbox so that the creation does not fail if
someone else is using the mobile testbed at the time.  Once the area is free
375
for use, you can swap-in your experiment and begin to work.
376

Timothy Stack's avatar
   
Timothy Stack committed
377
<h2>Adding Motion</h2>
378

Timothy Stack's avatar
   
Timothy Stack committed
379
<p>
380
381
Now that you have a node allocated, let's make it mobile.  During swap-in,
Emulab will start moving the node to its initial position.  You can watch its
Timothy Stack's avatar
   
Timothy Stack committed
382
progress by using the "Robot Map" menu item on the experiment page and checking
383
out the <a href="<?php echo $TBBASE ?>/webcam.php3">webcams</a> or
384
the <a href="<?php echo $TBBASE ?>/robotrack/robotrack.php3">applet version of the map</a>
385
that updates in real time.
386

Timothy Stack's avatar
Timothy Stack committed
387
388
<table width="100%" cellpadding=0 cellspacing=0 border=0 class="stealth">
<tr>
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
<?php NLCLINKFIG2("robotmap-ss.gif", 
		  "<img src=\"robotmap-ss-thumb.gif\" border=2
		  alt=\"Robot Map Screenshot\">",
		  "Sample Robot Map Screenshot",
		  "All four robots arranged in an 'L' shape.  The real world
		  coordinates for the robots are in the bottom middle table.")
		  ?>
<?php NLCLINKFIG2("webcam-ss.gif",
		  "<img src=\"webcam-ss-thumb.gif\" border=2
		  alt=\"Webcam Screenshot\">",
		  "Sample Webcam Screenshot",
		  "The real world view of the same four robots from the map
                  screenshot.  Note that the grid on the floor is used to
                  calibrate the overhead tracking cameras and not lines for the
                  robots to follow.") ?>
Timothy Stack's avatar
Timothy Stack committed
404
405
406
</tr>
</table>

Timothy Stack's avatar
   
Timothy Stack committed
407
408
409
<p>
Take a few moments to familiarize yourself with those pages since we'll be
making use of them during the rest of the tutorial.  One important item to note
410
411
412
413
414
on the robot map page is the "Elapsed event time" value, which displays how
much time has elapsed since the robots have reached their initial positions.
The elapsed time is also connected to when <code>"$ns at"</code> events in the
NS file are run.  In this case, there were no events in the NS file, so we'll
be moving the robot by sending dynamic SETDEST events, much like sending START
415
416
and STOP events to <a href="<? echo "$WIKIDOCURL/AdvancedExample" ?>">traffic
generators</a> and <a href="<? echo "$WIKIDOCURL/AdvancedExample#ProgramObjects" ?>">program
Timothy Stack's avatar
   
Timothy Stack committed
417
418
objects</a>.

419
420
421
422
<!-- XXX We need to give them a clue on which way the webcam is pointing in -->
<!-- relation to the robot map. -->

<p>
Timothy Stack's avatar
   
Timothy Stack committed
423
424
Once the robot has reached its initial position, lets move it up a meter.  To
do this, you will need to log in to ops.emulab.net and run:
425

Timothy Stack's avatar
   
Timothy Stack committed
426
427
428
429
430
431
<code class="samplecode">
1 ops:~> /usr/testbed/bin/tevc -e <b>proj</b>/<b>exp</b> \
         now node-0 SETDEST X=3.0 Y=1.5

</code>
<span class="caption">Figure 2: Command to send an event that will move the robot to
Timothy Stack's avatar
   
Timothy Stack committed
432
the coordinates (3.0, 1.5).  Don't forget to change <b>proj</b>/<b>exp</b> to
Timothy Stack's avatar
   
Timothy Stack committed
433
match your project and experiment IDs.</span>
434
435
436

<!-- mention that one setdest will override the previous. --> 

Timothy Stack's avatar
   
Timothy Stack committed
437
<p>
438
Then, check back with the map and webcams to see the results of your handiwork.
439
440
441
442
Try moving it around a few more times to get a feel for how things work and
where the robot can go.  Note that the robot should automatically navigate
around obstacles in the area, like the pole in the middle, so you do not have
to plot your own course around them.
Timothy Stack's avatar
   
Timothy Stack committed
443
</p>
444
445
446
447
448
449

<p>
In addition to driving the robot with dynamic events, you can specify a static
set of events in the NS file.  For example, you can issue the same move as
above at T +5 seconds by adding:

Timothy Stack's avatar
   
Timothy Stack committed
450
451
<code class="samplecode">
$ns at 5.0 "$node(0) setdest 3.01 1.5 0.1"
452

Timothy Stack's avatar
   
Timothy Stack committed
453
454
455
456
457
</code>
<span class="caption">Figure 3: NS syntax that moves the robot to the same
destination as in Figure 2.</span>

<p>
458
459
Note that "setdest" takes a third argument, the speed, in addition to the X and
Y coordinates.  The robot's speed is currently fixed at 0.1 meters per second.
Timothy Stack's avatar
   
Timothy Stack committed
460
</p>
461

Timothy Stack's avatar
   
Timothy Stack committed
462
<h2>Random Motion</h2>
463

Timothy Stack's avatar
   
Timothy Stack committed
464
<p>
465
466
Generating destination points for nodes can become quite a tedious task, so we
provide a modified version of the NS-2 "setdest" tool that will produce a valid
Timothy Stack's avatar
   
Timothy Stack committed
467
468
set of destination points for a given area.  The tool, called "tbsetdest", is
installed on ops and takes the following arguments:
469
470
471
472

<blockquote>
<ul>
<li><b>-n</b> <i>nodes</i> - The total number of nodes to generate motion for.
473
474
The format for the node variables in the generated code is,
"<code>$node(N)</code>", so write your NS file accordingly.
475
476
477
478
479
480
481
<li><b>-t</b> <i>secs</i> - The simulation time, in seconds.
<li><b>-a</b> <i>area</i> - The name of the area where the robots will be
roaming around.  Currently, MEB-ROBOTS is the only area available.
</ul>
</blockquote>

Now, taking your existing NS file, we'll add another node to make things more
Timothy Stack's avatar
   
Timothy Stack committed
482
483
interesting:

Timothy Stack's avatar
   
Timothy Stack committed
484
485
<code class="samplecode">
<i>...</i>
Timothy Stack's avatar
   
Timothy Stack committed
486
487
488
$ns node-config -topography $topo

set node(0) [$ns node]
Timothy Stack's avatar
   
Timothy Stack committed
489
<b>set node(1) [$ns node]</b>
Timothy Stack's avatar
   
Timothy Stack committed
490

Timothy Stack's avatar
   
Timothy Stack committed
491
492
493
494
495
</code>
<span class="caption">Figure 4: Excerpt of the original NS file with an additional
node.</span>

<p>
Timothy Stack's avatar
   
Timothy Stack committed
496
Then, use "tbsetdest" to produce some random motion for both robots:
497
498

<blockquote>
Timothy Stack's avatar
   
Timothy Stack committed
499
<pre>2 ops:~> /usr/testbed/bin/tbsetdest -n 2 -t 60 -a MEB-ROBOTS</pre>
500
501
502
503
</blockquote>

Here is some sample output from the tool:

Timothy Stack's avatar
   
Timothy Stack committed
504
505
<code class="samplecode">
$node(0) set X_ 3.01
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
$node(0) set Y_ 2.49
$node(1) set X_ 1.22
$node(1) set Y_ 3.61
set rtl [$ns event-timeline]
#
# nodes: 2, pause: 0.50, max x: 5.90, max y: 4.00
#
$rtl at 0.50 "$node(0) setdest 0.92 3.28 0.10"
$rtl at 0.50 "$node(1) setdest 0.61 3.02 0.10"
$rtl at 9.50 "$node(1) setdest 0.88 2.09 0.10"
$rtl at 19.64 "$node(1) setdest 2.80 2.07 0.10"
$rtl at 23.37 "$node(0) setdest 5.62 2.79 0.10"
$rtl at 39.43 "$node(1) setdest 4.98 1.65 0.10"
#
# Destination Unreachables: 0
Timothy Stack's avatar
   
Timothy Stack committed
521
#
522

Timothy Stack's avatar
   
Timothy Stack committed
523
524
525
526
</code>
<span class="caption">Figure 5: Sample "tbsetdest" output.</span>

<p>
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
You can then add the second node and motion events by clicking on the "Modify
Experiment" menu item on the experiment web page and:

<ol>
<li>Copying and pasting the "tbsetdest" output into the NS file before the
"<code>$ns run</code>" command; and
<li>Starting the modify.
</ol>

While the modify is working, lets take a closer look at the output of
"tbsetdest".  You may have noticed the following new syntax:

<blockquote>
<pre><i>Line 5:</i>  set rtl [$ns event-timeline]
<i>Lines 9+:</i> $rtl at ...</pre>
</blockquote>

These commands create a new "timeline" object and then add events to it, much
like adding events using "<code>$ns at</code>".  The difference is that the
events attached to a timeline object can be requeued by sending a START event
to the timeline, in contrast to the "<code>$ns at</code>" events which are only
queued when the event system starts up.  This feature can be useful for testing
your experiment by just (re)queueing subsets of events.

551
<p>
Timothy Stack's avatar
   
Timothy Stack committed
552
553
Once the modify completes, wait for the robots to reach their initial position
and then start the robots on their way by running the following on ops:
554

Timothy Stack's avatar
   
Timothy Stack committed
555
556
557
558
<code class="samplecode">
3 ops:~> /usr/testbed/bin/tevc -e <b>proj</b>/<b>exp</b> now rtl START

</code>
Timothy Stack's avatar
   
Timothy Stack committed
559
<blockquote>
Timothy Stack's avatar
   
Timothy Stack committed
560
<span class="caption">Figure 6: Command to start the "rtl" timeline.  Again, don't
Timothy Stack's avatar
   
Timothy Stack committed
561
forget to change <b>proj</b>/<b>exp</b> to match your project and experiment
Timothy Stack's avatar
   
Timothy Stack committed
562
563
IDs.</span>
</div>
564

Timothy Stack's avatar
   
Timothy Stack committed
565
566
<div class="docsection">
<h1>Wireless Traffic</h1>
567

Timothy Stack's avatar
   
Timothy Stack committed
568
569
570
571
572
573
<div class="docfig">
<a href="http://www.tinyos.net/scoop/special/hardware">
<img src="mica2-thumb.jpg" alt="Mica2 Mote">
<span class="caption">[Mica2 Mote]</span>
</a>
</div>
574

Timothy Stack's avatar
   
Timothy Stack committed
575
<p>
576
<a name="WIRELESS"></a>
577
578
579
Now that you are getting the hang of the mobility part of this testbed, we can
move on to working with wireless network traffic.  As stated earlier, each of
the robots carries a Mica2 mote (pictured on the right), which is a popular
580
581
582
device used in wireless sensor networks.  We'll be using the motes on the
mobile nodes you already have allocated and loading them with <a
href="http://www.tinyos.net">TinyOS</a> demo kernels, one that will be sending
Timothy Stack's avatar
   
Timothy Stack committed
583
traffic and the other receiving.
Timothy Stack's avatar
   
Timothy Stack committed
584
</p>
585

Timothy Stack's avatar
   
Timothy Stack committed
586
<h2>Adding Mobile Motes</h2>
587
588
589
590

Adding a couple of motes to your existing experiment can be done by doing a
modify and adding the following NS code:

Timothy Stack's avatar
   
Timothy Stack committed
591
592
<code class="samplecode">
## BEGIN mote nodes
Timothy Stack's avatar
   
Timothy Stack committed
593
$ns node-config -topography ""
594

Timothy Stack's avatar
   
Timothy Stack committed
595
596
597
598
set receiver [$ns node]
tb-set-hardware $receiver mica2
tb-set-node-os $receiver TinyOS-RfmLed
tb-fix-node $receiver $node(0)
599

Timothy Stack's avatar
   
Timothy Stack committed
600
601
602
603
set transmitter [$ns node]
tb-set-hardware $transmitter mica2
tb-set-node-os $transmitter TinyOS-CntRfm
tb-fix-node $transmitter $node(1)
Timothy Stack's avatar
   
Timothy Stack committed
604
605
606
607
## END mote nodes

</code>
<span class="caption">Figure 7: NS syntax used to "attach" motes to a robot.</span>
608

Timothy Stack's avatar
   
Timothy Stack committed
609
<p>
610
611
This code creates two mote nodes and "attaches" each of them to one of the
mobile nodes.  The OSs to be loaded on the mote nodes are the receiver,
612
TinyOS-RfmLed, and the transmitter, TinyOS-CntRfm.  These are standard
613
TinyOS kernels supplied by Emulab; uploading your own is covered below.
614
The receiver kernel will
615
616
617
618
619
620
listen for packets containing a number from the transmitter and display the
number, in binary, on the mote's builtin LEDs.  The transmitter kernel will
then send packets every second containing the value of a counter that goes from
one to eight.  So, if the mote's radios are well within range of each other,
the receiver should pick up the packets and display the number on the LEDs.  Of
course, since you're not physically around to see that, you can click on the
621
622
"Show Blinky Lights" menu item on the experiment web page to bring up a webpage
with an applet that provides a near real-time view of the lights.
623
624

<p>
625
626
627
628
After the modify completes, try moving the nodes close to one another and far
away, to see the lights updating, or not.  You should also try running the
nodes through the random motion created earlier and watching for the same
effect on the lights.
629

Timothy Stack's avatar
   
Timothy Stack committed
630
<h2>Adding Fixed Motes</h2>
631
632
633
634

Adding a fixed mote to your experiment is slightly simpler than adding mobile
motes:

Timothy Stack's avatar
   
Timothy Stack committed
635
636
<code class="samplecode">
## BEGIN fixed mote nodes
637
638
639
set fixed-receiver [$ns node]
tb-set-hardware $fixed-receiver static-mica2
tb-set-node-os $fixed-receiver TinyOS-RfmLed
Timothy Stack's avatar
   
Timothy Stack committed
640
641
642
643
## END fixed mote nodes

</code>
<span class="caption">Figure 8: NS syntax used to add a fixed mote.</span>
644

Timothy Stack's avatar
   
Timothy Stack committed
645
<p>
646
647
648
649
650
651
652
653
654
This code creates a single mote and loads the same TinyOS image as was
previously loaded onto the mobile receiver mote.  Since the fixed
motes are mounted on serial programming boards, you will not be able to access
their LEDs as you did when adding mobile motes.

If you want to choose a specific mote from the topology (view placement and
positions by looking at the <a href="/robotmap.php3">robot map</a>), add the
following NS code:

Timothy Stack's avatar
   
Timothy Stack committed
655
<code class="samplecode">
656
657
tb-fix-node $fixed-receiver mote107

Timothy Stack's avatar
   
Timothy Stack committed
658
659
660
661
</code>
<span class="caption">Figure 9: NS syntax used to select a specific fixed mote.</span>

<p>
662
663
664
This code allows you to explicitly choose mote107, rather than allowing Emulab
to select a mote on your behalf.  Those who require very specific wireless network
topologies may wish to use this command.
Timothy Stack's avatar
   
Timothy Stack committed
665
</p>
666

667
668
669
670
671
672
673
<p>
You can use the 
<a href="<?php echo $TBBASE?>/wireless-stats/statsapp.php3">WSN Connectivity
Applet</a> to choose specific motes with desired 
link quality.  Then, using the mechanism above, you can bind the specific mote
you want to a node name in your experiment.

Timothy Stack's avatar
   
Timothy Stack committed
674
<h2>Custom Mote Applications</h2>
675

676
677
678
679
680
Uploading your own code to run on the motes is easy. Just build your TinyOS app
normally (ie. '<code>make mica2</code>').  Then, upload the binary that gets
placed in <code>build/mica2/main.srec</code> to our
<a href="<?php echo $TBBASE ?>/newimageid_ez.php3?nodetype=mote">mote image
    creation page</a>.  This page will ask you for a 'descriptor'.  This
681
descriptor can then be used in <code>tb-set-node-os</code> lines in your
682
683
684
NS files, and your app will be automatically loaded on the appropriate mote(s).

<p>
685
686
687
688
Alternatively, if you don't have a local TinyOS build environment, just load
ours onto an Emulab PC in your experiment.  You can do this by setting the node
operating system to <b>RHL90-TINYOS</b> using the <code>tb-set-node-os</code>
command (as shown in the Emulab <a
689
href="<? echo "$WIKIDOCURL/Tutorial" ?>">tutorial</a>).  This image is based off Emulab's
690
default RedHat 9.0 image and has an installation of a TinyOS 1.1.14 CVS
691
692
693
694
695
snapshot.  When you log in to the node, the $TOSROOT and $TOSDIR environment
variables will be set to /opt/tinyos-1.x and /opt/tinyos-1.x/tos,
respectively.  Your $CLASSPATH variable will also include the TinyOS Java paths
necessary to run many common Java applications supplied with TinyOS.
<!--
696
697
698
At this time, we don't have a TinyOS installation on the Emulab servers, so
you'll need to have a TinyOS installation to build from on your desktop
machine, or some other machine you control.  We hope to provide a way for you
699
700
701
build TinyOS apps on Emulab in the near future.  
-->
Also, at the current time, all
702
of our motes have radios in the 900MHz band, so see the TinyOS
703
704
705
706
707
<a href="http://www.tinyos.net/tinyos-1.x/doc/mica2radio/CC1000.html">CC1000
radio document</a> to make sure you're tuning the radios to the right band.

<p>
When you inevitably make changes to your code, you can simply place the new
Timothy Stack's avatar
   
Timothy Stack committed
708
kernel in the path that was automatically constructed for you by the image
709
710
711
creation page; the next time you use that OS in an NS file, the new version
will be loaded. If you'd like to load your node code onto your motes without
starting a new experiment, you have two options:
Timothy Stack's avatar
   
Timothy Stack committed
712
</p>
713
714
715
<ul>
  <li> <code>os_load</code> allows you to load an kernel that has already been
     defined as an image, as above. You give it the image descriptor with its
Timothy Stack's avatar
   
Timothy Stack committed
716
     <code>-i</code> argument, and you can either give the physical names of all
717
718
719
720
721
     motes you want to reload, or a <code>-e pid,eid</code> argument to reload
     all nodes in the given experiment.
  <li> <code>tbuisp</code> allows you to load a file directly onto your motes
     without having to register it as an image. This can be a quick way to do
     development/debugging. Just pass it the operation <code>upload</code>, the
Timothy Stack's avatar
   
Timothy Stack committed
722
     path to the file you wish to load, and the physical names of your motes.
723
</ul>
Timothy Stack's avatar
   
Timothy Stack committed
724
<p>
725
726
727
728
729
730
Both of these are commands in /usr/testbed/bin on ops.emulab.net.   They are
also available through our
<a href="<?php echo $TBBASE ?>/xmlrpcapi.php3">XML-RPC interface</a>, so you
can run them from your desktop machine to save time - the file given as an
argument to tbuisp is sent with the XML-RPC, so you don't need to copy it onto
our servers.
Timothy Stack's avatar
   
Timothy Stack committed
731
</p>
732

Timothy Stack's avatar
   
Timothy Stack committed
733
<h2>Mote Serial Interfaces</h2>
734

Timothy Stack's avatar
   
Timothy Stack committed
735
<p>
736
737
738
739
740
741
To facilitate mote interaction, logging, and evaluation, we provide easy
access to each mote's serial programming board's serial interface.  By simply
adding a PC node to your experiment, and adding some NS code, you can
access each mote's serial port directly on that PC.  To access
<code>mote107</code>'s serial interface, add the following NS code to your
experiment: 
Timothy Stack's avatar
   
Timothy Stack committed
742
</p>
743

Timothy Stack's avatar
   
Timothy Stack committed
744
745
<code class="samplecode">
## BEGIN adding mote serial line access
746
747
748
749
set manager [$ns node]
tb-set-node-os $manager RHL-TINYOS

$ns connect [$fixed-receiver console] $manager
Timothy Stack's avatar
   
Timothy Stack committed
750
751
752
753
##END adding mote serial line access

</code>
<span class="caption">Figure 10: Accessing mote serial interface.</span>
754

Timothy Stack's avatar
   
Timothy Stack committed
755
<p>
756
757
758
759
760
761
762
763
764
765
766
767
768
769
This code allocates a single PC, <code>manager</code>, which runs our
<emph>RHL-TINYOS</emph> image for convenience.  Emulab software exports the
serial port from the physical machine to the <code>manager</code> PC, where it
is available as a pseudo tty device.  You can read and write to the ptty
normally, except that some hardware-specific ioctl() syscalls may fail (this
happens because you are not working with the physical serial port).  The pseudo
tty will be available on your <code>manager</code> node as
<b>/dev/tip/MOTE_NAME</b> (in this case,
<b>/dev/tip/fixed-receiver</b>).  You can access other mote serial
interfaces by duplicating the above code, and changing the mote variable.  If
the software you are using to access the mote's serial interface insists on
using <b>/dev/ttyS1</b> or similar, you can simply run the following command on
your <code>manager</code> PC:

Timothy Stack's avatar
   
Timothy Stack committed
770
771
<code class="samplecode">
sudo rm /dev/ttyS1 && sudo ln -s /dev/tip/fixed-receiver /dev/ttyS1
772

Timothy Stack's avatar
   
Timothy Stack committed
773
774
775
776
777
</code>
<span class="caption">Figure 11: Easing the pain for applications that use a specific
serial device.</span>

<p>
778
779
780
781
If you need to use <b>/dev/ttyS0</b> on our RHL-TINYOS images, you may remove
and relink the device as shown in Fig. 11, but background monitor scripts may
decide to restart the serial port getty.  This will remove your link.  However,
you should only need to relink /dev/ttyS0 when you restart your program.
Timothy Stack's avatar
   
Timothy Stack committed
782
</div>
783

Timothy Stack's avatar
   
Timothy Stack committed
784
785
<div class="docsection">
<h1>Frequently Asked Questions</h1>
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803

<table class="stealth">

<a name="FAQ"></a>
<tr><th>How do the robots keep from running into each other/objects?</th></tr>
<tr><td>
The robots are equipped with proximity sensors that can sense objects in their
path.  We use these to detect and navigate around other robots and obstacles
that aren't known ahead of time.
</td></tr>

<tr><th>Do the robots follow the lines on the floor?</th></tr>
<tr><td>
No, the lines on the floor are used to calibrate the overhead cameras that
track the position of the robot.
</td></tr>

</table>
Timothy Stack's avatar
   
Timothy Stack committed
804
</div>
805
806
807
808
809
810
811
812
813

<?php
#
# Standard Testbed Footer
# 
if (!$printable) {
    PAGEFOOTER();
}
?>