Go to Post How many robotics kids does it take to turn on a light? - demosthenes2k8 [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 05-04-2015, 12:13
Happy Birthday! rod@3711 rod@3711 is offline
Registered User
AKA: rod nelson
FRC #3711 (Iron Mustangs)
Team Role: Mentor
 
Join Date: May 2014
Rookie Year: 2014
Location: Trout Lake, WA
Posts: 64
rod@3711 is an unknown quantity at this point
HD3000 USB Camera Blues

Finally determined that these 2 lines of code caused us a lot of pain.

CameraServer::GetInstance()->SetQuality(50);
CameraServer::GetInstance()->StartAutomaticCapture("cam0");

The USB camera seemed too easy. Small, USB cable, no separate power... With Chief Delphi forum help, added these lines and images displayed on the Standard Dashboard.

Then we moved cameras between usb ports and roborios and again with Chief Delpi help found that cam0, could become cam1, then cam2, etc.

Then found the camera could not be used by Smart Dashboard. Again Chief Delphi help we got a widget to make that work. But the behavior was so erratic, that we reverted back to the Standard Dashboard for video and kept Smart Dashboard for data display and selectors.

Even with the Standard Dashboard the image randomly overexposed. We found reducing the update rate helped, but was never solidly consistent.

During this evolution, we always had difficulty deploying and connecting to roborio. We became timid about make program changes, since the build and deploy, test sequence could take anywhere for 20 seconds to 1 hour, depending on how many times we had to reset the roborio, restart the driver station, disconnect and reconnect to the router.

Again with Chief Delphi help we were directed to the the data charts on the Standard Dashboard as well as the event logs. We were always getting a lots of Lost Packets and the CPU usage was always around 95%. We posted our usage charts on Chief Delphi, but it was at the end of a long thread, so it got no response.

Finally at the PNW regional, the tech staff spend over an hour helping us. Swapped out all hardware, reviewing our code, etc., but could not made problems go away. They had requested that we not turn on the camera "USB Camera HW" at the previous match and we seemed to connect faster, but still had issues.

Issues happened so often, our drive team called it the Ghost Problem. We needed an Exorcism.

The tech staff said the 95% cpu usage was not normal and they were used to 50% for a Command-Based, C++ program. They said since we were not using the camera, we should try removing those 2 lines of code that enabled the camera.

Wow... cpu usage 50%, connection are crisp and consistent, build and deploy in less than 20 seconds.

Our epiphany came a little late with only 3 matches left at the regional, but it was great to end an event feeling like there is hope for next season.

I would like to thank all those who helped at the PNW regional and on Chief Delphi.
Reply With Quote
  #2   Spotlight this post!  
Unread 05-04-2015, 15:11
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: HD3000 USB Camera Blues

Quote:
Originally Posted by rod@3711 View Post
Code:
	CameraServer::GetInstance()->SetQuality(50); 
	CameraServer::GetInstance()->StartAutomaticCapture("cam0");
...We were always getting a lots of Lost Packets and the CPU usage was always around 95%.
Where did you put those two lines of code?
Reply With Quote
  #3   Spotlight this post!  
Unread 05-04-2015, 17:39
Happy Birthday! rod@3711 rod@3711 is offline
Registered User
AKA: rod nelson
FRC #3711 (Iron Mustangs)
Team Role: Mentor
 
Join Date: May 2014
Rookie Year: 2014
Location: Trout Lake, WA
Posts: 64
rod@3711 is an unknown quantity at this point
Re: HD3000 USB Camera Blues

Quote:
Originally Posted by Alan Anderson View Post
Where did you put those two lines of code?
They were in Robot.cpp - RobotInit.


void Robot::RobotInit() {
RobotMap::init();


picker = new Picker();
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
chassis = new Chassis();
elevator = new Elevator();


// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
// This MUST be here. If the OI creates Commands (which it very likely
// will), constructing it during the construction of CommandBase (from
// which commands extend), subsystems are not guaranteed to be
// yet. Thus, their requires() statements may grab null pointers. Bad
// news. Don't move it.

oi = new OI();
lw = LiveWindow::GetInstance();

// instantiate the command used for the autonomous period
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS

CameraServer::GetInstance()->SetQuality(50); // %rod
//the camera name (ex "cam0") can be found through the roborio web interface
CameraServer::GetInstance()->StartAutomaticCapture("cam2"); // 3711
//CameraServer::GetInstance()->StartAutomaticCapture("cam0"); // 3712
Reply With Quote
  #4   Spotlight this post!  
Unread 07-04-2015, 13:33
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,050
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: HD3000 USB Camera Blues

We had problems using the camera streamer in WPILib also, so we're using mjpg-streamer instead. Not sure if it works with the SmartDashboard widget... probably not.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
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 14:01.

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