Go to Post In the end the important thing is that the rookie members who make up the majority of our team were inspired and will try much harder next year. :) - aeniug2 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-01-2017, 08:30
technogeek6952 technogeek6952 is offline
Registered User
FRC #4068 (Bearbotics)
Team Role: Programmer
 
Join Date: Oct 2014
Rookie Year: 2013
Location: Monument, Colorado
Posts: 8
technogeek6952 is an unknown quantity at this point
Low Latency Camera Discussion

Because of the large obstructions in our field of view, we (team 4068) are thinking about using a camera to aid the drivers in tasks such as lining up the gear with the peg.

We've done a fair bit with cameras and driver visibility in the past, but it's always had a significant lag time (at least one or more seconds) between when something would move and the driver would see it on the camera. This made it hard for our drivers to use, and they mostly ignored the camera, in favor of lining things up by eye from the driver station.

I'd like to know if anyone has any insights as to how to get a low-latency (ideally only a couple hundred milliseconds) camera stream to the drivers.

We're currently thinking of skipping all of the code FIRST uses for their default camera stream, and just send raw data from the camera (compressed to save bandwidth) to the driver station over one of the UDP ports they give us for our own use. We would make a companion application on the driver station to quickly draw the frames sent over UDP. We're not sure if that would do enough to reduce latency to be worth our time, though.

Has anyone done any analysis of what contributes to latency on the camera stream? Would removing the WPILib code remove much latency? Or is more time added by some other factor? What success have other teams had in removing latency in the past?

PS: We us Java, in case that's important.
Reply With Quote
  #2   Spotlight this post!  
Unread 09-01-2017, 08:53
aeastet aeastet is offline
Programming Mentor
AKA: Tim Easterling
FRC #6043 (Allegan Tigers Robotics)
Team Role: Coach
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Holland, MI
Posts: 128
aeastet is an unknown quantity at this point
Re: Low Latency Camera Discussion

Take a look at this:

https://www.chiefdelphi.com/forums/s...highlight=NavX

The SF2 libraries are written for Java, C++ and LabVIEW. We have used them with teams that have frame rates as low as 5 FPS with success.

I hope this helps,

Tim
Reply With Quote
  #3   Spotlight this post!  
Unread 09-01-2017, 10:46
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Low Latency Camera Discussion

You didn't mention what programming language you use or what resolution you had issues with in the past.

For C++ and Java, the WPILib CameraServer class has been completely rewritten to significantly optimize it. We get lower latency and much lower CPU usage compared to last year. It also sends the data as a standard mjpeg stream, so you can open it in a web browser. This is helpful because it can help determine if it's your dashboard, or something else that is causing the latency. You should give it a try this year before trying to implement your own.

In general, you want to use the smallest resolution that gets you the results you need. For a driver camera, we've been able to get away with 160x120 in the past. That requires pushing 16x less pixels then 640x480.
Reply With Quote
  #4   Spotlight this post!  
Unread 09-01-2017, 13:02
slibert slibert is offline
Software Mentor
AKA: Scott Libert
FRC #2465 (Kauaibots)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2005
Location: Kauai, Hawaii
Posts: 356
slibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud of
Re: Low Latency Camera Discussion

Quote:
Originally Posted by Joe Ross View Post
You didn't mention what programming language you use or what resolution you had issues with in the past.

For C++ and Java, the WPILib CameraServer class has been completely rewritten to significantly optimize it. We get lower latency and much lower CPU usage compared to last year. It also sends the data as a standard mjpeg stream, so you can open it in a web browser. This is helpful because it can help determine if it's your dashboard, or something else that is causing the latency. You should give it a try this year before trying to implement your own.

In general, you want to use the smallest resolution that gets you the results you need. For a driver camera, we've been able to get away with 160x120 in the past. That requires pushing 16x less pixels then 640x480.
Just wanted to echo Joe's sentiment here. An issue I've seen at competitions is that the bandwidth (between driver station and robot) is sometimes limited due to various environmental issues that arise during a real-world competition. FIRST has done a lot of work to improve things here, but the wireless link between the robot is susceptible to disruption from other signals (e.g., cell phones). Again this is usually not a problem but in addition to keeping your video bandwidth on the low side I'd encourage you to think through what happens if this doesn't work due to some sort of temporary disruption. I think it will likely be fine 99% of the time, but there are (likely rare) times when it may not, so think carefully before making this a feature that your robot has to have to play the game. Be sure to have a workaround in case it doesn't work during a particular match.
Reply With Quote
  #5   Spotlight this post!  
Unread 09-01-2017, 14:33
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Low Latency Camera Discussion

Just to add one comment about the CameraServer class... Please try it early and let us know if you are having any issues including latency. I understand that the environment in your shop might not be completely the same as the field, but it would help you understand the basic performance and let you tune parameters to make it work for you. And, you can give us feedback while there's time to fix bugs or do small optimizations before the competitions start.

If you are just using the camera for getting a remote view you can try an ethernet camera connected to a switch on your robot. Then you can view the http stream on your driver station computer and not go through the roboRIO at all. However, we expect that the hit on the CPU will be minimal just for moving images through without processing.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
  #6   Spotlight this post!  
Unread 09-01-2017, 14:44
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Low Latency Camera Discussion

Quote:
Originally Posted by BradAMiller View Post
If you are just using the camera for getting a remote view you can try an ethernet camera connected to a switch on your robot. Then you can view the http stream on your driver station computer and not go through the roboRIO at all.
Be cautious with this approach also. A lot of cheap IP cameras are designed for security usage, and a second of latency isn't an issue for security, so they may have poor latency.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 23:54.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi