[Automatakit](http://gitlab.cba.mit.edu/jakeread/automatakit) is a system architecture for robotics where machine controllers are extensible, and organized around the principle of event propagation: things happen because of other things that have happened beforehand.
This is a piece of software that is designed to help you assemble high level controllers from dataflow software elements. It serves a graphical programming interface, and is meant to live with dataflow hardware elements from [this project 'automatakit'](https://gitlab.cba.mit.edu/jakeread/automatakit).
It's in the early stages, so bear with us. Everything is going to be great.
# Usage
# Installing Node.js, WebSocket and SerialPort
To Run DMC, you'll need to install node.js, and then the packages serialport and ws (websocket).
## Install Node.js
Node.js is a runtime environment for javascript, so you can write and run js locally. [Download and install it here](https://nodejs.org/en/download/).
To check that node is installed, you can use
``node -v``
In Windows check that in *Environment Variables, System Variables, Path* there is a path for C:\Users\yourusername\npm folder. If the folder does not exist, create it and set the path.
## Install Serialport
Node comes with a package controller called 'npm' - node package manager. You can use this to install dependencies for node programs.
Serialport is a package for node that allows it to interact with a hardware serial port.
Navigate to the directory where you'll be running from (atkapi). Do
``npm install serialport``
## Install WS (WebSocket)
WebSockets are very simple web connections. We use them to chat between the 'server' / heap (node) and the 'view' (your browser).
To install ws, do
``npm install ws``
We aim to take an event graph architecture down through multiple layers of computing, routing event propagation also through a message passing network between multiple cpus each operating modular hardware endpoints.
## Run DMC (yay!)
This project serves the developement environment / api we use to write and represent programs that are event graphs. [Install and Run.](https://gitlab.cba.mit.edu/jakeread/atkapi/blob/master/installing-node-sp-ws.md)
cd to the rndmc folder and run:
``node main``
It's handy to keep a terminal window open beside a browser when running the software - it's not perfect yet - I do this:

This way I can watch for errors, and restart it when it crashes. Hopefully not a lot of this will happen.
## Open a Browser
The program is now running a tiny HTTP server, where it will deliver an interface. It's set to show up at your local address on port 8080.
In a browser open *localhost:8080* you will see the mods and this msg in the terminal *SEND PROGRAMS TO UI*
## Using the Browser Interface


- those GIFs tho
- steppers gotta step
# Writing New Modules
- TODO: put example here, with comments
# Writing Hardware Modules
- TODO: same, also including links / explanation to atk
# A Note on the Architecture
- ARCH diagram, thinking, reps / vs heaps / ui interaction / the state getter-and-setters
# Development Notes
## For MW
## For MW
- walk program units and change
- walk program units and change
- hardware, and consolidate ?
- hardware, and consolidate ?
- add reset button to hardware
- add router for reset, test
- what program units do we want?
- what program units do we want?
- good templates for hw/software ... good documentation
- good templates for hw/software ... good documentation
...
@@ -113,6 +186,12 @@ To assemble a representation of these, we want to have a kind of 'netlist' that,
...
@@ -113,6 +186,12 @@ To assemble a representation of these, we want to have a kind of 'netlist' that,
# The RPI
# The RPI
One of the desires here is to run programs headlessly on small embedded computers like the Raspberry Pi. The router has pogo-pins for this, so that when it's mounted beneath a Raspberry Pi the USB and Power lines are automatically hooked up - the 2A Buck Converter on the Router can also be used to power the RPI, so it can all run on one DC power bus. Nice!
There's also something of an 'interface' to the software, and if you prefer to write a headless controller, or roll your own UI, etc, this is fair game. Please, break my software and use it in wierd ways.
The only code in ```main.js``` that we need to run headless is here:
```JavaScript
const Reps = require('./reps.js')
const Programs = require('./programs.js')
var program = Programs.new('new program')
```
We don't need the next lines (opening a View and starting an Http server). I.E. to add new modules and hook them up, try this:
```JavaScript
var stepper = Programs.loadModuleFromSource(program, './modules/hardware/atkstepper.js')
var jogControl = Programs.loadModuleFromSource(program, './modules/ui/arrows.js')