Commit f4b81b96 authored by Jake Read's avatar Jake Read
Browse files

update node notes

parent 19309b0e
......@@ -8,7 +8,10 @@ Typically, designing and engineering complex systems requires knowledge across t
## The Network
To make individual motors and sensors modular, AutomataKit endpoints use a port-forwarding, source-routed network. Packets typically originate on the network over a usb-to-serial bridge, so you can interface with networked endpoints using any piece of software you can successfully use to open a COM port with: JavaScript, Python etc. The [AutomataKit Router](https://gitlab.cba.mit.edu/jakeread/atkrouter) includes one UBS-to-UART Bridge, which is treated as the 6th port on the router.
To make individual motors and sensors modular, AutomataKit endpoints use a port-forwarding, source-routed network. This is *not a bus* and can be connected in a complete graph. All connections are full-duplex and include support for hardware clock synchronization.
Packets typically originate on the network over a usb-to-serial bridge, so you can interface with networked endpoints using any piece of software you can successfully use to open a COM port with: JavaScript, Python etc. The [AutomataKit Router](https://gitlab.cba.mit.edu/jakeread/atkrouter) includes one UBS-to-UART Bridge, which is treated as the 6th port on the router.
The hardware (or 'PHY' layer) of the network is simple UART. That means that all the network is, is a few UART links between microcontrollers, and some C code that listens for incoming packets and forward messages according to the instructions in the packet. Critically, there are not *addresses* in the network, instead, packets themseleves carry routes: this is 'source routing' in network nomenclature.
......
......@@ -124,12 +124,26 @@ function parseLineIn(data) {
case 'wait':
packet[u] = 132;
// a linked acceleration planned segment
// this one flagged as a wait period via the delimiter
// we'll be going betwee float-space for steps in the higher levels, so
var steps = parseInt(args[i + 1])
packet = packet.concat(pack32(steps))
var speed = parseInt(args[i + 2])
packet = packet.concat(pack32(speed))
i += 3
u += 9
// but accel and speeds need to be in floats
var entry = parseInt(args[i + 2])
packet = packet.concat(pack32(entry))
// pack 64 bit float to 32 bit?
var accel = parseInt(args[i + 3])
packet = packet.concat(pack32(accel))
var accelLength = parseInt(args[i + 4])
packet = packet.concat(pack32(accelLength))
var deccelLength = parseInt(args[i + 5])
packet = packet.concat(pack32(deccelLength))
i += 6
u += 21
break;
case 'speed':
......
# Installing Node.js, WebSocket and SerialPort
...
\ No newline at end of file
To interface over mods, or with atkterminal, 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/) - right now, I'm running v6.11.3, 8.11.3 should work as well.
To check that node is installed, you can use
``node -v``
## 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 (so, mods/ to run the *atkbridge* or automatakit/ for *atkterminal*). Do
``npm install serialport``
## Install WS (WebSocket)
WebSockets are very simple web connections. In the *atkbridge* we use one to move data between the browser and local hardware.
To install ws, do
``npm install ws``
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment