Comments (8)
Hi there,
From the log files it looks like your IR barriers are maybe not working correcty - it seems they generate too short bursts and that's why it's ignoring them and not running the replay (see the Ignoring short goal messages). If they are correct and you want to lower the min time there's a config value for that: min_goal_usecs you can try to tweak.
To see if the video files are generated correctly can you run the scripts by hand from a terminal or from an ssh session?
Can you also check if the chunks are generated correctly?
$ ls -lrt /dev/shm/replay
With the foos running and the camera recording you should be able to run:
$ video/generate-replay.sh /dev/shm/replay 1 25 10
See if that works and if it generates the long/short video files.
Then try to run the player
$ video/replay.sh /dev/shm/replay/replay_short.h264 25
Try to see if any of these commands throw an error. BTW: I assume you've compiled the player:
pi@raspberrypi:~/foos $ pushd video/player; make && popd
Try to run the commands by hand and see if any of them output any errors, maybe then we can find out what's wrong.
from foos.
Hi,
thanks for your answers of my questions.
when I set the min_goal_usecs = 100
then I dont get back the durations. A greater number then 100 then duratios come back. But the replay dont work.
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_serial', 'io_evdev_keyboard', 'leds', 'camera', 'game', 'menu', 'io_debug', 'replay', 'control', 'league', 'score', 'sound', 'motiondetector'}
INFO - Opening /dev/ttyUSB0
INFO - Reading key events from: [InputDevice('/dev/input/event0')]
INFO - Run GUI
INFO - Watching /dev/shm/replay/fragments
INFO - Setting game mode 10 None
INFO - people_stop_playing
INFO - Ignoring goal command yellow happening too soon
INFO - Ignoring goal command yellow happening too soon
INFO - Ignoring goal command yellow happening too soon
INFO - Ignoring goal command yellow happening too soon
ERROR - ['video/replay.sh', '/dev/shm/replay/replay_short.h264', '25'] returned 254
INFO - Ignoring goal command yellow happening too soon
INFO - Ignoring goal command yellow happening too soon
INFO - Ignoring goal command yellow happening too soon
ERROR - ['video/replay.sh', '/dev/shm/replay/replay_short.h264', '25'] returned 254
INFO - Ignoring goal command yellow happening too soon
INFO - Ignoring goal command yellow happening too soon
. 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
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
pi@raspberrypi:~/foos $ ´
When I only use the replaybutton
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 {'replay', 'leds', 'io_debug', 'io_serial', 'score', 'control', 'motiondetector', 'game', 'sound', 'camera', 'menu', 'io_evdev_keyboard', 'league'}
INFO - Opening /dev/ttyUSB0
INFO - Watching /dev/shm/replay/fragments
INFO - people_stop_playing
INFO - Reading key events from: [InputDevice('/dev/input/event0')]
INFO - Run GUI
INFO - Setting game mode 10 None
ERROR - ['video/replay.sh', '/dev/shm/replay/replay_long.h264', '25'] returned 25
The fragments are working all the time, and the file works in this folder (out0027.h264)
ls -lrt /dev/shm/replay
pi@raspberrypi:~ $ ls -lrt /dev/shm/replay
insgesamt 0
drwxr-xr-x 2 pi pi 80 Okt 27 19:20 fragments
I assume you've compiled the player:
pi@raspberrypi:~/foos $ pushd video/player; make && popd
~/foos/video/player ~/foos
make: „player“ ist bereits aktuell.
~/foos
that looks good and is to date.
the short and the long replays are not comming, so i cannot play them.
Sometimes I close the foos program and this code is generated, normaly this dont happen.
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 {'replay', 'leds', 'io_debug', 'io_serial', 'score', 'control', 'motiondetector', 'game', 'sound', 'camera', 'menu', 'io_evdev_keyboard', 'league'}
INFO - Opening /dev/ttyUSB0
INFO - Watching /dev/shm/replay/fragments
INFO - people_stop_playing
INFO - Reading key events from: [InputDevice('/dev/input/event0')]
INFO - Run GUI
INFO - Setting game mode 10 None
ERROR - ['video/replay.sh', '/dev/shm/replay/replay_long.h264', '25'] returned 254
ERROR - ['video/replay.sh', '/dev/shm/replay/replay_long.h264', '25'] returned 254
ERROR - ['video/replay.sh', '/dev/shm/replay/replay_long.h264', '25'] returned 254
ERROR - ['video/replay.sh', '/dev/shm/replay/replay_long.h264', '25'] returned 254
. 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
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
Exception in thread Thread-17:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/foos/plugins/io_evdev_keyboard.py", line 86, in writer_thread
self.write_queue.get()
File "/usr/lib/python3.5/multiprocessing/queues.py", line 94, in get
res = self._recv_bytes()
File "/usr/lib/python3.5/multiprocessing/connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/lib/python3.5/multiprocessing/connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "/usr/lib/python3.5/multiprocessing/connection.py", line 383, in _recv
raise EOFError
EOFError
Exception in thread Thread-8:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/foos/plugins/io_serial.py", line 51, in writer_thread
line = self.write_queue.get()
File "/usr/lib/python3.5/multiprocessing/queues.py", line 94, in get
res = self._recv_bytes()
File "/usr/lib/python3.5/multiprocessing/connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/lib/python3.5/multiprocessing/connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "/usr/lib/python3.5/multiprocessing/connection.py", line 383, in _recv
raise EOFError
EOFError
I build the foos with the components from your list, und I use the fritzing JPEG.
Do you use the capacitor with 100nF and the 100Ω resistor for the IR emitter, I use this.
I tested it, they also work without them.
BTW:
The 4 pin buttons work, but I dont know if I correctly connected them.
+
o
2A250VAC o o
o
-
Example LED 3 from the fritzing jpeg:
(+) and (2A250VAC) , i put to A0 on the Arduino
(-) to Ground
and the right last pin to D2 from the NANO
When I push the buttons they work correctly, but dont flash up the LEDs.
when the IR barrier make a goal , all 5 buttons LEDS flashes.
Is this correct ?
from foos.
Hi,
Regarding the IR detectors, it looks like they are generating too many and too short pulses (when you lower the min_goal_usecs parameter, it detects more goals but it ignores them because they are happening too close together - hence the "Ignoring goal command yellow happening too soon" message.
I think we had a similar problem when the IR barriers were over white ground, so light would bounce off a close-by surface and would generate a very flaky signal... anyways that shouldn't affect that the replay isn't working.
I think there's some issue with the camera recording
ls -lrt /dev/shm/replay/fragments
(forgot to add the fragments in the path). You should see a bunch of files in there that keep overwriting themselves while the camera is running. You seem to mention only one, so I guess there's something wrong there. In the small preview window on the top can you see that the camera is recording? Or does it freeze up?
What camera model is it? Is it the version1 or the newer version2 https://www.raspberrypi.org/products/camera-module-v2/?
Maybe you can try it out without running foos to see if it works correctly:
/opt/vc/bin/raspivid -o /dev/shm/replay/fragments/out%04d.h264 -x /dev/shm/replay/fragments/mv%04d.txt -w 1280 -h 720 -fps 49 -t 0 -sg 100 -wr 100 -g 10 --ev 7 -p 0,0,1280,720
This should output a bigger preview screen - check if that is working correctly, or if there are some errors...
Regarding the wiring questions: The caps and resistor on the IR receiver should help to stabilize the signal and remove some of the noise you're seeing, it'll work without them, but it should help to only detect the ball passing once...
Regarding the leds - they should be flashing on and off when a goal is scored. In plugins/leds.py you can see there are different patterns for different events in the game...
from foos.
Hi,
now I have the right camera... V2 is now installed. Bevor I had the 1.3 Version, my fault.
After "rpi-update" und a lot of testing, the camera make a replay, but it only works when I start:
python3 foos.py -s 3
In the screen the goalscore is too little.
Do you have an idea to make a it a little bit bigger?
When I start without -s 3 , I have a black screen for the time when the replay should come. The preview works.
from foos.
Hi,
First of all, sorry - I didn't mean to imply you needed to change the camera module, both v1 and v2 should work fine.
As the problem seems to be related to the camera and the raspivid process I just wanted to get some more information.
Also when you post your comments, don't edit them deleting helpful information cause it's harder to follow up for others when reading - just add a new comment with your new finding :)
So basically you're saying that when you run the process raspivid directly it works fine, right?
And foos picks up the fragments afterwards - that's pretty good!
You can't run two raspivid processes at the same time, so the error you got before is normal...
The -s parameter is usually used when running from X windows to make the window smaller and not run it in fullscreen mode...
Is that what you're doing? Are you running Xwindows and running foos from there?
I think I never tried to run it under X on the pi... I usually always started it directly from a terminal or through an ssh session...
How much memory do you have assigned for the GPU?
Can you run the check command from the foos dir... it should output it..
foos$ ./check
Maybe there's not enough memory to run a X display, foos and the camera altogether... so you could try to give more memory to the GPU...
from foos.
Ok , I understand, I will write without editing all the time :)
so I dont use XWindows, I installed Rasbian over Noobs.
The GPU is now 384.
* GPU settings:
[ OK] GPU memory set to 384
The Video replays are running but with different problems.
Now I can start foos normal , without -s3 and with the button the long replay come without errors in the backround.
When I use the IR Barrier the replays are comming too, but with errors in the terminal all the time:
WARNING - Movement vector file size is off - expected a full frame of 7548 bytes (=51 * 37 * 4) but got 2040
WARNING - This probably means that md_size is misconfigured
WARNING - Movement vector file size is off - expected a full frame of 7548 bytes (=51 * 37 * 4) but got 2040
WARNING - This probably means that md_size is misconfigured
WARNING - Movement vector file size is off - expected a full frame of 7548 bytes (=51 * 37 * 4) but got 2040
WARNING - This probably means that md_size is misconfigured
WARNING - Movement vector file size is off - expected a full frame of 7548 bytes (=51 * 37 * 4) but got 2040
When the replay starts by button and by IR barrier the screen goes to the camera for a moment an show 1 second of a replay, then it goes black for a second, after it the slow motion is comming for about ...3 second, go black again, and then the normal score-screen comes back.
I changed some values in the config , like the resoltion 800x600 (so I get a replay without -s 3) :
# basic set of plugins
plugins = set(['io_serial', 'score', 'game', 'sound', 'io_debug', 'menu', 'control', 'league', 'leds', 'io_evdev_keyboard'])
plugins.update(set(['replay', 'camera', 'motiondetector']))
onscreen_leds_enabled = False
blank_console = True
standby_timeout_secs = 600
bg_change_secs = 300
# use dispmanx to draw bg as a separate layer
draw_bg_with_dispmanx = True
clock_format = "%H:%M"
hipchat_token = 'your_token'
hipchat_room = 'your_room_id'
min_goal_usecs = 100
min_secs_between_goals = 3
show_instructions = True
#team_names = {"yellow": "yellow", "black": "black"}
#team_colors = {"yellow": (1, 0.7, 0), "black": (0, 0, 0)}
""" Configure team names and colors """
team_names = {"yellow": "blue", "black": "red"}
team_colors = {"yellow": (0.1, 0.1, 0.4), "black": (0.7, 0, 0)}
# game modes: tuples of (winning score, timeout in minutes)
game_modes = [(None, None), (5, None), (10, None), (3, 120)]
replay_path = '/dev/shm/replay'
#replay_path = '/home/pi/replay'
replay_fps = 25
ignore_recent_chunks = 1
short_chunks = 10
long_chunks = 25
league_dir = './league'
league_url = 'http://localhost:8888/api'
league_apikey = 'put-your-apikey-here'
video_size=(800, 600)
video_fps = 49
camera_preview = "-p 0,0,115,71"
camera_chunk_settings = "-sg 100 -wr 100 -g 10"
camera_extra_params = "--ev 7"
# config parameters for motion detector
# MV frame size
md_size = (video_size[0] // 16 + 1, video_size[1] // 16)
# crop pixels on each size of the frame to avoid detecting movement outside of the table
md_crop_x = 25
# threshold to consider MV movement
md_mv_threshold = 100000
# number of vectors to consider frame to contain movement
md_min_vectors = 30
# number of contiguous frames to required to consider it movemen
md_min_frames = 9
# send people_stop_playing event after X seconds without movement
md_ev_absence_timeout = 30
# send movement_detected every X seconds
md_ev_interval = 2
log = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"simple": {
"format": "%(asctime)s %(levelname)7s %(name)s - %(message)s",
"datefmt": "%H:%M:%S"
},
"console": {
"format": "%(levelname)7s - %(message)s"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "DEBUG",
"formatter": "console",
"stream": "ext://sys.stdout"
},
"file_handler": {
"class": "logging.handlers.RotatingFileHandler",
"level": "DEBUG",
"formatter": "simple",
"filename": "/dev/shm/foos_event.log",
"maxBytes": 1000000,
"backupCount": 3
},
},
"loggers": {
"plugins.event_debugger": {
"level": "DEBUG",
"handlers": ["file_handler"],
"propagate": "no",
},
"pi3d": {
"level": "WARN",
"handlers": ["console", "file_handler"],
"propagate": "no",
}
},
"root": {
"level": "INFO",
"handlers": ["console", "file_handler"]
}
}
I think , I need other values for my monitor (24" 16/10 Ratio) , maybe a resolution between 800x600 and 1150x720, or someting like this ?
Should I test a lower or higher GPU RAM or is 384 ok?
from foos.
Hi,
now I have good news.
With a resolution of video_size=(720, 576)
and the GPU RAM with 384 all things are working.
I think that the Monitor needs this values for playing the replay and the slowmotion.
But a new message is comming, when I close the game with "." from the keyboard.
Via SSH I can the in the Terminal this message:
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,720,576 dst:13,0,88,71 cost:1029 lbm:2048
Exception in thread Thread-7:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/foos/plugins/io_serial.py", line 51, in writer_thread
line = self.write_queue.get()
File "/usr/lib/python3.5/multiprocessing/queues.py", line 94, in get
res = self._recv_bytes()
File "/usr/lib/python3.5/multiprocessing/connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/lib/python3.5/multiprocessing/connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "/usr/lib/python3.5/multiprocessing/connection.py", line 383, in _recv
raise EOFError
EOFError
Exception in thread Thread-17:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/foos/plugins/io_evdev_keyboard.py", line 86, in writer_thread
self.write_queue.get()
File "/usr/lib/python3.5/multiprocessing/queues.py", line 94, in get
res = self._recv_bytes()
File "/usr/lib/python3.5/multiprocessing/connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/lib/python3.5/multiprocessing/connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "/usr/lib/python3.5/multiprocessing/connection.py", line 383, in _recv
raise EOFError
EOFError
pi@raspberrypi:~/foos $ .
Any ideas , why ?
BTW, thanks for ur help, I am very happy that the system in running now and I can built in it into my kickertable. This was my first Raspberry-projekt and I have to read and learn so much things for the completition of this project.
from foos.
Hey,
I'm glad to hear that it worked out in the end! 384mb should be more than enough, I think.
The video_size is for the camera recording.. I don't think it should be important what monitor you're using, but more importantly the supported modes of the camera.
You can find more info here: https://www.raspberrypi.org/documentation/hardware/camera/
About the errors when exiting foos i wouldn't worry too much, it's an unhandled exception but it shouldn't cause any problems.
I'm resoling the issue - feel free to reopen if you still have trouble!
from foos.
Related Issues (20)
- 38khz pwm only to+ IR led or to + ir receiver too? HOT 5
- How i can change the gamemode on Start? HOT 1
- Button Pins dont work.... HOT 5
- Need help, how i can change goalsound?
- Are there any problems running with buster? HOT 2
- what PNP transistor to use HOT 3
- Goals keep registering as long as LED is pointing at receiver, and stops when it is blocked HOT 12
- Portrait mode HOT 3
- Problem to install libav-tools HOT 9
- Problem to install libav-tools HOT 1
- Menue zeigt foos-tournament nicht an HOT 1
- RASPI B - GPIO PROBLEME
- Problem tu run GUI HOT 4
- Problem with camera & UI HOT 2
- IR Lichtschranke HOT 10
- Der fernseher geht bei replay kurz aus und wieder an HOT 2
- Die Auflösung der Kamera ist schlecht HOT 1
- Problem mit der GUI (RPi only Setup) HOT 3
- Hardware HOT 1
- Foos läuft plötzlich nicht mehr HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foos.