We are stumped on getting our USB camera to work with python. We have looked at tons of other posts with various solutions, none of which worked for us. Went through wpilib docs and and other websites offering solutions but to no avail.
We used Labview last season and tested the camera and it still works with the labview file but not through python this year… Whenever we press enable on the roboRIO, the camera on dashboard just says “Invalid Camera Name” We have the correct name though from when we tried it on Labview.
Here is the current code we are using after trying various other solutions.
# Stream the camera - if you aren't vision processing and are just streaming the camera, this is all you need
Did you install robotpy-cscore on your robot?
What error messages are showing up in your driver station console?
We have had cscore installed yes. We get no messages in driver station console.
Yes, that. There should be lots of messages there, some of them will be errors.
I’m not seeing where I can open that up in PyCharm
Sorry, I misunderstood. You should use the driver station to look at the log, pycharm doesn’t have a riolog. “Opening the Console Viewer”
You can also look at the console using python, but just use the console viewer for now.
No problem. The console viewer is what I looked at originally with no errors in it other than when we disabled the robot.
No errors? That sounds suspicious. Can you show the output you do see?
Message console is completely empty whenever we enable the robot. Dashboard says Inavlid Camera Name - USB Camera 0
Did you deploy your robot code to the robot? The console definitely shouldn’t be empty.
Nothing in the console log while the robot is enabled. Not in warnings, prints, or Detail tags.
The warnings prints or details won’t necessarily show anything. You need to view the separate console log window.
As an alternative, you can pass the
--nc argument to your deploy command and it will show the console output.
“Camera server Library not found” was an error we had after I did --nc
Then you have not installed robotpy-cscore on the robot yet. See https://robotpy.readthedocs.io/en/stable/install/cscore.html