|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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
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
|
|||||
|
|||||
|
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")
|
|
#3
|
||||
|
||||
|
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. |
|
#4
|
||||
|
||||
|
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
|
||||
|
||||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|