robotpy / robotpy-cscore

Moved to https://github.com/robotpy/mostrobotpy
Other
17 stars 12 forks source link

Cameras don't want to reconnect on Pi Reboot. #38

Closed Daltz333 closed 5 years ago

Daltz333 commented 6 years ago

Info: Raspberry Pi3 2 USB Camera Server using the example Script RoboRIO is Java Cameras are Logitech C270s

Issue: CameraServer script starts up on bootup and runs normally, sending camera info. The issue is when the Pi rebooted via 'sudo reboot now' or by quickly turning the robot on and off, it refuses to initialize the second camera. It can be fixed by unplugging the second camera and plugging it back in. Or by turning the robot off, unplugging the battery, waiting a few seconds and turning it back on I an willing to send bug reports if told how to.

virtuald commented 6 years ago

Are there error messages of any kind?

Daltz333 commented 6 years ago

I can't tell. It only does it on startup and I don't have any logging set up. When I return it manually to see console messages, everything works. I doubt it's my startup script.

Daltz333 commented 6 years ago

Correction: When I re-run it manually

Daltz333 commented 6 years ago

Issue is duplicated on a second Pi. Also it only does it to the second camera initialized. If camera 2 becomes camera 1, and the original cam 1 is can 2. Then the new cam 2 is the one not initial. Aka the second one initialized in the example usb script.

virtuald commented 6 years ago

Take a look at the output of dmesg and see if there are any error messages.

It's also possible that the video subsystem just hasn't initialized by the time cscore starts. You could try adding in a 5 second sleep (not ideal), or see if there's a way to determine if video has been fully initialized before you start using the camera.

virtuald commented 5 years ago

Did you ever find out more information about this? Otherwise I'm just going to close it.

Daltz333 commented 5 years ago

I was not able to find any information on it. Because it happened so sporadically and at the competition I was always in such a rush. I'll reopen if I get any more information.