Giter Club home page Giter Club logo

io-touchpad's Introduction

io-touchpad

Build Status Code Health Code Issues codecov

Application

Installation

apt-get update
apt-get install build-essential libatlas-dev libatlas3gf-base
apt-get install python3-dev python3-setuptools python3-numpy python3-scipy python3-pip
pip3 install scikit-learn
make

Quick start

  1. Go to the app directory.

     cd app
    
  2. Undertake a learning session with a trainig size of 5 for a symbol named your-secret-symbol which will create a yss.txt file in the /tmp directory.:

     sudo ./app.py add 5 your-secret-symbol touch /tmp/yss.txt
    
  3. Use the app. (Hopefully, it will recognise your symbol.)

     sudo ./app run user
    

Run ./app --help if you want to learn other features of this app.

Tests

Installation

apt-get update
apt-get install python3-pytest

Usage

cd app/test
py.test-3

Tools

matrixanalyser.py

Installation

apt-get install python3-matplotlib
cd app/tools
make

Usage

cd app
sudo ./tools/matrixanalyser.py [--help] [--tolerance TOLERANCE] [--show]

More information on the usage is avaialabe if you run ./tools/matrixanalyser.py --help.

All generated figures of the drawn symbols are stored inside the app/tools/data/matrixanalyser/figures directory.

io-touchpad's People

Contributors

0mp avatar emilhotkowski avatar michal7352 avatar piotrpiekos avatar rjiukyagami avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

io-touchpad's Issues

Performance

At the moment our app is killing the CPU performance. On my older laptop it happens to take 100% of the CPU when working. It might be due to the while loops. We should investigate and find out how to lower the CPU usage.

Finish program on any sys.exit()

At the moment sys.exit() functions don't exit the program when called - instead, they only kill the thread they were called in.

Although we might consider moving TouchpadSignal.initialize() up before any threading happens it does not solve the problem of the sys.exit() within the TouchpadSignal.fetch_touchpad_event().

Average pressure

If we want to use the pressure parameter from the touchpadlib we have to find out what it means really.

For example, the pressure parameter in the Hasee Q540S touchpad takes on values from range [0;255]. If I press the touchpad really hard it only takes on values like 70 however.

This is why we have to remember about it.

Create a Makefile for touchpadlib

It should look like this more or less:

gcc -c -fPIC touchpadlib.c -o touchpadlib.o
gcc -shared -Wl,-soname,touchpadlib.so -o touchpadlib.so  touchpadlib.o

Bug in app/classifier/classifier.py (ValueError: Buffer dtype mismatch, expected 'ITYPE_t' but got 'long long')

I got an error like this:

Available devices:
/dev/input/event0:    AT Translated Set 2 keyboard
/dev/input/event1:    SynPS/2 Synaptics TouchPad
/dev/input/event2:    Video Bus
/dev/input/event3:    Power Button
/dev/input/event4:    Sleep Button
/dev/input/event5:    Lid Switch
/dev/input/event6:    Power Button
/dev/input/event7:    PC Speaker
/dev/input/event8:    HDA Digital PCBeep
/dev/input/event9:    HDA SIS966 Mic
/dev/input/event10:    HDA SIS966 Headphone
Select the device event number [0-10]: 1
Touchpad specification: min/max x: 1472/5472, min/max y: 1408/4448, min/max pressure 0/255.
Use your touchpad as usual. Have a nice day!
Traceback (most recent call last):
  File "./app.py", line 68, in <module>
    main()
  File "./app.py", line 66, in main
    application.application_thread(thread_queue, learning_mode, training_size)
  File "/home/matangi/Documents/io-touchpad/app/threads/application.py", line 30, in application_thread
    clsf = classifier.Classifier()
  File "/home/matangi/Documents/io-touchpad/app/classifier/classifier.py", line 19, in __init__
    self.learning_model = pickle.load(file_with_model)
  File "sklearn/neighbors/binary_tree.pxi", line 1129, in sklearn.neighbors.ball_tree.BinaryTree.__setstate__ (sklearn/neighbors/ball_tree.c:9307)
  File "sklearn/neighbors/binary_tree.pxi", line 228, in sklearn.neighbors.ball_tree.get_memview_ITYPE_1D (sklearn/neighbors/ball_tree.c:2867)
ValueError: Buffer dtype mismatch, expected 'ITYPE_t' but got 'long long'

It seems like @michal7352 saved some classifier data in some sort of a binary format which is not compatible with 32-bit systems.

Relates #58

Clean up touchpadlib.c

There is a lot of code that could be removed.

Just be careful when you remove those defines!

Improve the learning mode user experience

Learning mode would run without pre-set size of traning. Applcation would do learning and stop, on some event and confirmation that user want to end the learning.

File format change

Instead of storing symbols in two files, we could do one file and use 'pickle' library to save list of list of signals.

Bugs in Makefile

mkdir: cannot create directory 'obj': File exists
Makefile:15: recipe for target 'obj/touchpadlib.o' failed
make: [obj/touchpadlib.o] Error 1 (ignored)
gcc -c -fPIC -o obj/touchpadlib.o src/touchpadlib.c
mkdir: cannot create directory 'lib': File exists
Makefile:11: recipe for target 'lib/touchpadlib.so' failed
make: [lib/touchpadlib.so] Error 1 (ignored)
gcc -shared -Wl,-soname,touchpadlib.so -o lib/touchpadlib.so obj/touchpadlib.o

Detecting end of the signal group

We detect end of the group when:

  • time between last two signals is longer than some constant
  • waiting for new signal persists
  • process signal of pressure with value lower than 1

Normalization of symbol (2)

Measuring the similarity between symbols should be independent from location, and scale of the whole figure, so we need to normalize the drawn symbol. It could mean for example, that point coordinates will be translated, so that, their centroid is the origin of the coordinate system, and the diagonal of the "bounding box" has some constant length (or the average distance from centroid to symbol point is some constant).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.