University of Queensland - Bachelor of Engineering Thesis
Bridging Sketch and Simulation of Block Diagram Modelled Systems (pdf)
BlocSim is a webserver running Python 2.7. It requires a webcam and a number of third-party Python packages.
###Mosquitto
You may wish to install a Mosquitto client to view/verify the Publish/Subscribe block model output.
Regardless, you do have to install a Mosquitto broker.
-
Ubuntu:
sudo apt-get install mosquitto mosquitto-clients
-
OSX:
brew install c-ares mosquitto mosquitto-clients /usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf mkdir -p ~/Library/LaunchAgents ln -sfv /usr/local/opt/mosquitto/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist
###Pip Package Manager
Most packages can be installed using pip, a python package installer.
pip install <package>
- install
###Virtualenv
You may wish to install BlocSim's dependencies in a standalone python installation using virtualenv.
virtualenv
- install
###OSX - Homebrew
You'll need to install Homebrew, an extremely useful general-purpose install tool.
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" && brew doctor
brew install python
Usage:
brew install <program/library>
###Windows - Binaries
Pre-compiled executable installers are available for many packages
###Package listing
-
OpenCV 2.4
- info- ubuntu install script (downloads & compiles source)
- osx install -
brew tap homebrew/science && brew install opencv
- windows install
-
numpy
- package -
tornado
- package -
sockjs-tornado
- package -
jsonrpclib
- package -
tornadorpc
- package -
Pillow
- package-
osx install:
brew install libtiff libjpeg webp littlecms && sudo pip install Pillow
-
Ubuntu install:
sudo apt-get install tk-dev sudo apt-get install tcl-dev sudo pip install python-tk sudo pip install -I Pillow
-
-
pickleDB
- package -
mosquitto
- package
-
Start the webserver
cd demo && ./blocsim.py
-
Open the control panel in your browser (Chrome, Firefox or Safari)
localhost:8080
-
Subscribe to the Mosquitto messages being published
mosquitto_sub -t "blocsim"
-
Control BlocSim remotely via JSON-RPC calls
localhost:8080/rpc shutdown save_image save_state get_config set_config( key, value ) db_load db_save db_defaults db_load_defaults db_save_defaults cycle_webcam disconnect_webcam Python example: >> from jsonrpclib import Server >> server = Server('http://localhost:8080/rpc') >> print server.get_config() >> # server.<procedure call>(<args>)
-
README.md
- you are here -
LICENSE
- GPL v2 license -
test/
- pre-demo testing files -
demo/
- prototype used for thesis demonstration
config/
- keystore database is saved here
config.db
,defaults.db
- JSON keystores for configuration/calibration options
static/
- static files available to webserver
css/
- stylesheets
style.css
- custom styles
blocsim-style/
- customised JQuery-UI theme built here
images/
- saved webcam images appear here
<timestamp>.jpg
frame.jpg
- copy of most recently saved image
js/
- folder containingjquery
,jquery-ui
,sockjs
and custom javascript
style.js
- UI configuration & visuals
scripts.js
- UI function & server interaction
saves/
- grouped into folders
state_<timestamp>/
frame[1..16].jpg
- images showing all computer vision steps
config.db
- exported config keystore (JSON)
block-model.json
- exported block diagram model (JSON)
templates/
- dynamic 'template' files available to webserver (html files)
*.html
cvcommon.py
- opencv utility file
notes.py
- note-taking, in python comment form
blocsim.py
- main executable file; majority of Python code