mjpg-streamer running on roboRIO


#21

Thanks! This is a big help.

MikeA
FRC #116


#22

I am trying to install it on our RIO, but I get this message: http://imgur.com/wzr8bJj

I did update to the latest version of RobotPy on the robot.

Thanks!


#23

The opkg architecture has changed from 2015 to 2016, so if you don’t have the 2016 image installed, then you will get that error.


#24

Oh yea, I still have to update. So once I get it installed, do I just plug in the webcam and I will see it on the driver station? Or is there some other setup I have to do yet?


#25

I haven’t tried to integrate mjpg-streamer with the LabVIEW dashboard (and it’s not really something I’m planning to do).

To see the camera feed, point a web browser at http://roborio-4480-frc.local:5800/ and it should show up there. If it doesn’t, then reboot your roboRIO with the camera plugged in.


#26

Awesome! Is it possible to connect two cameras with this or would that eat up too much bandwidth?


#27

This package supports launching up to 4 instances of mjpg streamer (the second would be at :5801 instead of :5800). You’ll need to edit /etc/default/mjpg-streamer on the roborio, followed by ‘/etc/init.d/mjpg-streamer restart’ or a robot reboot to enable this.

Refer to the FMS Whitepaper for bandwidth approximations. Last year we were able to run two 120x160 streams at 10fps with no complaints from the FTAA (we doubled the display size of the image on our HTML dashboard).


#28

I am not able to see the page, firefox just says unable to connect when I try “roborio-4480-frc.local:5800”. I did reboot so I am wondering if the config file is off because I set it up over USB using 172… instead of Wifi. I imagine there is a setting in the config file, but I don’t know how to get into it since my favorite editor is not installed(nano).


#29

To diagnose you’ll need to SSH into the roborio (user: admin, password: just hit enter).

  • Does /dev/video0 exist? If not, then your camera isn’t recognized by the roboRIO and mjpg-streamer won’t be running. You can use ‘dmesg’ to look at the kernel messages and try to divine what happened. Not all cameras will be supported – but I’m not 100% sure what ones are supported, or how to get the list (probably some linux magic)
  • Is mjpg-streamer running or did it die? “ps -Af | grep mjpg” will show you
  • If it’s running, is it listening on the right port? “netstat -ln” can show you what ports are being listened on, 5800 should be in the list.
  • If /dev/video0 exists and mjpg-streamer dies, then there’s something else wrong and you’ll need to run mjpg-streamer on the command line. Unfortunately, I haven’t put anything in the package to do this using the settings, so it’s a bit verbose…

#30

Alright, so there is video zero

With the “ps -Af | grep mjpg”, I get


1602 admin {grep} /bin/busybox.nosuid /bin/grep mjpg

There is not 5800 on the port list

Thanks for all the support!


#31

K, then mjpg-streamer has decided to die for some reason. You should be able to execute this and see what the error is…


mjpg_streamer -i '/usr/local/lib/mjpg-streamer/input_uvc.so --device /dev/video0 -f 10 -r 160x120' -o '/usr/local/lib/mjpg-streamer/output_http.so -w /usr/local/share/mjpg-streamer/www -p 5800'


#32

I get this error:


ERROR: could not find input plugin
          Perhaps you want to adjust the search path with:
          #export LD_LIBRARY_PATH=/path/to/plugin/folder
          dlopen:libjpeg.so.8: cannot open shared object file: No such file or directory


#33

Sounds like a bug in the installer, oops. Is there a ‘libjpeg*.ipk’ in the opkg_cache directory? You should copy that to the roborio, and ‘opkg install name_of.ipk’. Then it should work.


#34

The problem is that libjpeg didn’t get installed due to an error in the control file. I’ll rebuild the package later, but for now if you use the installer to install libjpeg8 then it should work.


#35

The default dashboard, which is simply a build of the template code of the LV dashboard, has four options for the camera display – Off, USB SW, USB HW, and Axis IP.

I believe that USB HW is compatible with the mjpeg-streamer, but it expects the stream on port 1180, which was the initial image port. I don’t have stuff to test with, but I suspect that changing the .cfg file would make it compatible. From the code, I suspect that USB SW would also work. The difference between these is that for USB SW, the roboRIO acquires uncompressed images, compresses them according to the DB settings, then transmits. USB HW requests compressed images from the camera, and transmits. It is not possible to control what that compression rate will be for USB HW.

The default DB does send a two 32 bit integers and one 16 bit to the stream port to specify the framerate, compression rate, and size. I think the streamer will ignore these and work fine. For LV teams, I’m not sure that this streamer is much different from the one in the palette and in the default robot template.

Greg McKaskle


#36

Nope, just tried it, doesn’t work when I switched it to 1180.


#37

Some of the code precedes me, and it wraps the jpeg with a header that contains a version number of 1,0,0,0. I can’t really look at the arriving stream, but I guess that the version is something he added that is not part of the standard stream and that is what is causing it to be rejected.

When I can get to it, I’ll see if that is the issue. But unfortunately, it will need a slightly modified VI and will not work with the default DS.

Greg McKaskle


#38

I updated the package, so team-4480 if you just use the installer to download/install mjpg-streamer again, it should install libjpeg now too. I also added some scripts to the package so that you can do ‘mjpg_streamer_cfg1’ to run the first configuration by hand, instead of having to guess what the command line args look like. :slight_smile:


#39

Thanks! I appreciate all your time and effort!


#40

Should the port number increment automatically? /etc/default/mjpeg-streamer uses 5800 for both. I was only able to get the second camera to work when I set the second port number to 5801.