wxGestalt
wxGestalt is a very, very simple IDE for controlling Gestalt nodes in Python. The IDE lets you (more easily) configure the machine, connect to it, and create a GUI for controlling it. It is very, very experimental, so if you experiment with it, please share your impressions as Issues on its GitHub repository.
In order to develop it, I studied a bit the Gestalt library, so I extracted its basic documentation with Sphinx; it is available here if you want to know how it works. The library is very powerful, but it seems that for what we need to do in the Fab Academy this example has everything.
Please note #01:
With Gestalt nodes you can create endless configurations, so the IDE will just make it easier for you to create your own script that controls the machine. It is impossible to create a "universal" app for the Gestalt... or it would take too much time at the moment. Furthermore, it should be part of your exercise to write code for it! :)
Please note #02:
The code that you have to write in the IDE is Python + wxPython. You just have to write a wx.Panel object, see the template for an example.
Please note #03:
Currently wxGestalt lets you add only 4 nodes. This can be easily modified in the GUI code of wxGestalt. If you need more nodes, let me know and I'll fix it.
01. Install wxGestalt
Most likely wxGestalt won't have any packaged installer for a while. For the moment, you should jump in its development directly! wxGestalt uses at the moment Ilan Moyer's Gestalt, installed as a Git submodule. So, you will have to install it in this way:
- git clone https://github.com/openp2pdesign/wxGestalt.git
- cd wxGestalt
- git submodule update --init gestalt
Git will then dowload the Gestalt library inside the wxGestalt folder. You then have to install the dependencies for wxGestalt:
- wxPython: check for your OS
- pip install PySerial
- pip install unidecode
- pip install jsonpickle
01 How it works
There are many tabs in wxGestalt, they are supposed to be used according to the number, so let's start with the first tab. It is needed in order to configure the machine. At the moment it is very simple, but there are more settings under development:
In the second tab you can identify the nodes, as you would do in any of examples. It basically redirects the terminal to the screen. Click on the "Initialize the machine" button to launch the identification.
The third tab is the IDE: you can write the Python code that will control the machine. The IDE loads by default a template (see below), but you can open any Python file and save your script as a Python file. When you save the machine (File > Save the machine) the code will be embedded in the machine file, so you can reload in the future. The machine file is a JSON file, so if you want to edit your Python file in another IDE, you'd probably want to save the script as an external file and then load it. When you click on the "Launch the script", a new tab will be opened. That tab will be generated from your code!
02 Template
wxGestalt provides you a template file (in Python) for developing a wxPython panel that will control the machine. The file can be accessed here or here.
03 moves
The moves data to be sent to machine is just a Python list, where each element is another list. The number of the elements inside this second list is determined by the number of nodes. See for example:
- 1 node: moves = [[10],[20],[10],[0]]
- 2 nodes: moves = [[10,10],[20,20],[10,10],[0,0]]
- 3 nodes: moves = [[10,10,10],[20,20,20],[10,10,10],[0,0,0]]
- 4 nodes: moves = [[10,10,10,10],[20,20,20,20],[10,10,10,10],[0,0,0,0]]
04 Repository
Clone, forks, pull requests, issues on https://github.com/openp2pdesign/wxGestalt
Original tutorial by:
- Massimo Menichinelli - info at openp2pdesign.org - massimo.menichinelli at aalto.fi
- Remixed to markdown by Eduardo Chamorro, Fab Lab Seoul 01.2017
This work is licensed under a Creative Commons Attribution 4.0 International License.