Status Version 1 Complete
The program relies on four separate Python scripts running in parallel communicating over python.multiprocessing
sockets. Four separate Python instances are neccesary to get around the global interpreter lock.
- program_main.py
- The main backbone of the program. Holds the various visualization tools. Takes in data from main_data_streamer.py via a socket, saves data, and routes the data into the various visualization tools.
- Stores program state, and conditionally calls the tools.
- Takes data via the remote socket, and sets the program state, saves data, and quits the program when needed.
- admin_control.py
- GuiZero/ TKinter remote that sets the program state, as well as can transmit other signals such as
save
orquit.
The remote should be used to quit the program, as it does safely. - Transmits the signals via a socket back to program_main
- GuiZero/ TKinter remote that sets the program state, as well as can transmit other signals such as
- main_data_streamer.py
- Runs at precisely a given rate, normally 1 KHz.
- plotter.py
- Runs at a variable FPS, usually around 25 FPS. Plots data in real time
- Clone or download the GitHub repo.
- Configure the Anaconda environment (see 'Environment' below)
- Initialize the bash script
fullRunner.sh
by enteringchmod +X ./fullrunner.sh
into your Bash environment - If using Arduino, plug Arduino into computer, and change the USB port in main_data_streamer.py into the correct port for your device.
- Install Firmata on Arduino. I like using the full version of it (requires the Arduino application to install onto the Arduino). Detailed Guide
- You now should be setup to run!
./fullRunner.sh
to begin the program.
- Shell script
fullRunner.sh
runs all four scripts. - Manually run all four scripts simultaneously, using the correct environment. Using four separate tabs works, as does running four separate Python environments.
Data input is generated by main_data_streamer.py. Currently, program supports input from either an Arduino or generated based on arbitrary trig functions. To choose the type of input, edit the main_data_streamer file. To alter the functions, alter the data_streamer.py file.
Current setup is with two 10K potentiometers representing the two torque inputs. data_streamer.py is configured to connect the left pot to pin A1, and the right pot to A2. Arduino is running firmata, and communicating via Firmata/PyFirmata serial with Python.
The game is being developed on macOS Mojave 10.14.6, during which there are a number of issues with Python video drivers and TKinter. I'm not sure how this will work on other operating systems, but a Conda environment with python 3.6.3
that works for the game can be found in environment.yml
. Simply create a Conda environment called torqueenv
from that file, and it should work. Conda guide.
If a wrong combination of Python version + TKinter + OS is used, the computer may crash.
While the data saving at 1KhZ is consistent +- 1 sample/second, the fps in the visual displays is not consistent, and the locked fps stated in each of the objects should not be relied on. Data can be stored and generated at a higher fps, if desired, but it varies based on system power. It has run at 2500 KhZ +- 3 samples/ second, but beyond that I found it to be susceptible to large drops in data save.
- Finish a prototype of the game
- Get data saving to run stabily at 1KHZ.
- Finish pymunk physics in main_game
- Create bash script to run all of the scripts
- Finish prototype of main_game
- Finish calibration system + implementation into the program controller
- Add start button/ system for automation
- Add automated system for MVT Viewer
- Add audio cues for MVT
-
Add audio cues for main_game -
Add automated system for main_game - Add schematic of Arduino layout to folder
- Create prototype constant error match test system
- Prototype stage 4
- Add GUI system for manually setting MVT percentage in constant_error_tests
- Add MVT Ring
- Add inner and outer rings for baseline error test
- Update audio cues across the board