diff --git a/README.md b/README.md index bff8cb389552282bc9562396390617dc54313704..9f66d52c835187e6d5d33786632913f390dc54d6 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,95 @@ -# Automatakit API +# RNDMC -aka project 'consistent-sandbox' +**Reconfigurable Numeric Dataflow Machine Controller** + +*aka project 'consistent-sandbox'*   -[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 - walk program units and change - hardware, and consolidate ? + - add reset button to hardware + - add router for reset, test - what program units do we want? - 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, # 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! + + + +However: + ``` need to figure out how to get the RPI serialport to talk ``` - https://cnc.js.org/ diff --git a/doc/images/termopen.png b/doc/images/termopen.png new file mode 100644 index 0000000000000000000000000000000000000000..f964ee6cd0f84728f2222dcbe1ec4424d437bfe8 Binary files /dev/null and b/doc/images/termopen.png differ diff --git a/doc/incoming.md b/doc/incoming.md new file mode 100644 index 0000000000000000000000000000000000000000..8ea2dc210ab5d80a200ba92112ffe609374b9552 --- /dev/null +++ b/doc/incoming.md @@ -0,0 +1,20 @@ + +## Writing Javascript Programs + +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') +``` \ No newline at end of file diff --git a/main.js b/main.js index dff205bfa10dd43afa6a1753184a474403c30503..40cf93b2fd7cc854eb49a3658512ef7097725382 100644 --- a/main.js +++ b/main.js @@ -36,3 +36,4 @@ View.startWs() Programs.assignSocket(View.uiSocket) View.assignProgram(program) +