Wrapper for RealBasic - continued in ‘Other’ forum
Posted: 24 May 2008 02:04 PM   [ Ignore ]
New Member
Rank
Total Posts:  7
Joined  2008-05-24

Hi All,

First, let me say this is a great community! I’ve enjoyed playing with the demo’s using my MTMini.  But I want to go a step further.

I’m trying to write a touchlib wrapper for RealBasic.  (It basically is another C++ dll that forwards the events using the syntax of a RealBasic plugin).
The problem is when I try to use it, I get an error message: dcamera.dll and pgrflycapture.dll are not found.

I’m using a Microsoft Webcam (not a Dragonfly camera). The demos provided with touchlib work fine.  I first thought it was because the xml config files pointed to a different camera (one of the touchlib developers), but I can’t find anything specifieing a webcam.

Any idea what is happening here?

Another approach to RealBasic would be using UDP.  I do receive the messages in RealBasic (see attachment), but I do not know to interpret this.
I know there are ‘Alive’ messages and so (I read the doc on TUIO).  Is there anyone who knows how this format works? (I mean like, x = 2 bytes, y = next 2 bytes, etc)

Thanks in advance!

Alwaysbusy

Image Attachments
Image1.png
Profile
 
 
Posted: 24 May 2008 06:04 PM   [ Ignore ]   [ # 1 ]
Jr. Member
Avatar
RankRank
Total Posts:  101
Joined  2008-03-02

Tuio spec (from the docs):
-----------------------------
s sessionID, temporary object ID, int32
i classID, fiducial ID number, int32
x, y, z position, float32, range 0...1
a, b, c angle, float32, range 0..2PI
X, Y ,Z movement vector (motion speed & direction), float32
A, B, C rotation vector (rotation speed & direction), float32
m motion acceleration, float32
r rotation acceleration, float32
P free parameter, type defined by OSC packet header
----------------------------
2D Interactive Surface
/tuio/2Dobj set s i x y a X Y A m r
/tuio/2Dcur set s x y m r
----------------------------
Touchlib uses extended and different format than stated in doc:
/tuio/2Dcur set s x y X Y m width height
where width and height are float32
alive sends alive s i i i i (x number of blobs)
and fseq is just a number of current frame processed

Profile
 
 
Posted: 24 May 2008 07:02 PM   [ Ignore ]   [ # 2 ]
New Member
Rank
Total Posts:  7
Joined  2008-05-24

Thanks jet-plane!

//Touchlib uses extended and different format than stated in doc:
Figures! Thats why I got strange values.

Tomorrow I’m going to give it a try, because at the moment, I’m seeing black ‘blobs’ from staring at the screen all day smile

Cheers

Profile
 
 
Posted: 26 May 2008 09:25 AM   [ Ignore ]   [ # 3 ]
New Member
Rank
Total Posts:  7
Joined  2008-05-24

Hi,

I’m continuing with the TUIO approach as the RealBasic plugin is going to give to much problems.  I will write some easy to use classes instead.
However, I have a couple of questions.

1. Are the messages in Big Indian of Little Indian?

2. Why do I only receive /tuio/2Dcur messages and no /tuio/2DObj messages? Doesn’t touchlib broadcast them? I thought touchlib first sends a /tuio/2DObj with the initial position and then several /tuio/2Dcur messages to update the movement.  Or am I way off here?

3. Although I always press with my finger on the same place in the center, the x and y (the first to params) from the /tuio/2Dcur messages are completely different every time.  I know some variation can be in there, but the difference seems to much. The x pos for example ranges from 0,200 to 0,800, so they are not very helpful to determine the posx of posy.

4. Why are x and y sometimes above 1 (1.645 etc) in the /tuio/2Dcur messages?  I thought they should range between 0 and 1?

5. I’m using touchlib revision 393 speedfix (21 april 2008) I’ve downloaded from http://www.multigesture.net.  Is this the correct one?

I’ve read a lot off stuff about the subject over the weekend, but somehow I believe I’m missing some essential reading…

Thanks again for any help you can give me.

Cheers,

Alwaysbusy

Profile
 
 
Posted: 26 May 2008 12:23 PM   [ Ignore ]   [ # 4 ]
New Member
Rank
Total Posts:  87
Joined  2007-10-23

Answers to a couple of your questions:
1: No idea, sorry
2: Im pretty sure 2DObj messages are for fiducials (object recognition), and 2DCur are for normal blobs or fingers
3: Are you sure you’re reading the right parameters? What do you mean by the first two? The first two after the id?
4: Again, make sure you’re reading the correct parameters, they should range from 0 to 1.
5: It doesn’t really matter which version you use but I believe that one is one of the most recent

PS. not sure if you’ve seen this or if it is of any help but the infomration given to you previously is from the tuio spec http://opensoundcontrol.org/files/tuio_gw2005.pdf, except touchlib is slightly different as explained.

Also, I am working on a binary socket implementation for flash so we are working on the same kind of thing in a way, in terms of reading the binary messages from touchlib

Profile
 
 
Posted: 26 May 2008 01:18 PM   [ Ignore ]   [ # 5 ]
Jr. Member
Avatar
RankRank
Total Posts:  101
Joined  2008-03-02

about the Endianness, It’s well documented under the osc spec http://opensoundcontrol.org/spec-1_0
2dobj can be sent with touchlib when encountering square (it’s initial fiducial support), as far I know it’s reading how many
squares are in the square (but that’s just something I’v heard .. It’s way off being verified)
The digit’s you receive depends on your configuration of touchlib, so if it isn’t configured then who knows what nums you getting smile
and I’m almost done with implementing the tuio proxy myself .. having troubles with dynamic arrays and struct over tcp :p

Profile
 
 
Posted: 27 May 2008 04:26 AM   [ Ignore ]   [ # 6 ]
New Member
Rank
Total Posts:  7
Joined  2008-05-24

You guys seem to be right!

Stupid me…

I had a look to the very start of my project and I was off with 1 byte.  I did some tests with the indeanness and it seems I have to reverse the 4 bytes.  Now my numbers seem right (the middle is around 0.5 for both the x and de y)

jet-plane, what do you mean with configuring touchlib? I can run configapp, but that’s about it.  When I run OSC.EXE localhost 3333 the messages start comming in in Realbasic. And that’s where I come in grin

weyforth, you were right, I didn’t read the correct params. As soon as I get a framework I put it up here and I try to document it as much as possible. 

About the params DeltaX and DeltaY (params 4 and 5). It doesn’t seem like touchlib uses de default X Y Z (motion, speed, direction), so I assume X and Y are DeltaX and DeltaY who are relative to the previous position.  I would think: newx = oldx + deltaX and newy = oldy + deltaY.  But why do we need these? We always get the new values for x and y in every 2Dcur line.

Damned, I must sound like a kid who gets his first lessons in math… Let’s say it’s fatigue grin

Thanks for the help and good luck to both of you with the projects!

Alwaysbusy

Profile
 
 
Posted: 27 May 2008 02:21 PM   [ Ignore ]   [ # 7 ]
New Member
Rank
Total Posts:  7
Joined  2008-05-24

Got it working!

I’ve attached a little RealBasic demo (source is included). It’s dirty programming and I’m going to rewrite it all into a nice framework later, but I wanted to share this immediately.

To run the demo:
1) copy the exe into the folder where all the dll’s are
3) run osx.exe localhost 3333
4) start the exe

It’s very simple, just tracking your fingers.

PS: I’m going to move this topic to Other… as this has very little to do with C++ anymore. I’m going to continue there.

Thanks for all the help!

Cheers,

Alwaysbusy

File Attachments
RBTouch.rar  (File Size: 702KB - Downloads: 123)
Profile
 
 
Posted: 31 May 2008 03:57 AM   [ Ignore ]   [ # 8 ]
Sr. Member
Avatar
RankRankRank
Total Posts:  265
Joined  2007-09-22

Great job , it works like a charm and is really responsive.The second i touch the surface i get the blob.Great job again.
And I hope we can see some software made with this in the future.

Profile
 
 
Posted: 01 June 2008 11:43 PM   [ Ignore ]   [ # 9 ]
New Member
Rank
Total Posts:  7
Joined  2008-05-24

Thanks for the feedback! Yes, RealBasic is surprisingly fast, but I’m now looking into OpenGL so I can make some nice graphics. More to follow…

Cheers,

Alwaysbusy

Profile