vialab / SMT

Simple Multi-Touch (SMT) Toolkit
http://vialab.science.uoit.ca/smt
GNU General Public License v3.0
43 stars 18 forks source link

WM_TOUCH does not recognize some touch events #170

Closed maujabur closed 10 years ago

maujabur commented 10 years ago

When using WM_TOUCH - on windows 7 x64 - SMT won't recognize a touch unless the finger is moved or in the case of a double click

my hardware is a DELL multi touch monitor P2314T

edit: using processing 2.1

kiwistrongis commented 10 years ago

Hi, I'll look into this, thanks :) Might even resolve it today.

kiwistrongis commented 10 years ago

Hi, couldn't reproduce this, sorry. Could you maybe clarify a bit?

maujabur commented 10 years ago

Hi! If I open any touch (up/down) or button example, it works fine with the mouse, but it fails to recognize the touch when I just touch my screen (of course it's touch enabled). I have to "double click" or to slide my finger in order for the button or touch event to get generated. I'll try to reproduce on antoher hardware. Thanks for your fast response!

maujabur commented 10 years ago

Hello again! I tried two more hardwares and different OS, running the TouchObject demo, latest versions of processing and library:

My theory: It's windows 7 fault, I tried two different screens and two different computers using win 7 and the problem was present, but on win 8 it runs OK.

Please let me know if I can send any info that can help. And thanks again for your prompt response.

kiwistrongis commented 10 years ago

Well this is a little confusing, cause the guy from issue #169 has the opposite problem. It's working on windows 7 for him, but not 8. Personally I've got it working fine on windows 7 on two different touch screens (one of which is also a pqlabs frame, for which both tuio support and windows native touch work). Do you have the most recent drivers and stuff from pqlabs? For the pqlabs frame, if you can enable TUIO support, SMT should work fine, but make sure not to use TouchSource.WM_TOUCH.

Could you try this processing program, and give me the console output?

maujabur commented 10 years ago

Hi!

it really works fine with TUIO, but I won't have TUIO for the dell touch screen.

I'm not telling it does not work at all on windows 7, I'm just saying that buttons and first touches doesn't work. I have the impression that issue #169 is about init(), so they really are two different problems.

If you want I can check the drivers I'm using, but I'm pretty sure that updating them was the first thing I did. The second was trying to find someone with the same problem. I didn't find, that's why I created this issue.

What troubles me is that I have two different computers with windows 7 (one running in Portuguese and another one in English) and different types of touch screen and in both I get the same error, that's why I ruled out a driver problem.

The output of the sketch from my PC with the pqlabs is the following (I disabled the TUIO in order to reproduce the error) ID: 0 Source: WM_TOUCH ID: 0 Source: WM_TOUCH ID: 0 Source: WM_TOUCH ID: 1 Source: WM_TOUCH <- two fingers at the same time ID: 0 Source: WM_TOUCH ID: 1 Source: WM_TOUCH ID: 0 Source: WM_TOUCH

Please don't get me wrong, I know that the library is distributed for free and I don't mean to request anything that troubles you. In fact, I'm impressed for the fast response!

And if I can help with my time and intermediate programming knowledge, or even with donations, please count on me. If you point me in the direction of the file that deals with the WM_TOUCH inputs, maybe I can check it myself.

Thanks a lot and please let me know how to help you!

kiwistrongis commented 10 years ago

So I have a feeling that your expected behavior for the buttons might be different from the actual behavior. The current behavior is that buttons are counted as 'pressed' when you release the touch while over the button.

Try this version of the previous sketch. The console output will show all the touches and how they're tracked.

kiwistrongis commented 10 years ago

Oh, also, thanks for the compliments :). I like to keep the issue tracker "clean", so to speak, so I try to take care of the small things as quick as possible. I don't think I can nor would accept donations - I get paid to work on this, aha. The code that sets up the windows touch adapter is here: SMT.java runWinTouchTuioServer. I didn't write that, so don't blame me for the smelly code XD.

maujabur commented 10 years ago

Hi! I'll run the code as soon as I'm back at the office, but I'm pretty sure that unless I move my finger, it won't recognize touch down. I touch and release zones or buttons and they don't get recognized.

I'll take a look at the code as well.

Thanks

maujabur commented 10 years ago

Hello again!

I'm still strugling with this issue. I took a look at the code, reinstalled everything (processing, library, drivers) and the problem with the touch events remain. I guess now that it must be something related to touch2tuio.exe. And I have a doubt: where this program (touch2tuio) stays at the library folders? apparently it gets downloaded when I run the examples. Is that right?

Thanks

MJ.

maujabur commented 10 years ago

I've been poking around. I'm pretty shure Touch2Tuio is making it's job now. This is the result of a tuio dump (with comments):

TUIO/UDP messages to 127.0.0.1@3333
add cursor 0 (0) 0.118374996 0.123648144
remove cursor 0 (0) <-------------------------------- just touching and releasing recognized!
add cursor 0 (1) 0.12636979 0.13308333
remove cursor 0 (1) <-------------------------------- just touching and releasing recognized!
add cursor 0 (2) 0.13244271 0.08925926
update cursor 0 (2) 0.12905729 0.10699074 1.1282357 70.514725 <-------- moving finger
update cursor 0 (2) 0.12954687 0.10922222 0.15230356 -65.06214
update cursor 0 (2) 0.13183333 0.11443518 0.3557721 12.7167845
update cursor 0 (2) 0.13320833 0.11641666 0.02593362 -3.5466504
remove cursor 0 (2)

The first two touches are the ones that I have trouble with SMT.

In order to continue investigating whats going on, I tried the following code in processing:

int before = 0;
int now;
Touch[] touchSet;

import vialab.SMT.*;
void setup() {
  size(600, 600, P3D);
  SMT.init(this, TouchSource.MULTIPLE);
  SMT.add(new Zone("Custom", 0, 0, 100, 100));
}
void draw() {
  background(79, 129, 189);

  touchSet = SMT.getTouches( );

  now = touchSet.length;
  if (before !=now) { 
    for (int i=0; i<touchSet.length;i++) {
      println ("touch detected: "
      +touchSet[i].sessionID +", "
      + touchSet[i].getTouchSource( )  
      +", ("+ touchSet[i].getX() +", "+ touchSet[i].getY() +")");
    }
  }
  before = now;
}
void drawCustom(Zone z) {
  fill(255);
  rect(0, 0, 200, 200);
}
void touchDownCustom(Zone z, Touch t) {
  println("Touch #"+t.sessionID+" went down");
}
void touchUpCustom(Zone z, Touch t) {
  println("Touch #"+t.sessionID+" went up");
}

and it gave me the following output:

Touch #939000522306748416 went down
touch detected: 939000522306748416, MOUSE, (50.0, 48.0) <------- mouse inside the zone
Touch #939000522306748416 went up 
touch detected: 939000522306748417, MOUSE, (457.0, 187.0) <-------- mouse outside the zone
touch detected: 939000522306748418, MOUSE, (457.0, 187.0) <-------- mouse outside the zone
touch detected: 939000522306748419, MOUSE, (405.0, 193.0) <-------- mouse outside the zone
Touch #938437572353327105 went down
touch detected: 938437572353327105, WM_TOUCH, (27.0, 43.0)<-------- sliding finger inside zone
Touch #938437572353327105 went up
Touch #938437572353327106 went down
touch detected: 938437572353327106, WM_TOUCH, (28.0, 57.0)<-------- sliding finger inside zone
Touch #938437572353327106 went up
Touch #938437572353327107 went down
touch detected: 938437572353327107, WM_TOUCH, (35.0, 70.0)<-------- sliding finger inside zone
Touch #938437572353327107 went up

// the touches ending in 108 and 109 were completely missed!

touch detected: 938437572353327110, WM_TOUCH, (111.0, 127.0)<-------- sliding finger outside zone
touch detected: 938437572353327112, WM_TOUCH, (120.0, 147.0)<-------- sliding finger ouside zone

I took a look at the source of the library and couldn't find the error. this is very weird. Now I want to alter and build the library files myself - in order to put debug messages inside it - but I don't know howto build it. What do I have to install? eclipse? Please help me to take this step.

Thanks

MJ.

maujabur commented 10 years ago

Well, weekends!

I found some answers to my questions, but not the solution for the issue yet...

  1. touch2tuio is packed inside the jar file for the library
  2. I was able to export the library using eclipse. I had to import from the git and put some files inside the SMT/lib folder.

Now I'm going to try to figure out what's happening...

Thanks @KiwiStrongis for pointing me the direction

maujabur commented 10 years ago

Hi! I finally think the problem is solved. I'm still going to make a few tests, but first impression is that it now works!

The .JAR fir the library included a version of Touch2Tuio (and his companion touchHook) that is not working for me. In my tests with a tuio dump program I was using a version downloaded from here: http://dm.tzi.de/touch2tuio/ and it sent all the events OK.

I put a lot of attention on the library code in order to understand whats was going on, but then I finally took a look at the resources folder and saw that the file size for Touch2Tuio was different from the one I used in tests, so I replaced it with the one from the link.

Now it seems to work. If that's it, them the library code is OK as it is, I just have to repack the JAR with the Touch2Tuio that works for me.

But now I have to ask where does your version of Touch2Tuio comes from? I couldn't find another download that matched yours (by file size) @KiwiStrongis

ZachCook commented 10 years ago

Touch2Tuio shipped with SMT comes from here: https://github.com/vialab/Touch2Tuio

I changed it from the original to support Windows 8, clearly I introduced some bugs in doing so.

maujabur commented 10 years ago

@ZachCook thanks! I didn't look at the code, but it seems to me that it won't output the first touch untill it has more info to send. Maybe a buffer?

I'll use it on Windows 7, so I will maybe just use the original version, but now i'm curious!

Thanks again!

maujabur commented 10 years ago

@ZachCook , the original version of touch2tuio really has a lag that I don't like at the touch up event.

I understand what you had to do with your code. I'll try to take a look at it.

Can you help me with some tips about the toolchain you used? (So i can reproduce it here)

Regards

MJ.

kiwistrongis commented 10 years ago

Wow this is a lot to read, aha. I still don't have a windows 8 test environment set up, but I am working on it.

You don't necessarily need to use our conversion program. Anything that creates tuio messages will work with smt. You could try manually launching our touch2tuio executible, so that you can see the debug output.

maujabur commented 10 years ago

@KiwiStrongis I don't quite follow you.

I'm talking about problems on Windows 7. For me windows 8 seems to be working fine.

Now I would like to debug what's going on the revised version of Touch2Tuio. Can you tell me, please, what I need in order to compile it on my computer? It seems to me that it's some version of VC++

Thanks again (but please pay attention, we're talking about windows 7)

MJ.

kiwistrongis commented 10 years ago

Oh, and right now i'm developing in linux, building with just make. You should be able to compile with eclipse on windows. You need android.jar, jbox2d.jar, libTUIO.jar, and all of processing's jars. I'm pretty sure when building eclipse, you can have them anywhere, but for using the makefile, they need to be in the lib folder. Personally, I keep all the processing jars in lib/processing.

Processing's jars

core.jar
gluegen-rt.jar
gluegen-rt-natives-linux-amd64.jar
gluegen-rt-natives-linux-armv6hf.jar
gluegen-rt-natives-linux-i586.jar
gluegen-rt-natives-macosx-universal.jar
gluegen-rt-natives-windows-amd64.jar
gluegen-rt-natives-windows-i586.jar
jogl-all.jar
jogl-all-natives-linux-amd64.jar
jogl-all-natives-linux-armv6hf.jar
jogl-all-natives-linux-i586.jar
jogl-all-natives-macosx-universal.jar
jogl-all-natives-windows-amd64.jar
jogl-all-natives-windows-i586.jar
maujabur commented 10 years ago

@KiwiStrongis

Thanks! I guess you didn't have time to read all the messages yet.

The good news is that the java code is fine! the bad news is that the problem is with touch2tuio.

Maybe it's best if I open an issue on the other repository in order to keep things where they belong.

Anyway, thanks again for your prompt responses!

kiwistrongis commented 10 years ago

Alrighty. Your welcome :). I'll see how well I can help you on the other repository.