Camera will not turn on using wpilibpi, even though there is clearly code that should work?

Hello all of you fanatics of code and things, I am having trouble figuring out why my Microsoft life cam will not turn on. I am running the code on a raspberry pi 4 having the wpilibpi image installed on it. It is supposed to have all the necessary files for it to work. Btw, it runs on this server when the raspberry pi is turned on. http://wpilibpi.local/. When I import my python code onto the vision application, it outputs this result:

CS: USB Camera 0: Connecting to USB camera on /dev/video0

Waiting 5 seconds…

CS: USB Camera 0: Connecting to USB camera on /dev/video0

Waiting 5 seconds…

CS: USB Camera 0: Connecting to USB camera on /dev/video0

Waiting 5 seconds…

CS: USB Camera 0: Connecting to USB camera on /dev/video0

Waiting 5 seconds…

CS: USB Camera 0: Connecting to USB camera on /dev/video0

Waiting 5 seconds…

CS: USB Camera 0: Connecting to USB camera on /dev/video0

Waiting 5 seconds…

CS: USB Camera 0: Connecting to USB camera on /dev/video0

Waiting 5 seconds…

CS: USB Camera 0: Connecting to USB camera on /dev/video0

Waiting 5 seconds…

CS: USB Camera 0: Connecting to USB camera on /dev/video0

Waiting 5 seconds…

CS: USB Camera 0: Connecting to USB camera on /dev/video0

Waiting 5 seconds…

CS: USB Camera 0: Connecting to USB camera on /dev/video0

This is really bothersome to me. Here is my code if your curious

from cscore import *
from networktables import NetworkTables

import cv2
import json
import numpy

def main():

CameraServer.getInstance().startAutomaticCapture()

if name == “main”:
main()

The strangest thing about this is that if I select multiple camera streams under the vision application, it will turn on the camera. However, this is not what I want, since I want the camera feed that’s coming from the vision code I have.

It would be appreciated if someone could help me with this.

im not entirely sure that the lifecam is supported under linux. what model are you using?

1 Like

Hello! I would start out with the Python sample project that can be downloaded here: Release WPILib Pi Image 2021.1.1 Kickoff Release · wpilibsuite/WPILibPi · GitHub under python-multiCameraServer.zip. Without making any changes to the sample, try to upload it and see what happens. Once you have that working, then slowly add in your own vision code.

The heart of the problem right now is that it looks like you have Python code intermixed with some Java code.

The LifeCam does work with WPILibPi.

1 Like

Thank You!, I also a smaller question. When I the run the python example program, it gives me this depreciation error

multiCameraServer.py:174: DeprecationWarning: startAutomaticCapture(return_server=True) is deprecated (default if passed a camera object)
server = inst.startAutomaticCapture(camera=camera, return_server=True)

Do I leave out

return_server=True or is their something else I should do. It does not seem to break the program.

Edit*, Never mind, you can just get rid of it.