swehner / foos Goto Github PK
View Code? Open in Web Editor NEWInstant replay system for foosball table
License: GNU General Public License v3.0
Instant replay system for foosball table
License: GNU General Public License v3.0
Hallo, how i can change the goal Sound?
Thx for your help.
When running the provided command: pushd video/player; make && popd
I get following output:
pi@raspberrypi:~/Desktop/foos-25cb27145af454929f0671ca26931ab79f8c2e02 $ pushd video/player; make && popd ~/Desktop/foos-25cb27145af454929f0671ca26931ab79f8c2e02/video/player ~/Desktop/foos-25cb27145af454929f0671ca26931ab79f8c2e02 ~/Desktop/foos-25cb27145af454929f0671ca26931ab79f8c2e02 cc -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -Wall -g3 -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -Wno-psabi -L/opt/vc/lib/ -lGLESv2 -lEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -lm -L/opt/vc/src/hello_pi/libs/ilclient -L/opt/vc/src/hello_pi/libs/vgfont -o player video.o -lilclient /usr/bin/ld: cannot find -lGLESv2 /usr/bin/ld: cannot find -lEGL collect2: error: ld returned 1 exit status Makefile:12: recipe for target 'player' failed make: *** [player] Error 1
I'm running a 2017-09-07 raspbian image
I have updated and installed libav-tools sox cec-utils
When running the command pip3 install -r requirements.txt
it could not install the Pillow dependency, I was able to install it using version 2.9.0 with pip3 install Pillow==2.9.0
To make debugging w/o checking the console directly easier: make sure the log file will contain all kind of errors and deugging output.
It should also contain any errors from scripts that are run.
Clean up the whole folder structure (gui, scripts for video, etc...)
Reset score automatically after a long time of inactivity
When uploading videos several exceptions are printed.
WARNING - file_cache is unavailable when using oauth2client >= 4.0.0
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/googleapiclient/discovery_cache/__init__.py", line 36, in autodetect
from google.appengine.api import memcache
ImportError: No module named 'google'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/googleapiclient/discovery_cache/file_cache.py", line 33, in <module>
from oauth2client.contrib.locked_file import LockedFile
ImportError: No module named 'oauth2client.contrib.locked_file'
During handling of the above exception, another exception occurred:
...
Looks like this is related to googleapis/google-api-python-client#299
After some time without using the foos, the TV should turn off, a screensaver should run..
This seems to work to simply turn the HDMI signal on/off without destroying the display and overlays as tvservice -o does:
root@raspberrypi:/opt/vc/bin# vcgencmd display_power 0
root@raspberrypi:/opt/vc/bin# vcgencmd display_power 1
Using cec-client to put the TV in standby mode and turn it on also works:
pi@raspberrypi:~ $ echo "standby 0" | cec-client -s
pi@raspberrypi:~ $ echo "on 0" | cec-client -s
Making a Foosball Table in our fab lab and my colleague is trying to use your project.
Exact error is:
`Running camera...
./check: line 122: 2284 Terminated video/run-camera.sh
video/replay.sh: 12: video/replay.sh: video/player/player: Permission denied`
We tried running the command with sudo and checking the permissions, and we are having trouble solving the issue.
Hi guys - awesome work here - whats the bes way to debug on my install python3 foos.py is just hitting me with a whitescreen after Run GUI makes it to the console.
Is there any additional config I should be doing? Not sure if I needed to set up the league system in advance tbh as I havn't seen the GUI.
any help appreciated :) happy to do a full noob write up once I have this nailed...
I plan to try this project out. I'm new to PNP transistors. Can you help me know which one I should buy for this?
hallo - using the debug commands to simulate events at the moment and have tested all events successfully other than instant_replay.sh - on this I'm getting a black screen.
the picam works no issues from the command line so trying to debug that part of the set-up. I'd like to run 'sh run-camera.sh' to debug it but I'm getting the error below:
`mkdir: missing operand
Try 'mkdir --help' for more information.
stat: missing operand
Try 'stat --help' for more information.
mmal: main: Error opening output file: /fragments/out%04d.h264
No output file will be generated
Error opening output file: /fragments/mv%04d.txt
No output file will be generated
�mmal: Aborting program`
does anyone have any suggestions in regards to testing the rest of the software before I start destroying my beloved foosball table? :)
Thanks everyone!
Me again, sorry ;)
I want to make foos as a autostart program, when I put it into a crontab, foos is starting , but the camera is not starting with it.
@reboot /usr/bin/python3 /home/pi/foos/foos.py
Have you got an idea, how I can realize this, that the rasperry automatically starting it.
BTW, do you really use the V2 Camera, we must go back 2 meters to see the hole table... now we use the 1.3 camera the lense could be nearer to the table.
Hi , i want to Build raspberry only.
How i connect the 38khz Signal?
Pwm——> resistor—->+ led i think Thats right?
I have to use the pwm for Receiver too?
Or i only use 5v —->resistor——>+ ir receiver?
Sry for na Bad english, its my First rapsberry project But i want to tune my Kicker :)
Hi guys all setup now but have modified my install to use microswitches instead of infared.
Wondering if there's a way to change the team colours in the UI anywhere? Not used to a non-html UI so not sure where those colours are configed.
Cheers!
Hi, How i can change the gamemode who Starts First After reboot?
Greets
Due to tipam/pi3d#193 the console can be seen when drawing the menu.
It should be easy to fix, either changing the background, or the opengl blend func.
If hipchat module is disabled it shouldn't fail fi the dependencies are not found
Maybe link a dir in /dev/shm instead?
Hi! I've updated to latest foos ( much easier install and great documentation thanks!) Everything is sorted other than the recording, which seems to be stuck on a recorded image rather than overwriting each time a goal is scored. I'm getting the chunks from the initial test I believe. Can't seem to see any error logging for this though as I suppose the play functionality is working as expected?
Hi, so i wired up the schematic for the pi-only version, using a PNP transistor. It is working!! However, rather than registering a goal when the sensor is blocked, it is registering goals when the sensor is not blocked. As long as the IR is pointed at the sensor, it keeps adding more and more goals. As soon as I block it with my hand, it stops adding goals. So it seems exactly opposite of what I need it to do. Is there a setting somewhere to fix this and reverse the logic? Or maybe I have this wired up wrong somewhere?
Edit: Some additional info: I am using Vishay TSHF6410 IR LEDs and Vishay TSSP58038 IR Receivers, as mentioned in the BOM list. So far I have only wired up one receiver & led for my testing, assuming that both dont need wired up to do this test.
Edit2: Now that I played around with it more, actually it seems to be working correctly as long as I have the LED almost touching the sensor. I think when i had it further away maybe the led was so dim that it was detecting it as breaking the IR barrier. So....I am new to this, but learning. And I went with the 330ohm resistor on the 5v line as the schematic shows. By my calculations (again, i could be wrong!) that is way too much resistance. The tech sheet on the LED says it has 1.6voltage drop (forward voltage) and I think if I'm reading it right, I need to supply 100mah to this LED. So using ohms law of V = I X R. To get the V...5v - 1.6 = 3.4 . So 3.4 V = 100mah X Resistance. So....3.4 / .1 = 34. So I think I need a 34ohm resistor, rather than 330. Does my math sound right? I also wonder if I should have gotten a different LED. The TSHF6410 is 890nm. And the IR receiver's peak wavelength is 940nm. I can use a TV remote from across the room and the sensor detects it and counts it as a goal, but i just tried a 100 ohm resistor (lowest i currently have) on the IR LED and the sensor still cant detect the LED if its further than maybe 6-8 inches away.
Hi @swehner, hope everything's good. I've just been chatting with someone about doing 2D overlay on video on the RPi and it occurred to me that this might have been complicated by the latest RPi4 where I have to use X11 for the display surface (rather than the bcm dispman on the earlier RPis)
I can't see any issues raised by other so maybe it's all OK.
If it's busy at the moment users should be able to tell the bot to notify them once the table is free again.
Hey guys, sorry I have been away. I work for a University and since we started classes last month I have been slammed.
I started up my project again this week and made a button box prototype. LED's work great but I cant seem to figure out the button inputs. If I do them one by one it seems to map this:
D2=-Yellow
D3=+Yellow
D4=-Black
D5=+Black
D6=Replay?
When I put them all connected at once it doesnt seem to work. Buttons start to open menus that I cannot control. Is there something I am doing wrong? Where do I edit the config for button inputs?
Having a 3 and 5 goal game mode where the game automatically resets when reaching that score would be nice.
/tmp in arch was a ram filesystem, in raspbian it's not
Hi, how can I have longer replays? I have searched the config and code and don’t see how to change that.
Thanks a lot!
Jean-Michel
I might just be missing something, but:
How does the RPi connect to the arduino? Using the standard TX and RX on both?
Is portrait mode supported out of the box or does that require some more tweaks?
Keyboard input works only in X11, but not from cmdline on the RaspberryPi. Adapt/make a new plugin that can read key events from the equivalent keyboard handler (not sure what the good pi3d keyboard implementation it should be)
Display current time in 12 am/pm format
Hi,
I have a little problem,
first I have to write in english ;)
und second, the replay make an error,
everytime when a ball go throuh the IR LED and the IR Emitter, or when I use replay button..
The Score works , but the replay is not comming.
In the upper right corner there is a little picture of the camera, which is working.
Everytime foos want to play the replay, the score try to go in the backround, for an half of a second, and came directly back.
This file is made: /dev/shm/replay/fragments/out0026.h264
but the long and the short file are not generated.
Here is the code and I hope someone can help me, I build the foos with all parts and all introductions from this page.
Thanks for ur help
In this code , I use the IR barrier to make a goal.
> [pi@raspberrypi:~/foos $ python3 foos.py
> INFO - Foos v20160814 starting
> INFO - Blank console
> display:2 format:XRGB8888 transform:0 layer:-127 src:0,0,1824,984 dst:48,48,1824,984 cost:1103 lbm:0
> display:2 format:YUV_UV transform:0 layer:2 src:0,0,1280,720 dst:0,0,128,72 cost:1429 lbm:2048
> Patching create surface to fix alpha
> INFO - Display 1920x1080@25
> INFO - Loading plugins {'league', 'sound', 'control', 'leds', 'io_debug', 'io_serial', 'io_evdev_keyboard', 'replay', 'menu', 'score', 'camera', 'game'}
> INFO - Opening /dev/ttyUSB0
> INFO - Reading key events from: [InputDevice('/dev/input/event0')]
> INFO - Run GUI
> INFO - Setting game mode None None
> INFO - Ignoring short goal - duration 372
> INFO - Ignoring short goal - duration 332
> INFO - Ignoring short goal - duration 372
> INFO - Ignoring short goal - duration 348
> INFO - Ignoring short goal - duration 400
> INFO - Ignoring short goal - duration 348
> INFO - Ignoring short goal - duration 384
> INFO - Ignoring short goal - duration 444
> INFO - Ignoring short goal - duration 292
> INFO - Ignoring short goal - duration 840
> INFO - Ignoring short goal - duration 336
> INFO - Ignoring short goal - duration 544
> INFO - Ignoring short goal - duration 352
> INFO - Ignoring short goal - duration 536
> INFO - Ignoring short goal - duration 404
> INFO - Ignoring short goal - duration 604
> INFO - Ignoring short goal - duration 400
> INFO - Ignoring short goal - duration 696
> INFO - Ignoring short goal - duration 360
> INFO - Ignoring short goal - duration 852
> INFO - Ignoring short goal - duration 320
> INFO - Ignoring short goal - duration 308
> INFO - Ignoring short goal - duration 584
> ERROR - ['video/replay.sh', '/dev/shm/replay/replay_short.h264', '25'] returned 254
In this code I use the replay button
(with motionsdetector, by the way, I dont unterstand why ( people_stop_playing) all the time...)
> pi@raspberrypi:~/foos $ python3 foos.py
> INFO - Foos v20160814 starting
> INFO - Blank console
> display:2 format:XRGB8888 transform:0 layer:-127 src:0,0,1824,984 dst:48,48,1824,984 cost:1103 lbm:0
> display:2 format:YUV_UV transform:0 layer:2 src:0,0,1152,720 dst:0,0,115,71 cost:1301 lbm:2048
> Patching create surface to fix alpha
> INFO - Display 1920x1080@25
> INFO - Loading plugins {'io_debug', 'score', 'game', 'leds', 'control', 'motiondetector', 'sound', 'menu', 'io_serial', 'camera', 'league', 'replay', 'io_evdev_keyboard'}
> INFO - Watching /dev/shm/replay/fragments
> INFO - Opening /dev/ttyUSB0
> INFO - people_stop_playing
> INFO - Reading key events from: [InputDevice('/dev/input/event0')]
> INFO - Setting game mode 10 None
> INFO - Run GUI
> ERROR - ['video/replay.sh', '/dev/shm/replay/replay_long.h264', '25'] returned 254
> .pygame 1.9.4
> Hello from the pygame community. https://www.pygame.org/contribute.html
> INFO - Restore console
> display:2 format:XRGB8888 transform:0 layer:-127 src:0,0,1824,984 dst:48,48,1824,984 cost:1103 lbm:0
> display:2 format:RGB888 transform:0 layer:-1 src:0,0,938,528 dst:0,0,1920,1080 cost:1186 lbm:15360
> display:2 format:RGBA32 transform:20000 layer:1 src:0,0,1920,1080 dst:0,0,1920,1080 cost:1156 lbm:0
> display:2`format:YUV_UV transform:0 layer:2 src:0,0,1152,720 dst:0,0,115,71 cost:1301 lbm:2048
Hi all, having some lag and performance issues with my setup despite having 256ram assigned. Anyone else experiencing and are there any methods to max performance for timley replays?
From python 3.2, it's possible to configure the logging module with a dictionary, we should do it that way to avoid having another config file:
https://docs.python.org/3/library/logging.config.html#logging.config.dictConfig
Hi,
I'm not an arduino expert, forgive me:
when I connect only push buttons and less to Arduino, they work well.
if I also connect IR barrier, buttons and leds stop working (IR works fine).
Any Idea?
I use a compatible arduino UNO, can this be the reason?
Thanks.
Hello there,
I have a little new problem, maybe you can help me.
Yesterday we installed the hole project in the tablekicker. At the beginning it all looks wonderful.
We installed the IR Barrier and tested it with the ball 200 times :), when the kickertable was open with normal light evironment.
Then we closed the table and start playing / the IR Barrier only works in the dark table, when the ball runs directly in front of the IR LED. When the ball runs in the middle auf the barrier nothing happens....
We have no white ground in the table , it is wood-optic.
The IR LED is installed like yours in the little hole.
min_goal_usecs parameter is 100
Hey everyone, replay and buttons work great. I am waiting on the IR to get here on Monday.
In the meantime, can you tell me what you think the color block is?
Also, when a goal is scored...right before and right after the replay video, you can see the terminal for a few seconds---is that normal?
Thanks in advance
Running GPU at 256
Reset the last goal seems like the logical thing to do.
Hi guys, this is not an issue, it's more of a brainstorming :)
Just wanted to start a conversation on this topic, and did not found any reasonable place on github...
Maybe it would be interesting somehow to measure the ball's speed when enters the goal, and then show it after/during the replay...
What do you guys thing?
Any ideas on this topic?
Looks like the modified OutlineFont has issues with pi3d v2.16 and newer:
Traceback (most recent call last):
File "/home/pi/foos/foos/ui/ui.py", line 509, in run
self.goal_time.draw()
File "/home/pi/foos/foos/ui/anim.py", line 211, in draw
self.s.draw()
File "/usr/local/lib/python3.4/dist-packages/pi3d/Shape.py", line 212, in draw
b.draw(self, self.M, self.unif, shader, txtrs, ntl, shny)
File "/usr/local/lib/python3.4/dist-packages/pi3d/Buffer.py", line 292, in draw
assert texture.tex(), 'There was an empty texture in your Buffer.'
File "/usr/local/lib/python3.4/dist-packages/pi3d/Texture.py", line 145, in tex
self.load_opengl()
File "/usr/local/lib/python3.4/dist-packages/pi3d/util/Loadable.py", line 42, in load_opengl
self._load_opengl()
File "/usr/local/lib/python3.4/dist-packages/pi3d/Texture.py", line 263, in _load_opengl
self.update_ndarray()
File "/usr/local/lib/python3.4/dist-packages/pi3d/Texture.py", line 282, in update_ndarray
opengles.glBindTexture(GL_TEXTURE_2D, self._tex)
Hi Stefan, i Need the resistors for only raspi use too? Or can i connect ir led / receiver direct to raspi Pins?
Thx Essilor
The UI got stuck at some point in overlay mode. All events seemed to be working fine it simply didn't ever go out of overlay mode.
hello_video seems to be stuck and doesn't finish - that way the ui doesn't receive the replay_end event.
Even killing all instances doesn't seem to make them work again - Maybe something isn't cleaning up correctly... We can try with omxplayer again...
Everytime the arduino starts or the serial connection is reset (which reboots the arduino) a fake goal appears.
Maybe we should wait a bit when registering the interrupt handlers to avoid fake goals.
Hi,
My camera is above the table. I'd like the game to show all the time on the screen and have the scores at the top of the screen, instead of showing a photo in background of the score. Do you have an advice about where to start looking in the code or how you would do it? Have you tried it already and dropped the idea because of performance issues?
Thanks,
Jean-Michel
I'm very sorry to bother you again but when running the ./foos.py I get following output using the default config:
pi@raspberrypi:~/Desktop/foos $ ./foos.py
INFO - Foos v20160814 starting
INFO - Blank console
display:2 format:XRGB8888 transform:0 layer:-127 src:0,0,1440,900 dst:0,0,1440,900 cost:889 lbm:0
display:2 format:YUV_UV transform:0 layer:2 src:0,0,1280,720 dst:0,0,128,72 cost:1429 lbm:2048
Patching create surface to fix alpha
INFO - Display 1440x900@25
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
INFO - Loading plugins {'sound', 'game', 'league', 'io_debug', 'control', 'score', 'standby', 'leds', 'io_evdev_keyboard', 'menu', 'io_serial'}
Traceback (most recent call last):
File "./foos.py", line 50, in <module>
PluginHandler(bus)
File "/home/pi/Desktop/foos/foos/plugin_handler.py", line 16, in __init__
self.load(bus)
File "/home/pi/Desktop/foos/foos/plugin_handler.py", line 23, in load
module = importlib.import_module('plugins.' + plugin)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/pi/Desktop/foos/plugins/io_evdev_keyboard.py", line 2, in <module>
import evdev
ImportError: No module named 'evdev'
This was fixed doing pip install evdev
When enabling the 3 camera plugins in the config i get this output:
pi@raspberrypi:~/Desktop/foos $ ./foos.py
INFO - Foos v20160814 starting
INFO - Blank console
display:2 format:XRGB8888 transform:0 layer:-127 src:0,0,1440,900 dst:0,0,1440,900 cost:889 lbm:0
display:2 format:YUV_UV transform:0 layer:2 src:0,0,1280,720 dst:0,0,128,72 cost:1429 lbm:2048
Patching create surface to fix alpha
INFO - Display 1440x900@25
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
glGetError 0x500
INFO - Loading plugins {'score', 'io_serial', 'leds', 'io_debug', 'camera', 'standby', 'league', 'game', 'replay', 'sound', 'motiondetector', 'menu', 'control', 'io_evdev_keyboard'}
ERROR - No ttyUSB device available
Traceback (most recent call last):
File "./foos.py", line 50, in <module>
PluginHandler(bus)
File "/home/pi/Desktop/foos/foos/plugin_handler.py", line 16, in __init__
self.load(bus)
File "/home/pi/Desktop/foos/foos/plugin_handler.py", line 23, in load
module = importlib.import_module('plugins.' + plugin)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/pi/Desktop/foos/plugins/motiondetector.py", line 3, in <module>
from inotify_simple import INotify, flags
ImportError: No module named 'inotify_simple'
the camera plugins are running after installing an older version of the inotify_simple: pip install inotify_simple==1.0.3
Great project! I was trying to install the youtube upload plugin today, but it was unclear to me how I can switch back to the console without exiting the foos-program in order to fill in the verification code.
hello - when running through my pi i'm constantly getting "ignoring short goal - duration X" being outputted to the console even when event_debug is not enabled as a module - is this expected activity - any reason this would be constantly logging that people might be aware of?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.