blankname
Posts: 4
Joined: Thu Nov 13, 2014 11:15 am

Advice on GUI framework for a touch foosball scorer

Thu Dec 15, 2016 11:08 am

Hello,

At my work, we have a foosball table with a touchscreen to keep track of all scores. Currently we have a Raspberry Pi 2 with an interface written in PyGTK (Glade), but it is quite slow switching between different screens, since all the elements are draw with PNG images. Over the time we added goal sensors, ball speed sensors and even goal replays using the Raspberry Pi camera.

Image

We are planning to rewrite the Raspberry Pi application to address the slow behaviour and make it more stable and modular, but I'm not sure which framework would be more appropriate. We need to have touch support (actually, is just mouse support), and drag and drop would be great (drag an image from its place and drop it on some boxes).
I've checked PyGame and Pi3d to render 2D interfaces (they should have better performance than PyGTK, but don't know how good is the mouse support for a touch application),

We have a video of the current system here if you'd like to check, but am afraid that is in Spanish.
Thanks in advance!

Jose

User avatar
paddyg
Posts: 2529
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Advice on GUI framework for a touch foosball scorer

Fri Dec 16, 2016 9:20 pm

Jose, have you looked at Stefan Wehner's application https://github.com/swehner/foos I don't know if he uses a touch screen but it should be feasible. The event system on pi3d (written by Richard Urwin) is complicated but flexibly and seems to be able to cope with pretty much any type of input on the Raspberry Pi.

PS what do you use for speed sensors?
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

blankname
Posts: 4
Joined: Thu Nov 13, 2014 11:15 am

Re: Advice on GUI framework for a touch foosball scorer

Mon Dec 19, 2016 2:11 pm

Thanks for the answer!

I found Stefan Wehner's scorer some months ago, it has a good and minimalistic UI and it has a well-thought software architecture. In fact, our goal replay is inspired on its implementation, but we used the Picamera python module instead.
However, if I recall it well, they use hardware pushbuttons and/or a traditional keyboard, but I was unable to find how easy to use is the mouse (or single point touchscreen) support in the Pi3D framework when configured on 2D mode.

Pi3D may be the framework with the best performance since it is designed to be GPU accelerated, but, as far I know, the 2D interfaces are designed as a 3D static projection, and my knowledge of 3D programming is limited.
I've discovered the Kivy framework last weekend, seems to be designed specially for touch screens, I will try to test them both.

About the speed sensors, we installed five IR barriers composed of a narrow-angle infrared emitter and a phototransistor coupled to an amplifier, in order to detect when the ball crosses some virtual lines. These IR barriers are placed between the goalkeepers and defence, between defence and attack and in the middle of the field. There's a photo here.
With some software (implemented in a STM32F4 Discovery attached to a custom PCB with the amplifiers) we measure the time the ball takes to cross two consecutive barriers so we can infer the ball speed and which foosmen row hitted it. The data is sent through an HC-11 wireless module to the Raspberry Pi, so the value is shown in the screen and some sounds are played if the hit was strong enough.

At the beginning, we tried to use lasers to implement the IR barriers, but the beam angle was too narrow, and the vibrations of the table when we played it caused the beam to misalign momentarily with the receiver..Currently the IR LEDs are unmodulated, which makes them sensitive to the sunlight when it enters in a certain angle through the window,. We plan to redesign the barriers with 38 KHz receivers (like the VISHAY TSSP58038) to make it more robust.
If you are curious, I can provide more information about it.

Regards

Return to “Python”