Go to Post will.i.am should be evangelizing FIRST, not vise-versa. - basicxman [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
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 23-02-2016, 18:22
onenerdyguy onenerdyguy is offline
Registered User
FRC #5929
 
Join Date: Jan 2016
Location: Lake Park, MN
Posts: 39
onenerdyguy is an unknown quantity at this point
Urgent- Python USB Camera not working

I'm having difficulty getting the MS Lifecam to show up on our robot. We have an axis camera currently, that's working great, but I can't get a second USB cam setup. We want a rear-view camera to help with intake, but we're having issues.

Current code:

camera = wpilib.USBCamera()
camera.startCapture()
server = wpilib.CameraServer()
server.startAutomaticCapture(camera)

When I go onto the Roborio, I can see the lifecam plugged in and recognized on it's web interface. However, even by going to the default dashboard, I can't get any image on the DS. Am I missing something?
Reply With Quote
  #2   Spotlight this post!  
Unread 23-02-2016, 19:30
razar51 razar51 is offline
Registered User
AKA: John Faulkner
FRC #1288 (Raven Robotics)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2007
Location: St. Charles, MO
Posts: 10
razar51 is an unknown quantity at this point
Re: Urgent- Python USB Camera not working

You might check that the roborio didn't give your camera a different name. The default name for the camera that the code you have there assumes is 'cam0'.

Last year we had an issue where, when testing different cameras, the roborio would increment the number of the name given to the camera (cam1, cam2, etc.)

We solved this by doing something similar to the following and then using the default dashboard set to HW capture:

Code:
       camera = wpilib.USBCamera(b'cam1')
       server = wpilib.CameraServer.getInstance()
       server.startAutomaticCapture(camera)
You can find the name the roborio gave to your camera by having it plugged in and then using the USB interface to connect to the roborio in a web browser (172.22.11.2). It should list the names of the devices connected to it,
Reply With Quote
  #3   Spotlight this post!  
Unread 23-02-2016, 23:20
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Urgent- Python USB Camera not working

Quote:
Originally Posted by razar51 View Post
roborio in a web browser (172.22.11.2)
use roborio-team-frc.local if at all possible. 172.22.11.2 is only valid over a USB connection. the mDNS address is accessible via wireless, ethernet, and probably USB (I've never actually tested using mDNS over USB now that I think of it...)
__________________
FRC Team 1684 - Head Programmer (2013-2016)
FRC Team 5460 - Programming Mentor (2015-2016)

FIRST in Michigan - Technical Crew (2015-continuing)
Reply With Quote
  #4   Spotlight this post!  
Unread 23-02-2016, 23:35
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,040
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: Urgent- Python USB Camera not working

If you're using the LabVIEW dashboard, you have to have the beta version of pynetworktables installed, or it will not connect. See https://github.com/robotpy/robotpy-wpilib/issues/172
__________________
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
  #5   Spotlight this post!  
Unread 24-02-2016, 07:48
WubbaDuck WubbaDuck is offline
Registered User
FRC #0074 (Chaos)
Team Role: Mentor
 
Join Date: Jan 2016
Rookie Year: 2010
Location: Michigan
Posts: 6
WubbaDuck is an unknown quantity at this point
Re: Urgent- Python USB Camera not working

We spent a bunch of time trying to get the USB camera to work correctly. The result was a very laggy robot. No joke, it was around 1-2 seconds of delay with the camera enabled. Then one of our guys discovered a post in the forum about using mjpg-streamer instead. It was super easy to install and works like a champ! There is also a smart dashboard plugin that allows you to have direct dashboard output. You can find more info here: https://robotpy.github.io/2016/01/14...r-for-roborio/
Reply With Quote
  #6   Spotlight this post!  
Unread 24-02-2016, 09:02
onenerdyguy onenerdyguy is offline
Registered User
FRC #5929
 
Join Date: Jan 2016
Location: Lake Park, MN
Posts: 39
onenerdyguy is an unknown quantity at this point
Re: Urgent- Python USB Camera not working

Quote:
Originally Posted by WubbaDuck View Post
We spent a bunch of time trying to get the USB camera to work correctly. The result was a very laggy robot. No joke, it was around 1-2 seconds of delay with the camera enabled. Then one of our guys discovered a post in the forum about using mjpg-streamer instead. It was super easy to install and works like a champ! There is also a smart dashboard plugin that allows you to have direct dashboard output. You can find more info here: https://robotpy.github.io/2016/01/14...r-for-roborio/

This is exactly what we found last night, at 11:30 pm. We got the camera working, but lag was horrendous. By dropping the quality, we got the lag down to about half a second, but still not usuable.

I pulled the camera off, and will be working on getting mjpg-streamer setup.

Are you running yours off the RoboRio, or off like a raspberry pi? I do have a spare roboRio we ordered I can practice the setup on, so that when we get to competition I can quickly deploy it.
Reply With Quote
  #7   Spotlight this post!  
Unread 24-02-2016, 09:06
onenerdyguy onenerdyguy is offline
Registered User
FRC #5929
 
Join Date: Jan 2016
Location: Lake Park, MN
Posts: 39
onenerdyguy is an unknown quantity at this point
Re: Urgent- Python USB Camera not working

Quote:
Originally Posted by razar51 View Post
You might check that the roborio didn't give your camera a different name. The default name for the camera that the code you have there assumes is 'cam0'.

Last year we had an issue where, when testing different cameras, the roborio would increment the number of the name given to the camera (cam1, cam2, etc.)

We solved this by doing something similar to the following and then using the default dashboard set to HW capture:

Code:
       camera = wpilib.USBCamera(b'cam1')
       server = wpilib.CameraServer.getInstance()
       server.startAutomaticCapture(camera)
You can find the name the roborio gave to your camera by having it plugged in and then using the USB interface to connect to the roborio in a web browser (172.22.11.2). It should list the names of the devices connected to it,
Also, this fixed our issue with getting it to work, but then the lag came in. We'll figure it out!
Reply With Quote
  #8   Spotlight this post!  
Unread 24-02-2016, 09:40
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,040
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: Urgent- Python USB Camera not working

In 2017, I'll be removing the CameraServer class in python and throw an exception telling the user to use mjpg-streamer instead. As you've seen, it's very low performance, and is just a lot of trouble in general.
__________________
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
  #9   Spotlight this post!  
Unread 24-02-2016, 10:52
WubbaDuck WubbaDuck is offline
Registered User
FRC #0074 (Chaos)
Team Role: Mentor
 
Join Date: Jan 2016
Rookie Year: 2010
Location: Michigan
Posts: 6
WubbaDuck is an unknown quantity at this point
Re: Urgent- Python USB Camera not working

Quote:
Originally Posted by onenerdyguy View Post
This is exactly what we found last night, at 11:30 pm. We got the camera working, but lag was horrendous. By dropping the quality, we got the lag down to about half a second, but still not usuable.

I pulled the camera off, and will be working on getting mjpg-streamer setup.

Are you running yours off the RoboRio, or off like a raspberry pi? I do have a spare roboRio we ordered I can practice the setup on, so that when we get to competition I can quickly deploy it.
We installed it directly on the RoboRio and saw no noticeable slowdown.
Reply With Quote
  #10   Spotlight this post!  
Unread 25-02-2016, 16:21
onenerdyguy onenerdyguy is offline
Registered User
FRC #5929
 
Join Date: Jan 2016
Location: Lake Park, MN
Posts: 39
onenerdyguy is an unknown quantity at this point
Re: Urgent- Python USB Camera not working

Quote:
Originally Posted by WubbaDuck View Post
We spent a bunch of time trying to get the USB camera to work correctly. The result was a very laggy robot. No joke, it was around 1-2 seconds of delay with the camera enabled. Then one of our guys discovered a post in the forum about using mjpg-streamer instead. It was super easy to install and works like a champ! There is also a smart dashboard plugin that allows you to have direct dashboard output. You can find more info here: https://robotpy.github.io/2016/01/14...r-for-roborio/

I'm having some trouble installing this. I'm using our backup roborio, and made sure it's all up to date.

I download the opkg file using the installer.py and then attempt to install it on the RoboRio via the installer as well. However, I get the error that libjpeg8 packages are found, but are not the right arch. However, they are listing as cortexa9.

Is there a trick to this? or should I try the online install?
Reply With Quote
  #11   Spotlight this post!  
Unread 25-02-2016, 16:29
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,040
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: Urgent- Python USB Camera not working

Quote:
Originally Posted by onenerdyguy View Post
I'm having some trouble installing this. I'm using our backup roborio, and made sure it's all up to date.

I download the opkg file using the installer.py and then attempt to install it on the RoboRio via the installer as well. However, I get the error that libjpeg8 packages are found, but are not the right arch. However, they are listing as cortexa9.

Is there a trick to this? or should I try the online install?
You should upgrade your roborio to the 2016 image.
__________________
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
  #12   Spotlight this post!  
Unread 25-02-2016, 16:41
onenerdyguy onenerdyguy is offline
Registered User
FRC #5929
 
Join Date: Jan 2016
Location: Lake Park, MN
Posts: 39
onenerdyguy is an unknown quantity at this point
Re: Urgent- Python USB Camera not working

Bah, I did the firmware, but missed the image. I am dumb.
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 19:50.

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