requiring more standard libraries
[ixm-repl.git] / ixm-repl.org
blobb02dd4d8154e2c872c726ab79edd255cbcd8c6c9
1 #+TITLE: IXM repl
2 #+OPTIONS: num:nil ^:nil
3 #+LaTeX_CLASS: normal
4 #+STARTUP: hideblocks
6 See [[http://illuminatolabs.com/IlluminatoXMachina.htm][here]] information on the /Illuminato X Machina/ (IXM)
8 Functions for interacting with a tribe of IXM through =sfbprog= from
9 inside of an [[http:clojure.org][Clojure]] repl.  Allows for accepting input from the tribe
10 and printing to the tribe programmatically, also provides for the
11 definition of reflexes associating different actions (e.g. printing to
12 the repl, logging to a file, etc...) with different packet types.
14 Here is an example session...
15 1) create a persistent connection to the boards through "sfbprog"
16    #+begin_src slime-repl
17      user> (in-ns 'ixm-repl)
18      #<Namespace ixm-repl>
19      ixm-repl> tribe
20      {:sfbprog-cmd "sfbprog", :usb-dev "/dev/ttyUSB0"}
21      ixm-repl> (connect)
22      Ln Sun Apr 18 11:22:54 2010 [Running in server mode]
23      Ln Sun Apr 18 11:22:54 2010 [Loaded EMS:MFL/20100418-172245 Size=72408 CS=B3B15106-58012D1E Copyright=GPL V3]
24      Ln Sun Apr 18 11:22:56 2010 [North baud rate set to 115200]
25      Ln Sun Apr 18 11:23:01 2010 [North baud rate set to 9600]
26      Ln Sun Apr 18 11:23:02 2010 [North baud rate set to 115200]
27      Ln Sun Apr 18 11:23:03 2010 [North seeking arch 2 code, responding]
28      Ln 4.235 Best offer so far: EMS:MFL/20100418-172245 (size 72404) from North ESCHUL/SFBPRG
29      Ln 5.733 About to burn: 0/0 bootCount=1185; burnCount=585 (+1); powerOnHours=889; flags=0
30      Ln Sun Apr 18 11:23:04 2010 [Sending checksum North for 0x10014+32748=C6DDEDD8-F56B9A5]
31      Ln Sun Apr 18 11:23:10 2010 [Sending checksum North for 0x18000+32768=C9DB2E22-ECB85E4F]
32      Ln Sun Apr 18 11:23:10 2010 [Sending checksum North for 0x20000+6868=5CFB5CB9-2317F28C]
33      Ln Sun Apr 18 11:23:11 2010 [North burned successfully!]
34      Ln Sun Apr 18 11:23:15 2010 [North baud rate set to 9600]
35      Ln Sun Apr 18 11:23:34 2010 [North baud rate set to 115200]
36      Ln 33.466 [East seeking arch 2 code, responding]
37      i +35
38      Ln 35.126 [Sending checksum East for 0x10014+32748=C6DDEDD8-F56B9A5]
39      i 99+529-9676*1014y
40      Ln 48.341 [Sending checksum East for 0x18000+32768=C9DB2E22-ECB85E4F]
41      Ln 48.574 [Sending checksum East for 0x20000+6868=5CFB5CB9-2317F28C]
42      Ln 49.496 [East burned successfully!]
43      i 2*2005-y*///
44      #<Object$IDeref$Future$2b9be1f9@5c2a25: :pending>
45    #+end_src
46 2) output from the boards appears in the repl, reflexes can be defined
47    to handle output, the following uses the =dump= function to drop
48    all =i= packets without displaying them to the repl.
49    #+begin_src slime-repl
50      ixm-repl> (add-reflex :i dump)
51      #'ixm-repl/reflexes
52    #+end_src
53 3) the following initiates the collector, which results in a flood of
54    data from the boards, which can be redirected to a file using the
55    =log= function as follows
56    #+begin_src slime-repl
57      ixm-repl> (tribe-print "c4")
58      c (0,0) seconds: 84
59      c (0,0) goal: 55+55+xs*
60      c (0,0) position: (0.00, 0.00)
61      c (0,0) horizon_x: 10.00
62      c (0,0) horizon_y: 0.00
63      c (0,0) neighbor_fitness: -1.00
64      c (0,0) mean_fitness: 16841.17
65      c (0,0) best_fitness: 15091.01
66      c (0,0) fittest_individual: 526x4y7/*
67      c (-1,0) seconds: 36
68      c (-1,0) goal: 55+55+xs*
69      c (-1,0) position: (0.00, 0.00)
70      c (-1,0) horizon_x: 10.00
71      c (-1,0) horizon_y: 0.00
72      c (-1,0) neighbor_fitness: -1.00
73      c (-1,0) mean_fitness: 29855.63
74      c (-1,0) best_fitness: 15091.01
75      c (-1,0) fittest_individual: 23/047-9-*92y3-0y
76      nil
77      ixm-repl> (add-reflex :c (log "/home/eschulte/Desktop/collected"))
78      #'ixm-repl/reflexes
79      ixm-repl> 
80    #+end_src
82 This program is free software; you can redistribute it and/or modify
83 it under the terms of the GNU General Public License as published by
84 the Free Software Foundation; either version 3, or (at your option)
85 any later version.
87 This program is distributed in the hope that it will be useful, but
88 WITHOUT ANY WARRANTY; without even the implied warranty of
89 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
90 General Public License for more details.
92 See the file COPYING for a copy of the GNU General Public License or
93 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
94 Floor, Boston, MA 02110-1301, USA.
96 #+HTML: <img src="http://www.gnu.org/graphics/gplv3-88x31.png"/>