Better cameras?

What are ways we can get a good camera stream to our computer from our robot? We were using 2 life cams and a RPI last year on a very low quality and getting bad latency and about 8fps.

While a RPI is not the fastest coprocessor you can use, it certainly can handle producing a decent stream. You have not given enough information to diagnose what the issue is.

Start with the RPi and one camera on a bench. With no image processing, you should have no problem streaming a 320x240 image to a laptop at ~30fps. You can measure the frame rate and bit rate using Shuffleboard or SmartDashboard. Tune the “quality” until you get a decent bit (~2Mbps, maybe). Once you have that, put it on the robot and you should see pretty much the same.

If you want 2 camera, you need to decide on streaming both camera simultaneously, or switching. If you switch, should be the same. If you want both, you probably need to lower the quality a bit more, or go to a smaller image.

If you are trying to do image processing as well, then you need to time what you are doing. It is pretty easy to saturate the RPi and get the ~8 fps you mention.

1 Like

I’d also look into H.264 streaming. Here’s a good place to start.

Rumor has it that WPILib will support H.264 in the future, too.

2 Likes

The limiting factor is not the camera, but the network throttling between the robot and the driver station. For driving purposes, the sweet spot is usually for a relatively small picture at a decent frame rate, similar to what @prensing suggests. If your programmers are up to it, you may want to try experiment with custom compression techniques, like robot-side vector target identification overlaid on a relatively low resolution streaming image.

1 Like

Here’s another link that’s related to this that may help: Streaming H.264 encoding

That’s what I Had, we were good in pits, etc. get to field and we drop to 8fps and terrible bit rate.

OK, more info.

What bit rate were you running in the pit?

Also, odd question, but how was the RPi’s Ethernet connected? I ask because we had problems with our coprocessor on the field when it’s Ethernet was connected directly to the radio (no problems in the pit). The fix was to put an Ethernet switch on the robot and connect both coprocessor and Rio through the switch to the radio.

Unfortunately, given that the problem is “only” on the field, diagnosing and fixing it is pretty much hit or miss (with hard matches until it is fixed). We never could replicate it off the field (but did not try very hard…)

In our tests with a variety of different IP cameras and USB cameras (fed through Pi). The lowest latency we were able to achieve was approximately 0.1s at 20fps, 320x240 image, if I remember correctly, using an axis 207 IP Camera fed through an mjpeg stream to the driverstation.

If it’s easier to integrate a USB camera, I know a lot of teams are fond of the ELP USB cameras that are all over Amazon. They come with a variety of different lenses, so figure out how wide a view angle you want before buying (or swap it out after the fact - they screw in). I think latency for us using this camera and a a PI was around 0.25s with comparable image size and frame rates to above.

I would not recommend the Ethernet versions of the ELP cameras, I’ve never been able to get latency down to ~ less than half a second. If anyone has a working setup with low latency, please advertise your settings. I’d love to use these cameras, they are tiny and cheap… but, haven’t cracked how to get a nice low res stream at low latency…

That may be our problem as well! That was the first year my team used a coprocessor because the previous people never knew how to use them. We had it connected directly to the radio, we have an Ethernet switch I’ll be able to use!

We’ve seen great success with just 2 USB Cameras. (As a former driver, I probably should have used it more :upside_down_face:)

For the longest time our cameras lagged like crazy even though I had the FPS set to a full 60. Turns out, I had to turn the resolution WAY more down than I thought. After that, our USB cameras have been streaming at full FPS and we really didn’t need the resolution.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.