M js/classify.js => _static/js/classify.js +0 -0
M js/doors.js => _static/js/doors.js +0 -0
M js/lib/ASCIIMathML.js => _static/js/lib/ASCIIMathML.js +0 -0
M js/lib/jquery-1.11.0.js => _static/js/lib/jquery-1.11.0.js +0 -0
M js/lib/requestAnimationFrame.js => _static/js/lib/requestAnimationFrame.js +0 -0
M js/lib/skulpt-stdlib.js => _static/js/lib/skulpt-stdlib.js +0 -0
M js/lib/skulpt.min.js => _static/js/lib/skulpt.min.js +0 -0
M conf.py +1 -1
@@ 94,7 94,7 @@ html_theme_path = ['.']
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
+html_static_path = ['_static', 'model.html', 'doors.py']
# -- Options for HTMLHelp output ------------------------------------------
M experiment.rst +0 -4
@@ 14,10 14,6 @@ The experiment uses a heated tiny buildi
rate of traffic. By measuring the drop in temperature caused by different numbers of simulated
people arriving, we should see whether, all else equal, the revolving door expends less heat.
-*Model construction and programming is still in progress, more details to follow*
-
-You can run an (incomplete) in-browser demo at `model.html`_
-
Construction
============
M model.html +5 -5
@@ 1,11 1,11 @@
<!DOCTYPE html>
<html>
<head>
- <script src="js/lib/jquery-1.11.0.js"></script>
- <script src="js/lib/skulpt.min.js"></script>
- <script src="js/lib/skulpt-stdlib.js"></script>
- <script src="js/lib/requestAnimationFrame.js"></script>
- <script src="js/doors.js"></script>
+ <script src="_static/js/lib/jquery-1.11.0.js"></script><!-- Sphinx adds this -->
+ <script src="_static/js/lib/skulpt.min.js"></script>
+ <script src="_static/js/lib/skulpt-stdlib.js"></script>
+ <script src="_static/js/lib/requestAnimationFrame.js"></script>
+ <script src="_static/js/doors.js"></script>
<style>
.faults {
display: inline-block;
M readme.md +18 -14
@@ 5,34 5,39 @@ directory. Tested on Kubuntu and Windows
Visit the project site at http://revolvingdoorhoax.org.
-## Dependencies ##
+## Run the experiment ##
-Runs on [Python 2], quick start:
+Set up to expect a virtualenv:
```
virtualenv --python=python2 venv-rdx
```
-Depending on what you want to do, these dependencies may be required:
+1. Build a physical model as described in :doc:`model`
+2. Install the control and data gathering code on Arduino
+3. Run the controller `./serve.py`
+4. Visit http://localhost:8000/model.html
-* [Python 2], for everything except code that runs on Arduino
-* [Docutils], to generate the site, easiest installed through [Sphinx]
-* [pySerial], to control Arduino
+Depends on:
+
+* [Python 2] for everything except code that runs on Arduino
+* [pySerial] to control Arduino
* [Arduino IDE], to upload Arduino software. Alternatively, [Ino] may do the trick, but I haven't
tested with it.
* [Adafruit Motor Shield V2 library], to control the stepper motor
+* [Skulpt] to run the in-browser model
+* [jQuery]
-JavaScript libraries
-====================
+## Build the site ##
-These ship with the project, but I list here to give credit where it's due.
+The site builds with [Sphinx]
-* [jQuery]
-* [Skulpt]
-* [ASCIIMathML]
+```
+pip install sphinx
+make clean html
+```
[Python 2]: https://www.python.org/
-[Docutils]: http://docutils.sourceforge.net/
[Sphinx]: http://sphinx-doc.org/latest/install.html
[pySerial]: http://pyserial.sourceforge.net/
[Arduino IDE]: http://arduino.cc/en/main/software
@@ 40,4 45,3 @@ These ship with the project, but I list
[Adafruit Motor Shield V2 library]: https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/library-reference
[jQuery]: http://jquery.com/
[Skulpt]: http://www.skulpt.org/
-[ASCIIMathML]: http://mathcs.chapman.edu/~jipsen/mathml/asciimath.html
M serve.py +7 -7
@@ 8,6 8,7 @@ import json
import argparse
import os.path
import re
+from SimpleHTTPServer import SimpleHTTPRequestHandler
import SocketServer
import sys
import threading
@@ 19,7 20,6 @@ except ImportError:
pass
import doors
-import dss
import stats
cli = argparse.ArgumentParser("Run a server that can control and monitor a door model")
@@ 198,8 198,7 @@ def advance():
traceback.print_exc()
alive = False
-_LiveSiteHandler = dss.LiveSiteHandler
-class LiveSiteHandler(_LiveSiteHandler):
+class LiveSiteHandler(SimpleHTTPRequestHandler):
next_duration = 0
@@ 256,7 255,7 @@ class LiveSiteHandler(_LiveSiteHandler):
csv = stats.to_csv(scenarios_log)
self._send_content(csv, 'text/csv')
else:
- _LiveSiteHandler.do_GET(self)
+ SimpleHTTPRequestHandler.do_GET(self)
except Exception as e:
traceback.print_exc()
self.send_error(500)
@@ 300,15 299,16 @@ class LiveSiteHandler(_LiveSiteHandler):
def log_request(*args):
pass
-dss.LiveSiteHandler = LiveSiteHandler
if not os.path.exists(os.path.dirname(log_path())):
os.makedirs(os.path.dirname(log_path()))
server_start = datetime.now() # reset since connecting to Arduino takes time
advance()
try:
- print 'Serving on http://localhost:%s' % (cliargs.port or 8000)
+ port = cliargs.port or 8000
+ print 'Serving on http://localhost:%s/model.html' % port
SocketServer.TCPServer.allow_reuse_address = True
- dss.DeadSimpleSite('.').serve(port=cliargs.port)
+ server = SocketServer.TCPServer(('', port), LiveSiteHandler)
+ server.serve_forever()
except KeyboardInterrupt:
print # for shells that echo ctrl+c without newline
finally: