Go to Post A career is never static. - Bill Moore [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

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-01-2016, 17:53
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 222
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Arrow USB Camera issues

Hi,

I tried to get the USB camera working last year and unfortunately that didn't pan out. I am back again with a little more determination and motivation to get the camera to work.

Our camera:
A Logitech C270 USB camera

Our problem:
No video feed whatsoever in the Driver Station(and yes we did try switching every mode on the DriverStation). The camera appears in the roboRIO web dashboard as "cam1".

Our forwarding code:
Code:
        try:
            self.camera = wpilib.USBCamera()
            self.camera.startCapture()
            self.camServ = wpilib.CameraServer()
            self.camServ.startAutomaticCapture(self.camera)
        except:
            self.camera = None
The code is in Python but it should be similar to other languages.

Any suggestions or possible solutions are welcomed and very much appreciated! I have torn more hair out over this long issue than any other programming issue I've had.
  #2   Spotlight this post!  
Unread 04-01-2016, 21:52
timtim17's Avatar
timtim17 timtim17 is offline
Programmer
AKA: Austin
FRC #1294 (Top Gun Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Sammamish, WA
Posts: 13
timtim17 has a spectacular aura abouttimtim17 has a spectacular aura abouttimtim17 has a spectacular aura about
Re: USB Camera issues

I don't have experience with RobotPy, but I think you need to specify the name of the camera when creating the USBCamera instance.
Code:
self.camera = wpilib.USBCamera("cam1")
Also, I don't think you need to call self.camera.startCapture(), because self.camServ.startAutomaticCapture(self.camera) calls it for you.
  #3   Spotlight this post!  
Unread 05-01-2016, 00:45
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,058
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: USB Camera issues

My students wrote some code to use the USBCamera in RobotPy, but the USBCamera stuff is highly inefficient in python, if I recall correctly. Here's a link to some of their code.

I've never tried sending it to the Driver Station... but I feel like I remember the students doing it, and it worked.

However, if you're just trying to *see* the feed, I would recommend using mjpg-streamer instead. Here's a CD thread about that: http://www.chiefdelphi.com/forums/sh...d.php?t=135737

And here's a gist that contains scripts to make it work.

And if you want to read the images from mjpg-streamer using python and process it with OpenCV, the repo listed above has a bunch of code for that.

I'll be adding mjpg-streamer to the robotpy opkg feed for 2016, just haven't gotten around to it yet. Hopefully by the end of this week or week one.
__________________
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
  #4   Spotlight this post!  
Unread 05-01-2016, 22:51
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 222
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Re: USB Camera issues

I think I will try using the mjpg-streamer on a Raspberry Pi 2 instead of the Rio. I don't feel like messing with the Rio just days before the launch in case I brick the Rio. My only concern with the Raspberry Pi is when we are at the competition, how will I be able to consistently connect to where I will be streaming the video? Can I give a domain name to the Pi's video stream so that I always can connect?
  #5   Spotlight this post!  
Unread 05-01-2016, 22:58
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,058
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: USB Camera issues

You could use AVAHI, the same multicast DNS technology that's used to find the roborio's DNS name.

Once I get it packaged and on the opkg feed for RobotPy, it should be pretty safe to install without fearing bricking the RoboRIO.
__________________
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
Closed Thread


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 02:56.

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