OpenAgricultureFoundation / openag_brain

ROS package for controlling an OpenAg food computer
GNU General Public License v3.0
221 stars 68 forks source link

usb_cam node crashes when device name changes #178

Open sp4ghet opened 7 years ago

sp4ghet commented 7 years ago

This is related to #166 in that it is naiive to assume the camera will always be on /dev/video0 and it will sometimes change to /dev/video1. This causes the node to crash like so:

[ERROR] [1494445358.751953273]: VIDIOC_DQBUF error 19, No such device
[environments/environment_1/aerial_image-16] process has died [pid 27197, exit code 1, cmd /home/pi/catkin_ws/devel_isolated/usb_cam/lib/usb_cam/usb_cam_node __name:=aerial_image __log:=/home/pi/.ros/log/03c461d6-35b4-11e7-8b52-b827eb8ab0fe/environments-environment_1-aerial_image-16.log].
log file: /home/pi/.ros/log/03c461d6-35b4-11e7-8b52-b827eb8ab0fe/environments-environment_1-aerial_image-16*.log
sp4ghet commented 7 years ago

There's a different error which requires you unplug the camera and replug it. It give something related to select timout which seems to be a fairly common OpenCV/Linux bug

sp4ghet commented 7 years ago

https://raspberrypi.stackexchange.com/questions/12246/why-does-usb-port-enumeration-change

Reading through this

sp4ghet commented 7 years ago

http://rolfblijleven.blogspot.nl/2015/02/howto-persistent-device-names-on.html

Using the hard-wired device ID to determine the /dev/ name seems to be the way to go.

alexwbots commented 5 years ago

Thanks man! It help me a lot!