Todo
- editing
- subgraph select drag cut copy paste
- nested module graphs
- ui
- browser pan zoom
- collapse nodes
- refactor for skinning
- processes
- STL slicer
- three-axis rough and finish cuts
- Cross-Origin Resource Sharing (CORS)
- formats
- HPGL input
- SVG export
- ...
298
To install and run mods locally
You need to first install node.js.
Install the http-server npm package. Including '-g' sets the installs the package gloabally, allowing you to use it as a command line tool:
npm install http-server -g
Clone the mods repository:
git clone ssh://git@gitlab.cba.mit.edu:846/pub/mods.git
Use the command line to navigate to the root of the mods repository:
cd mods
Also - switch to the 'jake' branch (this one) - use git checkout jake
Now, start up a server:
http-server
Open a browser tab and go to 127.0.0.1:8080
which is the same as http://localhost:8080
to view the server that you just started.
Running Mods and Local AutomatKit Hardware
AutomataKit is a set of hardware for machine control that can be controlled from Mods. This allows us to run machine control and path planning in the same window.
To interface between these systems, we need to establish a link between Mods (runinng in the browser) and a serial port on the machine which is attached to your computer.
Local Node.js Programs and Dependencies
First, we need two more node.js packages: serialport and ws (websocket). Navigate to the mods directory and use
npm install serialport
and then npm install ws
Now, to open this link, we use the mod called 'ATKBridge' and a small node.js program, under js/atkbridge.js
To run this service, navigate via cd js
to the js directory, and run node atkbridge ::ffff:127.0.0.1 6789 <portname>
The <portname>
argument should be whatever name your atkrouter shows up on, you can use serialport-list
to find it, it'll be the COM port or /dev/ttyX that includes the manufacturer name 'Silicon Labs'
Mods Hardware Modules
The idea here is that each piece of AutomataKit hardware has a mirrored Mods software object.
The centerpiece is the ATKBridge mod, which allows us to pass network packets originating in mods into their hardware counterpoints.
Stepper Modules receive motion-planned commands, and use those to write packets of motion to individual stepper motors.
The Motion Planner Module receives high level motion commands (as javascript objects), adds them to a queue of motion, and plans for smooth acceleration between them. It then delivers those blocks of motion to stepper motors.
A Demo Program
To run some gcode through your machine, you can open the mods program under the main mods/ directory, called 'tinymachine-planning' - to do this, right click in mods and go to programs > open local program
You'll need to configure the machine, inputting into each stepper module which axis of motion it should pick out (i.e. X is typically the '0th' index, Y typically the '1st' etc) and connect them to the right network route in the network bridge.
To read more about how networking works with AutomataKit, read up here!
Mods Connection Debugging
set correct serial port permission (do this each time you reboot the machine): chmod a+rwx /dev/ttyUSB0
start serialserver in the terminal so you can see the logs as it tries to connect. navigate to the mods/js folder in the terminal (probably use cd ~/mods/js
) and type: node serialserver.js ::ffff:127.0.0.1 1234
check serialserver is running with: ps aux | grep node
Common Issues
- Help! My SRM-20 will only run a single job and then go dead! Chances are you are using printserver.js instead of deviceserver.js to connect to the machine. For now, we need to treat the SRM-20 as a device instead of a printer.
-
Argg... why do I need to reset permissions on /dev/usb/lp0 every restart? You can use
sudo add_user username lp
andsudo add_user username lpadmin
to make persistent permissions. - Why is my web socket connection refused when the addresses are the same? This can happen due to a difference between IPV4 and IPV6 addresses. In your start mods server script, try changing 127.0.0.1 to ::ffff:127.0.0.1 and see if it helps.