![]() |
mjpg-streamer running on roboRIO
2 Attachment(s)
Here at the Orlando Regionals while waiting in the pits for our robot to start working, I ported mjpg-streamer to the roboRIO. It was pretty funky since the source doesn't lend itself to cross-compilation. So, the answer? Compile it on a Beaglebone Black running Angstrom and copy the files over.
Result? A working camera feed that takes only 1% of the CPU. And, with a little Javascript magic, you can have multiple cameras running at the same time. There was only one little problem in that the libjpeg code isn't available on the roboRIO. So, simply copy the libraries from the BBB and place them in /usr/lib. Open source is a wonderful thing. Then, untar the mjpg-streamer code and run it ala the instructions. Enjoy, Mike |
Re: mjpg-streamer running on roboRIO
Multiple cameras? Last I tried to use mjpg-streamer for anything productive I found that only a select few models didn't hog the entire USB bandwidth on their own (causing a second camera to fail because there "isn't enough bandwidth" . Most cameras that are "uvc compatible" just aren't because of the underdevelopment by the companies that make them. What cameras are you using?
|
Re: mjpg-streamer running on roboRIO
Quote:
HTH, Mike |
Re: mjpg-streamer running on roboRIO
This sounds great. I've been contemplating finding something like this and compiling for the roborio (though I was considering ffmpeg et al), now I don't have to! :)
I've been nervous about running the streaming stuff in the same process as our robot code (particularly since we're in python and there are GIL contention issues), so having a standalone executable sounds great. |
Re: mjpg-streamer running on roboRIO
Have you guys run this during a competition yet? I would be concerned about the bandwidth taken by two simultaneous video streams. In the past, we've accidentally saturated the feed between our laptop and the robot with a single 640 x 480 stream.
|
Re: mjpg-streamer running on roboRIO
How do you display it on the PC, thru smartdashboard or VLC? And does the FMS allow for communications over the ports used?
|
Re: mjpg-streamer running on roboRIO
Quote:
HTH, Mike |
Re: mjpg-streamer running on roboRIO
Quote:
HTH, Mike |
Re: mjpg-streamer running on roboRIO
We're actually doing our DS in HTML/JS, with a python interface to forward networktables to/from the HTML page, so the mjpg-streamer is exactly what we're looking for. We played with it a little bit today and it's pretty sweet, but haven't wired it into our interface yet.
I'm curious, what javascript magic do you need to do to switch streams? Is there a delay? We setup two servers, and were able to stream two cameras that way. Didn't try the JS magic yet. |
Re: mjpg-streamer running on roboRIO
Quote:
|
Re: mjpg-streamer running on roboRIO
I'm trying to set this to test. Where did you guys install the ./www pages on the roboRIO?
Easiest thing that I can see is just to put everything under /var/local/natinst/www, since that would avoid having to edit the web config file (which seems to be at /etc/natinst/NISystemWebServer.conf). The other alternative would be to add a second document root, but while that NISystemWebServer.conf bears resemblances to Apache .conf files (perhaps version 1.X?), it pretty clearly has proprietary NI directives in it, and I'm hesitate to make changes without real documentation (which I suppose I could hunt for on NI's site). Also, did anyone notice the mjpeg-stream stuff at /usr/camera_server/mjpg-streamer-r63? It appears that's where the NI-IMAQdx routines get their USB webcam support from. It seems to be an older(?) version of the same MJPEG streaming libraries you guys are playing with. |
Re: mjpg-streamer running on roboRIO
When I try to run this, I'm getting an error opening the /dev/video0 device. I have a Logitech P930e plugged in, which should certainly support the requested mode.
Code:
admin@roboRIO-2877:/var/local/natinst/www/mjpg# source start.sh |
Re: mjpg-streamer running on roboRIO
What you want to execute is something like this:
Code:
LD_LIBRARY_PATH=`pwd` ./mjpg_streamer -i "./input_uvc.so --device /dev/video0 -f 10 -r 160x120" -o "./output_http.so --port 5800 -w www"Feedback/comments welcome! |
Re: mjpg-streamer running on roboRIO
Actually, it turns out the default shell script was working for me. I had forgotten to shut down FRCProgram, which also opened the camera!
But your scripts for starting, etc. will be helpful if we decide to go this route. Right now at 640 x 480, a stream from my Logitech P930e is taking 2.8Mbps, which is higher than the stream from our robot program, which uses the NI MAXQdx libraries to send a 640 x 360 stream at 24fps and onlyh takes 2.0 mbps. I'm still leery of how this will perform through the FMS. But you said something about doing an entire Dashboard in JavaScript. That really intrigues me. And a Python implementation of NetworkTables. Is that running server side or client side? |
Re: mjpg-streamer running on roboRIO
Quote:
We run it on the driver station. |
| All times are GMT -5. The time now is 08:45. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi