generate platform_ops.h from platform_ops.proto, and reduce dependencies
[proto.git] / man / src / sim-manual / simulator-user-manual.tex
blob5fa8f986a75165a17bde47409fe3b9606243af3b
1 \documentclass{article}
2 \usepackage{fullpage}
3 \usepackage{graphicx}
4 \usepackage{../svn-multi}
5 \svnid{$Id$}
7 \title{Proto Simulator User Manual}
8 \author{Jacob Beal}
9 \date{Date: \today, SVN Version: \svnrev{}}
11 \newcommand\todo[1]{\immediate\write16{TODO: #1}}
12 \newcommand\broken{{\em Not working!}}
13 \newcommand\experimental{{\em Experimental: behavior may be flawed and
14 may be changed without warning.}}
16 \newcommand\true{{\bf TRUE}}
17 \newcommand\false{{\bf FALSE}}
19 % arguments/keystrokes:
20 \newcommand\var[1]{{\tt #1}}
21 \newcommand\key[1]{{\bf #1}}
22 \newcommand\simarg[2]{\begin{quote} {\bf Argument: \var{#1}} \\ #2 \end{quote}}
23 \newcommand\simkey[2]{\begin{quote} {\bf Key: \key{#1}} \\ #2 \end{quote}}
24 \newcommand\simmouse[2]{\begin{quote} {\bf Mouse: \key{#1}} \\ #2 \end{quote}}
25 \newcommand\simargkey[3]{
26 \begin{quote} {\bf Argument: \var{#1}, Key: \key{#2}} \\ #3 \end{quote}
28 \newcommand\simPMarg[3]{
29 \begin{quote}
30 {\bf Positive Argument: \var{#1}, Negative Argument: \var{#2}} \\ #3
31 \end{quote}
33 \newcommand\simPMargkey[4]{
34 \begin{quote}
35 {\bf Positive Argument: \var{#1}, Negative Argument: \var{#2},
36 Key: \key{#3}} \\ #4
37 \end{quote}
39 % color
40 \newcommand\color[5]{{\bf (Color: {\tt #1} #2, #3, #4, #5)}} % name R G B A
42 \begin{document}
44 \maketitle
46 This is the user manual for the 2nd generation Proto simulator. For
47 installation instructions, see the {\bf Proto Installation Guide}. For
48 a reference of commonly used simulator and language commands, see the
49 {\bf Proto Quick Start}. For a tutorial on the Proto language, see
50 the document {\bf Thinking In Proto}. For a reference to the Proto
51 language, see the {\bf Proto Language Reference}. For information on
52 how to extend the functionality of the simulator, see the {\bf Proto
53 Simulator Developer Reference}.
55 This manual is organized by functional modules within the simulator.
56 For each module, there is a brief description of the purpose and
57 behavior of the module, followed by a list of the command-line
58 arguments, keys, and colors used by that module. Some modules
59 conflict in arguments and keys. Ordinary keys are case sensitive
60 (i.e. \key{c} and \key{C} are different); control keys are case
61 insensitive.
63 When arguments are described, an optional part of an argument is
64 surrounded by square brackets: \var{[]}. Argument names always begin
65 with a dash.
68 \input{../credits.tex}
71 \section{Palette Files}
73 All colors used by the simulator are user-controllable: their default
74 values can be overridden with the use of palette files.
76 \simarg{-palette FILE}{Loads the palette in \var{FILE}. This
77 command can be invoked multiple times, loading multiple palettes.
78 Palettes load in the order they are specified on the command line,
79 with later entries possibly overriding earlier ones.}
81 Palette files are formatted as follows:
82 \begin{itemize}
83 \item Whitespace is ignored
84 \item '\#' as first non-whitespace character in a line indicates a comment
85 \item One color per line, specified \var{NAME RED GREEN BLUE [ALPHA]},
86 where \var{NAME} is the name of the color, and the others are
87 values between zero and one. If unspecified, \var{ALPHA} defaults
88 to 1.0, which is solid.
89 \end{itemize}
90 Each specified color replaces only the current value assigned to that
91 color, so multiple palette files can be layered, each changing only a
92 portion of the colors.
94 \paragraph{Example Palette File:}
95 \begin{quote}
96 \begin{verbatim}
97 # Turn the background a horrid pink
98 BACKGROUND 1 0.8 0.8 1
99 # Make the devices green and the times translucent cyan and white
100 SIMPLE_BODY 0 1 0
101 TIME_DISPLAY 0 1 1 0.5
102 FPS_DISPLAY 1 1 1 0.3
103 \end{verbatim}
104 \end{quote}
107 \section{Core Simulator}
109 The core functions of the simulator are to create a simulation,
110 control its progress, and manage the user interface.
112 If there is precisely one unhandled argument, that argument is taken
113 to be the Proto script to run. If there are no unhandled
114 arguments, the script defaults to \var{(app)}. If there are multiple
115 unhandled arguments, the simulator gives a warning and uses the last
116 one as the script.
118 \simarg{-seed N}{Use \var{N} as a random seed, defaults to a value set
119 by the current time.}
120 \simkey{q}{Quit the simulator.}
122 \simarg{-mag N}{Relative magnification of text displays for each device,
123 default 1.}
124 \simargkey{-i}{i}{Show the ID of each device \color{DEVICE\_ID}{1}{0}{0}{0.8}.
125 Toggled by key.}
127 \paragraph{Starting, Stopping, and Running:}
128 \simargkey{-T}{T}{Display simulator time in lower left corner
129 \color{TIME\_DISPLAY}{1}{0}{1}{1} and frames-per-second in lower
130 right corner \color{FPS\_DISPLAY}{1}{0}{1}{1}. Toggled by key.}
131 \simargkey{-step}{s}{Use stepping mode, advancing one step on key \key{s}}
132 \simkey{x}{Execute freely (ending stepping mode).}
133 \simarg{-stop-after N}{Terminate after \var{N} simulated seconds,
134 default infinity.}
135 \simargkey{-throttle}{X}{Throttle simulated time to advance relative
136 to real time (toggled by key). When the simulator cannot keep up, a
137 warning appears in the lower center
138 \color{LAG\_WARNING}{1}{0}{0}{1}}
139 \simarg{-ratio N}{Ratio between real time and simulated time when
140 throttling is active, default 1}
141 \simarg{-s N}{Set simulated seconds per step, default 0.01/\var{ratio}}
144 \simkey{CTRL-s}{Slow throttled simulator. Each keystroke
145 divides speed by $2^{\frac{1}{4}}$}
146 \simkey{CTRL-a}{Accelerate throttled simulator. Each keystroke
147 multiplies speed by $2^{\frac{1}{4}}$}
148 \simkey{CTRL-d}{Return throttled simulator to a ratio of 1:1 simulated to real
149 time.}
151 \paragraph{Display:}
152 The display background is colored \color{BACKGROUND}{0}{0}{0}{0.5}.
154 \simarg{-window-name NAME}{Title the simulator window \var{NAME},
155 default ``Proto Simulator''}
156 \simargkey{-f}{f}{Full screen display (toggled by key)}
157 \todo{Need to add GLUT geometry arguments}
158 \simarg{-headless}{Run without a display or user interface;
159 default \false{} unless compiled without OpenGL. When headless,
160 \var{-stop-after} must be specified.}
162 \simkey{PAGE UP}{Zoom in.}
163 \simkey{PAGE DOWN}{Zoom out.}
164 \simkey{z}{Reset display to initial view.}
165 \simkey{ARROW KEYS}{Shift simulation display in the direction of the arrow,
166 in the simulation's coordinate system.}
167 \simmouse{LEFT DRAG}{Rotate display.}
168 \simmouse{RIGHT DRAG}{Zoom display; toward center zooms out, away zooms in.}
170 \paragraph{Selection:}
171 Selected devices are indicated with a thin ring
172 \color{DEVICE\_SELECTED}{0.5}{0.5}{0.5}{0.8} four times the device's
173 body diameter,
175 \simmouse{LEFT CLICK}{Select the devices clicked on.}
176 \simmouse{RIGHT CLICK}{Select, then print the state of the selected
177 device(s) to standard out.}
178 \simmouse{SHIFT LEFT DRAG}{Toggle the selection of all devices in a
179 rectangular display region. The area to be selected is colored
180 \color{DRAG\_SELECTION}{1}{1}{0}{0.5}.}
181 \simmouse{SHIFT RIGHT DRAG}{Move selected devices.}
182 \simkey{U}{Unselect all devices.}
184 \paragraph{Code}
185 \simkey{l}{Recompile and reload the current script, injecting at
186 the selected devices.}
187 \simarg{--platform PLAT}{Use the platform \var{PLAT}. This causes
188 proto to look for the files
189 \code{\var{\$datarootdir}/proto/platforms/\var{PLAT}/platform\_ops.h}
190 and \var{platform\_ops.proto} to define the platform-specific ops
191 that the compiler will use.}
192 \simarg{--path PATH}{Add the directories in \var{PATH} to the front of the list
193 of directories searched when looking for files (e.g. Proto programs). By
194 default, the path contains \var{.} (the current directory) and
195 \var{\$libdir/proto/}.}
196 \simarg{--basepath PATH}{Override the default Proto path, substituting
197 \var{PATH} instead.}
198 \simarg{--print-ast}{During compilation, print out the intermediate
199 abstract-syntax-tree form. \experimental{}}
200 \simarg{--instructions}{After compiling, print the script instructions
201 that have been generated, in the form of a C array includable in a
202 header file. \experimental{}}
203 \simargkey{-k}{k}{Display the current script across the middle of the window
204 (toggled by key). \broken{}}
205 \simargkey{-show-script-version}{j}{Show what version of the script is
206 loaded at each device \color{DEVICE\_SCRIPT}{1}{0}{0}{0.8}. Toggled
207 by key.}
208 \simargkey{-v}{n}{Show value computed at each device
209 \color{DEVICE\_VALUE}{0.5}{0.5}{1}{0.8}. Toggled by key.}
210 \simargkey{-sv}{v}{When device outputs a 2- or 3-tuple, display it as
211 a vector (toggled by key). The vector is interpreted as meters,
212 drawn as a line \color{VECTOR\_BODY}{0}{0}{1}{0.8} with a
213 differently colored tip to indicate direction
214 \color{VECTOR\_TIP}{1}{0}{1}{0.8}.}
217 \section{Debugging}
219 The debugger logs chosen types of activity to standard out. To
220 prevent complete overload, debugging information flows only when
221 global debug mode is on and then only from devices selected for
222 debugging. In that case, debugging information from designated
223 categories prints to standard out from the devices selected for debugging.
224 Devices currently logging debugging information are shown by a filled
225 disc twice the size of the device
226 \color{DEVICE\_DEBUG}{1}{0.8}{0.8}{0.5}.
228 For example, to get a trace of networking activity in the kernel, add
229 the command line arguments \var{-g -debug-kernel}, then select the
230 desired devices and hit \key{D}.
232 \simkey{D}{Toggle selection for debugging on selected devices.}
233 \simargkey{-g}{d}{Global debug mode (toggled by key)}
234 \simargkey{-t}{a}{When debugging, post trace of evaluation in kernel
235 of debug devices (toggled by key).}
236 \simarg{-debug-kernel}{When debugging, post trace of networking
237 activity in kernel}
238 \simarg{-debug-script}{When debugging, post trace of viral code
239 distribution in in kernel}
242 \section{State ``Dumping''}
244 The simulator can save ``dumps'' that contain a snapshot of the
245 current state of every device in the simulator. These snapshots
246 produce Matlab-readable files. The first line is a Matlab comment
247 containing the names of all the state fields to be dumped; each
248 subsequent line contains the state of a device, one number per field,
249 with fields separated by white-space.
251 The first three fields are always \var{UID TICKS TIME}, giving device
252 ID, number of rounds executed, and current time estimate.
254 Each simulator module has two arguments, \var{-D{\em module}} and
255 \var{-ND{\em module}} that assert that state for the module must or
256 must not be included in dumps, respectively. Some modules also have an
257 argument \var{-D{\em module}-mask} that allows specific elements of
258 its state to be included and excluded. The first element is enabled
259 by the first bit, the second by the second bit, and so on; these masks
260 generally default to -1, meaning that all elements will be included.
261 These dumping arguments also control what information is printed when
262 a device state is printed to standard out, though that is printed more
263 verbosely.
265 When a snapshot is taken, the screen flashes for 1/10 of a second
266 \color{PHOTO\_FLASH}{1}{1}{1}{1}. Snapshot data is recorded in files
267 named \var{$\{$STEM$\}\{$SIM TIME$\}$.log} for automatic dumps and
268 \var{$\{$STEM$\}\{$REAL TIME$\}$-$\{$SIM TIME$\}$.log} for dumps triggered by
269 the user.
271 % A dump has verbosity 0, 1 or 2; right now nothing calls 2
273 \simarg{-no-dump-snaps}{Don't show a flash on dumps.}
274 \simkey{Z}{Dump a snapshot immediately.}
275 \simargkey{-D}{9}{Enable periodic dumping of data. Disabled by default.}
276 \simkey{0}{Disable periodic dumping of data.}
277 \simarg{-dump-after N}{Start periodic dumping at time \var{N}, default 0.}
278 \simarg{-dump-period N}{During periodic dumping, snapshot once every \var{N}
279 seconds, default 1.}
280 \simarg{-dump-dir DIR}{Store snapshot files in directory \var{DIR}, default
281 \var{dumps/}. If the directory does not exist, it will be created.}
282 \simarg{-dump-stem STEM}{Start snapshot file names with \var{STEM}, default
283 \var{dump}.}
285 \simPMarg{-Dall}{-NDall}{By default, are all modules included in dumps?
286 Default \true{}.}
287 \simPMarg{-Dhood}{-NDhood}{Include neighborhood data in printed state,
288 but not snapshot files (due to variability of size).}
289 \simPMarg{-Dvalue}{-NDvalue}{Include output value in dumps?}
291 \simargkey{-probe-dump-filter}{8}{``Probe filtering'' an unimplemented feature
292 from the 1st generation simulator. \broken{}}
295 \section{Device Distribution}
297 Simulations are created with \var{n} devices distributed through a
298 bounded 2D or 3D volume according to one of several distribution
299 rules.
301 \simarg{-n N}{Number of devices.}
302 \simarg{-3d}{Use a 3D distribution; default is 2D.}
303 \simarg{-dim X [Y [Z]]}{Set bounds of initial device distribution,
304 defaults are $\var{X}=132$, $\var{Y}=100$, and $\var{Z}=0$
305 ($\var{Z}=40$ for 3D). Specifying a \var{Z} argument implies a 3D
306 distribution.}
308 By default, devices are distributed uniformly randomly through the
309 initial volume.
311 \simarg{-fixedpt X Y [Z]}{Set the position of the first device (Z
312 defaults to 0); all others are distributed uniformly randomly. If
313 used more times, times the argument sets the position of more
314 devices (e.g. the second use sets the position of the second
315 device).}
316 \simarg{-grid}{Distribute devices in a grid that evenly fills the
317 initial volume. If the grid does not divide evenly, the rightmost
318 row/plane will be incomplete.}
319 \simarg{-grideps EPSILON}{Distribute devices in a grid as for
320 \var{-grid}, but shift each device randomly in the range
321 $[-\epsilon/2,\epsilon/2]$ for each coordinate.}
322 \simarg{-xgrid}{Distribute X on a grid and Y randomly. If 3D, Z is
323 distributed on a grid as well.}
326 \section{Device Time}
328 Each device tracks its estimated time independently, executing the
329 Proto program at regular intervals. The relationship between device
330 time and simulator time may vary, however.
332 \simarg{-sync}{Synchronized execution of devices: no variation in rate
333 or phase.}
335 \simarg{-desired-period P}{Base number of device seconds between
336 executions, default 1.}
337 \simarg{-desired-period-variance PV}{Device periods are distributed randomly
338 in the range $[\var{P}-\var{PV},\var{P}+\var{PV}]$, defaulting $\var{PV}=0$.}
339 \simarg{-desired-ratio R}{Base ratio between device time and simulator time,
340 default 1.}
341 \simarg{-desired-ratio-variance RV}{Device/simulator time ratios are
342 distributed randomly in the range
343 $[\var{R}-\var{RV},\var{R}+\var{RV}]$, defaulting $\var{RV}=0$.}
346 \section{Unit Disc Radio Communication}
348 Currently, the only communication model supported by the simulator
349 is unit disc radio communication. In this model, any pair of devices
350 within a fixed radius $r$ can communicate. While unit disc is only a coarse
351 approximation of real radio communication, it is a useful first
352 approximation.
354 To speed up computation of neighbors, the devices are distributed into
355 a grid of cells $r$ in diameter. In order to find its neighbors, a
356 device thus needs only to search through adjacent cells.
358 The kernel has the option to decrease frequency of transmissions when
359 nothing is changing in a node's outputs. Ordinarily it transmits
360 every round, but when radio backoff is enabled, it increments its
361 backoff level $b$ each transmission with unchanged values, setting the
362 number of rounds between transmissions $R$ to
363 $$R = \lceil{1.6^{b}}\rceil$$
364 The backoff level is capped at 11, which gives $R=176$. When values
365 change, the backoff level goes back to $b=0$ immediately.
367 \simPMarg{-Dradio}{-NDradio}{Include radio data in dumps? At present,
368 however, no fields are dumped.}
370 \simarg{-debug-radio}{When debugging, post neighbor decision-making
371 process and display cell ID
372 \color{RADIO\_CELL\_INFO}{0}{1}{1}{0.8}.}
374 \simarg{-r N}{Transmission range for radio, default 15.}
375 \simarg{-ns N}{Set transmission range to get an expected neighborhood
376 size of \var{N}. Overrides \var{-r}.}
377 \simarg{-txerr N}{Probability of failure on message transmit, default 0.}
378 \simarg{-rxerr N}{Probability of failure on message receive, default 0.}
380 \simarg{-no-motion-pruning}{Ordinarily, moving devices delete
381 neighbors that go out of range; this suppresses that behavior,
382 requiring them to time out instead.}
384 \simargkey{-radio-backoff}{CTRL-x}{Use exponential backoff of
385 transmission frequency (toggled by key).}
387 \paragraph{Display}
388 \simargkey{-c}{c}{Display network connections (toggled by key).}
389 \simargkey{-sharp-connections, -sharp-neighborhood}{C}{When network
390 connections are displayed, the lines are drawn either thin and sharp
391 \color{NET\_CONNECTION\_SHARP}{0}{1}{0}{1} or thick and fuzzy
392 \color{NET\_CONNECTION\_FUZZY}{0}{1}{0}{0.25}. There are three modes:
393 either all are fuzzy (default), all are sharp, or lines are sharp where
394 they connect to selected devices. The \key{C} key cycles through the
395 three display modes.}
396 \simargkey{-lc}{CTRL-c}{Display ``logical connectivity''---connections
397 that are listed in a device's neighborhood, whether or not they currently
398 exist. \color{NET\_CONNECTION\_LOGICAL}{0.5}{0.5}{1}{0.8}}
399 \simargkey{-show-radio}{r}{Display a ring around each device at its radio
400 range. \color{RADIO\_RANGE\_RING}{0.25}{0.25}{0.25}{0.8}}
401 \simargkey{-show-radio-backoff}{S}{Display the current radio backoff level.
402 \color{RADIO\_BACKOFF}{1}{0}{0}{0.8}}
405 \section{Simple Dynamics}
407 The ``simple dynamics'' physics package evolves bodies based on their
408 velocity, does not handle collisions, and allows instantaneous shifts
409 in velocity. The Proto function \var{(mov $vector$)} is used to set
410 the velocity of devices. Simple dynamics is the default physics
411 package.
413 Bodies are shown as circles \color{SIMPLE\_BODY}{1}{0.25}{0}{0.8} when
414 movement is enabled, points when it is not.
416 \simPMarg{-Ddynamics}{-NDdynamics}{Include dynamics data in dumps?
417 Fields are: \var{X Y Z V\_X V\_Y V\_Z RADIUS}.}
418 \simarg{-Ddynamics-mask MASK}{Set which fields are included in
419 dumps, default all ($\var{MASK}=-1$).}
421 \simarg{-rad N}{Radius of a device body, defaults from the initial
422 distribution bounds: $\sqrt{0.087*(width*height/n)}$}
423 \simargkey{-h}{h}{Show heading of a device with a tick on the body.}
424 \simarg{-S N}{Maximum speed of devices, default 100.}
425 \simPMargkey{-w}{-nw}{w}{Are there walls that repel devices from the
426 edge of the initial distribution bounds? Default is \false{}. The
427 repulsive velocity is proportional to the distance into the wall
428 zone, starting 80\% of the distance from the center of the bounds.}
429 \simarg{-floor}{Include a ``floor'' at $Z=0$ that 3D devices cannot
430 move below.}
431 \simargkey{-m}{m}{Enable movement (toggled by key).}
432 \simargkey{-hide-body}{b}{Do not draw bodies (toggled by key).}
435 \section{ODE Dynamics}
437 The ``ODE dynamics'' physics package uses the Open Dynamics
438 Engine\cite{ode}, a free open-source Newtonian physics simulator. ODE
439 provides a high-quality simulation including collisions and joint
440 physics. The Proto function \var{(mov $vector$)} is used to set the
441 desired velocity of devices, which then accelerate to try to maintain
442 that velocity.
444 Physics is always run in three dimensions, so ``2D'' means gravity and
445 a floor, while ``3D'' means no gravity and no floor. When there is a
446 floor, it is set such that the center of a device is at $Z=0$ when the
447 device is resting on the floor.
449 Device bodies are cubes \color{ODE\_BOT}{1}{0}{0}{0.7}, with wire-box
450 edges \color{ODE\_EDGES}{0}{0}{1}{1}. When a device is selected, its
451 color changes \color{ODE\_SELECTED}{0}{0.7}{1}{1}. It is possible for
452 bodies in ODE to disable evolution, typically when a body is at rest
453 and not interacting with other bodies. If this happens, the color of
454 the body changes \color{ODE\_DISABLED}{0.8}{0}{0}{0.7}.
456 Walls are boxes; when visible they are
457 \color{ODE\_WALL}{1}{0}{0}{0.1} with wire-box edges the same color as
458 device bodies. Walls, when present, are 10 meters thick, centered on
459 the X-Y edges of the initial distribution bounds, and extend in Z ten
460 times the Y dimension of the pen. The corners have a 45-degree wall
461 20 meters thick that smooths the corners of the pen.
463 \simarg{-ODE}{Use ODE dynamics for physics.}
464 \simPMarg{-Ddynamics}{-NDdynamics}{Include dynamics data in dumps?
465 Fields are: \var{X Y Z V\_X V\_Y V\_Z Q\_0 Q\_1 Q\_2 Q\_3 W\_X W\_Y W\_Z},
466 where \var{Q\_$i$} is the quaternion specifying orientation and
467 \var{W\_$i$} is the angular velocity.}
468 % there should be a mask, but there isn't currently
469 \simarg{-rad N}{Radius of a device body, defaults from the initial
470 distribution bounds: $\sqrt{0.087*(width*height/n)}$}
471 \simarg{-density N}{Density of device bodies, which determines mass.
472 Default is 0.0625.}
473 \simarg{-S N}{Maximum speed of devices, default 100.}
474 \simargkey{-m}{m}{Enable movement (toggled by key).}
475 \simargkey{-hide-body}{b}{Do not draw bodies (toggled by key).}
476 \simPMargkey{-w}{-nw}{w}{Are there walls that pen devices into
477 the initial distribution bounds? Default is \false{}.}
478 \simarg{-substep}{Size of physics ``microsteps'' used by ODE, default
479 0.001. If too large, the simulation becomes unstable and devices
480 will fly off the screen.}
481 \simarg{-draw-walls}{Display the walls, when there are walls.}
482 \simarg{-inescapable}{If any device escapes the walls (when there are
483 walls), put it back inside using the starting distribution. If the
484 starting distribution cannot supply another location, kill the
485 device instead.}
486 \simarg{-rainbow-bots}{Set device color by map device IDs onto hue,
487 full saturation and value, alpha=0.7.}
490 \section{Debugging I/O}
492 This module gives simple sensors and actuators useful for debugging in
493 the simulator. The sensors are three boolean ``user sensors'' read by
494 the Proto function \var{(sense $n$)}, where $n$ is 1, 2, or 3. When
495 \true{}, each sensor displays a disc four times the device size,
496 colored \color{USER\_SENSOR\_1}{1.0}{0.5}{0}{0.8},
497 \color{USER\_SENSOR\_2}{0.5}{0}{1}{0.8}, or
498 \color{USER\_SENSOR\_3}{1.0}{0}{0.5}{0.8} respectively.
500 The actuators are red, green, and blue LEDs, set by Proto functions
501 \var{(red $value$)}, \var{(green $value$)}, and \var{(blue $value$)},
502 respectively. The LEDs may be shown independently as discs the size
503 of the device body, with colors \color{RED\_LED}{1}{0}{0}{0.8},
504 \color{GREEN\_LED}{0}{1}{0}{0.8}, \color{BLUE\_LED}{0}{0}{1}{0.8}.
505 Independent LEDs normally show their value both in intensity of color
506 and $Z$ displacement of the LED disc above the device. LEDs may also
507 be displayed mixed together into one double-sized disc with base color
508 \color{RGB\_LED}{1}{1}{1}{0.8}, where the base color is scaled by LED
509 values.
511 There are also three probes, which can expose intermediate values from
512 evaluation. They display the values as a tuple above each device in
513 the positive $Y$ direction \color{DEVICE\_PROBES}{0}{1}{0}{0.8}.
515 \simPMarg{-Ddebug}{-NDdebug}{Include debug module data in dumps?
516 Fields are: \var{USER1 USER2 USER3 RED\_LED GREEN\_LED BLUE\_LED}.}
517 \simarg{-Ddebug-mask MASK}{Set which fields are included in dumps,
518 default all ($\var{MASK}=-1$). Fields start at \var{0x2}, not
519 \var{0x1} (e.g. \var{RED\_LED} is controlled by \var{0x10}) due to a
520 removed field.}
521 \simargkey{-probes N}{p}{Display the first \var{N} of the three probes.
522 The \var{p} key cycles through how many are shown.}
523 \simargkey{-l}{L}{Display LEDs (toggled by key).}
524 \simargkey{-led-ghost}{1}{LED value controls transparency too, with 0
525 completely transparent and 1 completely opaque. Toggled by key.}
526 \simargkey{-led-flat}{2}{Do not use displacement in $Z$ to show LED value.
527 Toggled by key.}
528 \simargkey{-led-stacking N}{3}{Set LED stacking to one of three modes.
529 Mode 0 stacks LEDs directly, in order red, green, blue bottom to top.
530 Mode 1 sets heights independently, plus an offset of 1 meter for green
531 and 2 meters for blue. Mode 2 sets heights independently. The \var{3} key
532 cycles through the modes.}
533 \simargkey{-led-blend}{4}{Show the LEDs as an RGB blend rather than
534 independently. Toggled by key.}
535 \simkey{t}{Toggle user sensor 1 on selected devices.}
536 \simkey{y}{Toggle user sensor 2 on selected devices.}
537 \simkey{u}{Toggle user sensor 3 on selected devices.}
540 \section{Simple Life Cycle}
542 This module allows devices to duplicate themselves or suicide.
543 Duplication rate is limited by a cloning timer: devices can only
544 duplicate when the timer expires.
546 \simPMarg{-Dclone}{-NDclone}{Include life cycle data in dumps?
547 Fields are: \var{CLONETIME} (the time remaining before a clone can be made).}
548 \simarg{-clone-delay N}{Minimum number of seconds between duplications,
549 default 1.}
550 \simkey{B}{Clone selected devices.}
551 \simkey{K}{Kill selected devices.}
554 \section{Mote I/O}
556 This module represents the collection of sensor and actuator hardware
557 that we have used on Mica2 Motes at various times. There is one actuator
558 (a speaker), four sensors (a light sensor, microphone, temperature sensor,
559 and short sensor), and two controls (a button and a slider). Of these,
560 the 2nd generation simulator only implements the button, which is
561 drawn as a four-times radius disc \color{BUTTON\_COLOR}{0}{1}{0.5}{0.8}.
563 \simarg{-mote-io}{Use the Mode I/O module.}
564 \simPMarg{-Dmoteio}{-NDmoteio}{Include Mote I/O data in dumps?
565 Fields are: \var{SOUND TEMP BUTTON}.}
566 \simkey{N}{Toggle button on selected devices.}
569 \section{Other Modules}
571 There are a number of other modules in the 2nd generation simulator
572 which either have no controls or are not yet properly implemented.
574 \paragraph{Perfect Localizer}
575 The only localizer implemented is a perfect localizer that supplies
576 error-free device coordinates and velocity in global coordinates. It
577 has no controls.
579 \paragraph{Mote-link}
581 The mote-link allows the simulator to interface with a network of
582 Mica2 Motes, creating a mixed network of real and simulated devices.
583 It is not yet implemented for the 2nd generation simulator. When it
584 is, it will be invoked with the argument \var{-motelink}, and real
585 devices will be drawn with \color{MOTE\_BODY}{1}{0}{1}{0.8}.
587 \paragraph{Platforms}
589 There are no 2nd generation versions of kernels for the mote, swarm,
590 or topobo platforms.
592 \begin{thebibliography}{}
593 \bibitem{ode}
594 R.~Smith, G.~Carlton, F.~Condello, N.~Lin, M.~C. Martin, T.~Schmidt,
595 K.~Slipchenko, J.~Smith, V.~Macagon, A.~D. Moss, E.~de~Vries, N.~Waddoups,
596 and D.~Whittaker.
597 \newblock Open Dynamics Engine (version 0.7).
598 \newblock {\tt http://www.ode.org}, 2001 to 2006.
599 \end{thebibliography}
601 \begin{appendix}
602 \section{Keyboard Assignments:}
604 Gray indicates reserved or unusable keys. Many keys are rendered
605 unusable by the peculiarities of GLUT, including its inconsistent
606 implementation across platforms. Blue is allocated keys, pink is
607 non-functional or conflicting keys, and green is keys reserved for
608 import of more 1st generation simulator functions.
610 \begin{figure}[hp]
611 \centering
612 \includegraphics[width=6in]{figures/keyboard-lower.eps}
613 \caption{Lower case keyboard assignments}
614 \end{figure}
616 \begin{figure}[hp]
617 \centering
618 \includegraphics[width=6in]{figures/keyboard-upper.eps}
619 \caption{Upper case keyboard assignments}
620 \end{figure}
622 \begin{figure}[hp]
623 \centering
624 \includegraphics[width=6in]{figures/keyboard-ctrl.eps}
625 \caption{Control-key keyboard assignments}
626 \end{figure}
628 \section{Mouse Assignments:}
630 \begin{center}
631 \begin{tabular}{|l|cccc|}
632 \hline
633 BUTTON & CLICK & DRAG & SHIFT-CLICK & SHIFT-DRAG \\ \hline
634 LEFT & select & rotate & --- & select region \\
635 RIGHT & print & zoom & --- & move devices \\
636 MIDDLE & --- & --- & --- & --- \\
637 \hline
638 \end{tabular}
639 \end{center}
641 \end{appendix}
643 \end{document}