IXM repl
See here information on the Illuminato X Machina (IXM)
Functions for interacting with a tribe of IXM through sfbprog
from
inside of an Clojure repl. Allows for accepting input from the tribe
and printing to the tribe programmatically, also provides for the
definition of reflexes associating different actions (e.g. printing to
the repl, logging to a file, etc…) with different packet types.
Note: Be sure to run your repl from a sketch directory, otherwise the sfbprog command will fail.
Here is an example session…
-
create a persistent connection to the boards through "sfbprog"
user> user> (load-file "/home/eschulte/research/ixm/ixm-repl/src/ixm_repl.clj") #'ixm-repl/connect user> (in-ns 'ixm-repl) #<Namespace ixm-repl> ixm-repl> (connect) ixm-repl> tribe {:sfbprog-cmd "sfbprog", :usb-dev "/dev/ttyUSB0"} ixm-repl> Ln Sun Apr 18 11:22:54 2010 [Running in server mode] Ln Sun Apr 18 11:22:54 2010 [Loaded EMS:MFL/20100418-172245 Size=72408 CS=B3B15106-58012D1E Copyright=GPL V3] Ln Sun Apr 18 11:22:56 2010 [North baud rate set to 115200] Ln Sun Apr 18 11:23:01 2010 [North baud rate set to 9600] Ln Sun Apr 18 11:23:02 2010 [North baud rate set to 115200] Ln Sun Apr 18 11:23:03 2010 [North seeking arch 2 code, responding] Ln 4.235 Best offer so far: EMS:MFL/20100418-172245 (size 72404) from North ESCHUL/SFBPRG Ln 5.733 About to burn: 0/0 bootCount=1185; burnCount=585 (+1); powerOnHours=889; flags=0 Ln Sun Apr 18 11:23:04 2010 [Sending checksum North for 0x10014+32748=C6DDEDD8-F56B9A5] Ln Sun Apr 18 11:23:10 2010 [Sending checksum North for 0x18000+32768=C9DB2E22-ECB85E4F] Ln Sun Apr 18 11:23:10 2010 [Sending checksum North for 0x20000+6868=5CFB5CB9-2317F28C] Ln Sun Apr 18 11:23:11 2010 [North burned successfully!] Ln Sun Apr 18 11:23:15 2010 [North baud rate set to 9600] Ln Sun Apr 18 11:23:34 2010 [North baud rate set to 115200] Ln 33.466 [East seeking arch 2 code, responding] i +35 Ln 35.126 [Sending checksum East for 0x10014+32748=C6DDEDD8-F56B9A5] i 99+529-9676*1014y Ln 48.341 [Sending checksum East for 0x18000+32768=C9DB2E22-ECB85E4F] Ln 48.574 [Sending checksum East for 0x20000+6868=5CFB5CB9-2317F28C] Ln 49.496 [East burned successfully!] i 2*2005-y*/// #<Object$IDeref$Future$2b9be1f9@5c2a25: :pending>
-
output from the boards appears in the repl, reflexes can be defined
to handle output, the following uses the
dump
function to drop alli
packets without displaying them to the repl.ixm-repl> (add-reflex :i dump) #'ixm-repl/reflexes
-
the following initiates the collector, which results in a flood of
data from the boards, which can be redirected to a file using the
log
function as followsixm-repl> (tribe-print "c4") c (0,0) seconds: 84 c (0,0) goal: 55+55+xs* c (0,0) position: (0.00, 0.00) c (0,0) horizon_x: 10.00 c (0,0) horizon_y: 0.00 c (0,0) neighbor_fitness: -1.00 c (0,0) mean_fitness: 16841.17 c (0,0) best_fitness: 15091.01 c (0,0) fittest_individual: 526x4y7/* c (-1,0) seconds: 36 c (-1,0) goal: 55+55+xs* c (-1,0) position: (0.00, 0.00) c (-1,0) horizon_x: 10.00 c (-1,0) horizon_y: 0.00 c (-1,0) neighbor_fitness: -1.00 c (-1,0) mean_fitness: 29855.63 c (-1,0) best_fitness: 15091.01 c (-1,0) fittest_individual: 23/047-9-*92y3-0y nil ixm-repl> (add-reflex :c (log "/home/eschulte/Desktop/collected")) #'ixm-repl/reflexes
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
See the file COPYING for a copy of the GNU General Public License or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.