richardzone / eye-tracker-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Eye Tracker App

Python Version Badge Build Test Upload Status Badge Code Coverage Badge

This companion app will listen for commands input from eye tracker hardware via serial port and execute its commands accordingly.

Currently there are 3 types of commands:

  1. A pair of coordinates between (0,0) and (SCREEN_WIDTH, SCREEN_HEIGHT) - move the mouse cursor to the specified coordinates
  2. calibration_required - show a red calibration square on center of screen
  3. calibration_done - hide the calibration square if present

Note that all commands MUST ends with \n to be valid.

This app is designed for demo purpose on Windows platform. It should run on MacOS and Linux as well but untested.

Simulated Run Instructions for Windows

To simulate coordinates data from COM port on a Windows desktop, follow these steps:

  1. Download from https://freevirtualserialports.com/ and install virtual serial port device.

  2. Run the above application, create a Local Bridge with default options (first port name is COM1 and second port name is COM2)

  3. Download Coordinates_Serial_Generator and run it. You should see log output like below:

    Sent to COM2: calibration_done
    
    Now sleeping for 1.31 seconds
    
    Sent to COM2: (1522, 226)
    
    Now sleeping for 0.53 seconds
    
    Sent to COM2: calibration_done
    
    Now sleeping for 1.73 seconds
    
    Sent to COM2: calibration_required
    
    Now sleeping for 0.91 seconds
    
  4. Finally download this app (Eye Tracker App) and run it. Select Serial Port COM1 and click Connect to Serial (Hit Esc to Disconnect). You should see the mouse cursor moving around, triggered by data sent via serial port from the Coordinates_Serial_Generator. Note that on Linux you may need to run xhost + before running this app to give permission to Window system.

Local dev environment setup

Note that Python version should >= 3.8

sudo apt-get update # On debian-based linux
sudo apt-get install -y scrot python3-tk python3-dev binutils python3 python3-pip python3-venv # On debian-based linux
rm -rf venv # Change this to "del venv" on Windows
python3 -m venv venv
source ./venv/bin/activate   # Change this command to "source ./venv/Scripts/activate" on Windows
python3 -m pip install -e .
python3 -m pip install -e .[development]
xhost + # This may be needed on Linux to get permission to connect to Window system
python3 run.py # to run app
pytest # to run tests
pyinstaller -y --windowed --add-data translations:translations run.py # to create app release in dist folder

About


Languages

Language:Python 100.0%