Go to Post We can relate anything back to water, and by anything, I literally mean ANYTHING. Surfing around on Chief Delphi has proven that to me. - karomata [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
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 03-08-2018, 06:28 PM
SJester11 SJester11 is offline
Registered User
FRC #4028
 
Join Date: Jun 2017
Location: Cincinnati, Ohio
Posts: 4
SJester11 is an unknown quantity at this point
Unusual Red Filter On Camera During MVR?

Hi, Iím a member of 4028: The Beak Squad, and I have an interesting problem to report from MVR.
I was in charge of our robotís camera programming, and we decided to use Logitech C920s. They worked fine when we tested them before leaving for the tournament. About half a second or so of lag, but the image quality was great.
However, while we were on the field, the drivers reported to me that the camera was acting up in ways we had never seen; 3/4s of a second to a second worth of lag, as well as a red filter over the screen. We believe it to be due to the FMS, but I want to know if anybody has had similar difficulties with these cameras, or any others.
Here are some sample pictures for you to compare; a C920 outside of tournament, a Microsoft Lifecam not used in tournament, and a screencap of the C920 during a match.
https://imgur.com/a/BPK5w
Are there other cameras you would recommend that don't have these issues?
Reply With Quote
  #2   Spotlight this post!  
Unread 03-08-2018, 06:54 PM
EmileH's Avatar
EmileH EmileH is offline
Passion breeds passion.
FRC #1058 (PVC Pirates)
 
Join Date: Dec 2014
Rookie Year: 2011
Location: New Hampshire
Posts: 796
EmileH has a reputation beyond reputeEmileH has a reputation beyond reputeEmileH has a reputation beyond reputeEmileH has a reputation beyond reputeEmileH has a reputation beyond reputeEmileH has a reputation beyond reputeEmileH has a reputation beyond reputeEmileH has a reputation beyond reputeEmileH has a reputation beyond reputeEmileH has a reputation beyond reputeEmileH has a reputation beyond repute
Re: Unusual Red Filter On Camera During MVR?

The lag you describe is likely because you don't have any settings in software to limit the resolution and FPS of your camera server. The field has a 7Mb/s bandwidth limit which can easily be exceeded by a C920 without the proper settings. 1058 swears by these cameras that have H.264 hardware compression, a 180 degree field of view, and are easy to mount. The 1080p resolution is a nice bonus but we found a good balance at 240p and 24 FPS keeping us around 3-4 Mb/s.

Some questions to help further diagnose your issue:

What language are you using?
Can you post your Camera Server code if you have it?
What dashboard do you use?

I'm not really sure about the red overlay. I'm not too familiar with Shuffleboard but I've never seen that behavior on the SmartDashboard.
__________________
2016-present: FRC 1058
2013-2015: FRC 3467

Member of the New England FRC community? Join the FRC New England Alliance Facebook Group!
Reply With Quote
  #3   Spotlight this post!  
Unread 03-08-2018, 07:19 PM
SJester11 SJester11 is offline
Registered User
FRC #4028
 
Join Date: Jun 2017
Location: Cincinnati, Ohio
Posts: 4
SJester11 is an unknown quantity at this point
Re: Unusual Red Filter On Camera During MVR?

Our framerate is capped at 15fps, with the resolution set at 640x480. We use Smartdashboard to view the cameras while driving, and the code's in Java. I will post the code when I get the chance, but I think the bandwidth limit may be one of the reasons for the lag, thank you.
Reply With Quote
  #4   Spotlight this post!  
Unread 03-09-2018, 03:45 PM
codedr codedr is offline
Registered User
FRC #0537
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Wisconsin
Posts: 93
codedr will become famous soon enoughcodedr will become famous soon enough
Re: Unusual Red Filter On Camera During MVR?

There was a wpilib update to the CameraServer class.
The other things you mentioned could have caused the issue, but the wpilib update may have contributed to the problem as well. Check the wpilib changelog.
Reply With Quote
  #5   Spotlight this post!  
Unread 03-10-2018, 09:39 AM
SJester11 SJester11 is offline
Registered User
FRC #4028
 
Join Date: Jun 2017
Location: Cincinnati, Ohio
Posts: 4
SJester11 is an unknown quantity at this point
Re: Unusual Red Filter On Camera During MVR?

Sorry it took a fair amount of time, but here's the camera server code we made/used.

Quote:
package org.usfirst.frc.team4028.robot.sensors;

import edu.wpi.cscore.MjpegServer;
import edu.wpi.cscore.UsbCamera;
import edu.wpi.cscore.VideoMode;
import edu.wpi.first.wpilibj.DriverStation;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Paths;

import org.usfirst.frc.team4028.util.CircularQueue;

public class SwitchableCameraServer {
private static final String CAM0_NAME = "ceiling camera";
private static final String CAM1_NAME = "mechanical camera";
private static final String CAM2_NAME = "Lifecam test";
private static final String CAM3_NAME = "camera3";
UsbCamera _camera0;
UsbCamera _camera1;
UsbCamera _camera2;
UsbCamera _camera3;
MjpegServer _rawVideoServer;
private CircularQueue<UsbCamera> _camList;

private static SwitchableCameraServer _instance = new SwitchableCameraServer();
String _currentCamera;

public static SwitchableCameraServer getInstance() {
return _instance;
}

private SwitchableCameraServer() {
// =============
// option 2: (
// =============
/* Open connection to USB Camera (video device 0 [/dev/video0]) */
int width = 640;
int height = 480;
int frames_per_sec = 15;

_rawVideoServer = new MjpegServer("raw_video_server", 8080);

// build list of available cameras
_camList = new CircularQueue<UsbCamera>();

if (Files.exists(Paths.get("/dev/video0"), LinkOption.NOFOLLOW_LINKS)) {
System.out.println (" camera0 exists");
_camera0 = new UsbCamera(CAM0_NAME, 0);
_camera0.setVideoMode(VideoMode.PixelFormat.kMJPEG , width, height, frames_per_sec);
_camList.add(_camera0);
}
if (Files.exists(Paths.get("/dev/video1"), LinkOption.NOFOLLOW_LINKS)) {
System.out.println (" camera1 exists");
_camera1 = new UsbCamera(CAM1_NAME, 1);
_camera1.setVideoMode(VideoMode.PixelFormat.kMJPEG , width, height, frames_per_sec);
_camList.add(_camera1);
}
if (Files.exists(Paths.get("/dev/video2"), LinkOption.NOFOLLOW_LINKS)) {
System.out.println (" camera2 exists");
_camera2 = new UsbCamera(CAM2_NAME, 2);
_camera2.setVideoMode(VideoMode.PixelFormat.kMJPEG , width, height, frames_per_sec);
_camList.add(_camera2);
}
if (Files.exists(Paths.get("/dev/video3"), LinkOption.NOFOLLOW_LINKS)) {
System.out.println (" camera3 exists");
_camera3 = new UsbCamera(CAM3_NAME, 3);
_camera3.setVideoMode(VideoMode.PixelFormat.kMJPEG , width, height, frames_per_sec);
_camList.add(_camera3);
}

/* Configure Camera */
/* Note: Higher resolution & framerate is possible, depending upon processing cpu usage */

/* Start raw Video Streaming Server */
_rawVideoServer.setSource(null);
_currentCamera = null;

SwitchCamera();
}

public void SwitchCamera() {
UsbCamera nextCamera = null;
if(!_camList.isEmpty()) {
nextCamera = _camList.getNext();
_rawVideoServer.setSource(nextCamera);
System.out.println (" New camera = " + nextCamera.getName());
} else {
DriverStation.reportError("No Cameras Available", false);
}
_rawVideoServer.setSource(nextCamera);
}
}
Reply With Quote
  #6   Spotlight this post!  
Unread 03-13-2018, 12:29 PM
Skyehawk's Avatar
Skyehawk Skyehawk is offline
Nuts N' Bolts
AKA: Skye Leake
FRC #2767 (Stryke Force, Thunder Robotics, Team F.U.N.)
Team Role: Mentor
 
Join Date: Nov 2012
Rookie Year: 2011
Location: Kalamazoo, MI
Posts: 642
Skyehawk has a reputation beyond reputeSkyehawk has a reputation beyond reputeSkyehawk has a reputation beyond reputeSkyehawk has a reputation beyond reputeSkyehawk has a reputation beyond reputeSkyehawk has a reputation beyond reputeSkyehawk has a reputation beyond reputeSkyehawk has a reputation beyond reputeSkyehawk has a reputation beyond reputeSkyehawk has a reputation beyond reputeSkyehawk has a reputation beyond repute
Re: Unusual Red Filter On Camera During MVR?

It is difficult to tell for sure, due to this being a picture of a screen, not a screen-grab, but I think you are only getting the Red channel passed through in the camera image. I poked around, and for the most part I was only seeing red values represented in the image. but this is not totally true, as removing the red channel still reveals values on green and blue... Ill keep poking around & get back to you if I find anything useful.


__________________
My time in FIRST has made me a better person, frankly I don't know where I'd be without it.
  • A small mountain of hardware, good memories & life lessons with 876: 2011 - 2018
  • Inevitable good times upcoming with 2767 : 2018 - ????
Reply With Quote
  #7   Spotlight this post!  
Unread 03-13-2018, 01:35 PM
aciarniello's Avatar
aciarniello aciarniello is offline
Registered User
AKA: Andy
FRC #4028 (The Beak Squad)
Team Role: Coach
 
Join Date: Apr 2013
Rookie Year: 2011
Location: Cincinnati, OH
Posts: 78
aciarniello has a brilliant futureaciarniello has a brilliant futureaciarniello has a brilliant futureaciarniello has a brilliant futureaciarniello has a brilliant futureaciarniello has a brilliant futureaciarniello has a brilliant futureaciarniello has a brilliant futureaciarniello has a brilliant futureaciarniello has a brilliant futureaciarniello has a brilliant future
Re: Unusual Red Filter On Camera During MVR?

Quote:
Originally Posted by Skyehawk View Post
It is difficult to tell for sure, due to this being a picture of a screen, not a screen-grab, but I think you are only getting the Red channel passed through in the camera image. I poked around, and for the most part I was only seeing red values represented in the image. but this is not totally true, as removing the red channel still reveals values on green and blue... Ill keep poking around & get back to you if I find anything useful.


Drive coach for 4028 here. Based on my recollection from the competition, I'd tend to agree with your assessment here. It wasn't as if only red values were in the image. More like a severely warm white balance.

For some added background, we pull the c920s out of their housing and attach them to 3D printed housings for easy mounting. The image shown in our shop is not from the c920 that is on the competition robot, which probably further complicates matters. Is it possible that the red filtering issue is related to a loose/damaged wire? We are quite careful with our wires and strain relief when we put them into our custom housing so I'm not convinced we had that issue.

Wiring wouldn't affect the severe lag times that we were seeing, though, and that's really the heart of the issue. The cubes could look green for all I care so long as my driver can line up to them in close to real time. Anyone have thoughts on the lag situation? Given that we can't reproduce in the shop, we are leaning towards issues with resolution/frame rate settings causing issues with FMS.

On a side note, we bought one of the cameras EmileH suggested and I'm a big fan so far. Mounting is going to be a breeze and the 180 deg lens being integral to the camera gives us the field of view we're looking for way easier than our other solutions.
__________________
Andy Ciarniello
Head Coach - FRC 4028 The Beak Squad
Reply With Quote
  #8   Spotlight this post!  
Unread 03-13-2018, 04:47 PM
Peter Johnson Peter Johnson is offline
Volunteer WPILib Developer, CSA
no team (WPILib)
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 526
Peter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond repute
Re: Unusual Red Filter On Camera During MVR?

By default, auto exposure and auto white balance are turned on. These can have a dramatic effect on how fast the camera feeds you frames, and are likely contributing to the color balance issue you're seeing as well. Try adding these two lines to your camera configuration code (the values are arbitrary, adjust to taste).

Code:
camera.setExposureManual(10);
camera.setWhiteBalanceManual(50);
__________________
WPILib Developer, 2014-Present:
  • Author of cscore - WPILib CameraServer for 2017+
  • Author of ntcore - WPILib NetworkTables for 2016+
Creator of RobotPy - Python for FRC
Mentor, Team 294, 2008-2018 (World Champions FRC 2010 & FTC 2008)
Reply With Quote
  #9   Spotlight this post!  
Unread 03-13-2018, 05:38 PM
prensing prensing is offline
Registered User
AKA: Paul Rensing
FRC #2877 (LigerBots)
Team Role: Mentor
 
Join Date: Mar 2015
Rookie Year: 2014
Location: Boston MA
Posts: 31
prensing is an unknown quantity at this point
Re: Unusual Red Filter On Camera During MVR?

Quote:
Originally Posted by aciarniello View Post
For some added background, we pull the c920s out of their housing and attach them to 3D printed housings for easy mounting. The image shown in our shop is not from the c920 that is on the competition robot, which probably further complicates matters. Is it possible that the red filtering issue is related to a loose/damaged wire? We are quite careful with our wires and strain relief when we put them into our custom housing so I'm not convinced we had that issue.
I would be concerned about that. We are using C930e's and did the same thing. After a bit of testing, the cameras continually flaked out. Eventually the little JST socket on the board actually popped off. We ended up buying new camera and only carefully removing the mount, but leaving them in their housing. Mounting was not really any harder (we 3d-printed some cases).

I can't think of why the field system or software would only transmit the red channel, so a hardware problem sounds likely to me. Also, if the board is getting errors reading green and blue, then it may be seriously slowing down the acquisition dealing with error recovery, and might account for the lag.
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 01:52 AM.

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


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