ros-drivers / pointgrey_camera_driver

ROS driver for Pt. Grey cameras, based on the official FlyCapture2 SDK.
128 stars 180 forks source link

Fails to reconnect to camera when it is re-plugged in, or is plugged in after startup of the node #209

Open ksoltan opened 2 years ago

ksoltan commented 2 years ago

Hi there, I have two use cases under which I've noticed some inconsistencies with the pointgrey_camera_driver. For each of these cases, I am running roslaunch pointgrey_camera_driver camera.launch camera_serial:=20051769, and also running rostopic hz /camera/image_raw to ensure the camera is capturing.

  1. Starting up the camera nodelet before the camera is plugged in. On startup, I get the following expected error:

    [PointGreyCameraNodelet::paramCallback():149]: Reconfigure Callback failed with error: PointGreyCamera::connect Could not find camera with serial number: 20051769. Is that camera plugged in? | FlyCapture2::ErrorType 19 Failed to get the camera from the serial number.

    After I plug in the camera, I can see with rosrun pointgrey_camera_driver list_cameras that the correct camera is listed. However, the camera nodelet continues to produce the same error as before. At this point, I am still subscribed to the raw_image topic, and it looks like in the devicePoll() loop, it recognizes it is in DISCONNECTED state and fails in the connect() function. When I restart the camera nodelet (the camera remains connected), it successfully connects to the camera. Note: unsubscribing and resubscribing to the image_raw topic does not help in this case, as it does in the next use case.

  2. Unplugging and re-plugging the camera while the pointgrey_camera_driver node is running. The first time I unplug the camera, I get the following error:

    [/camera/right/camera_nodelet_manager] [1627670881.835880407] [ERROR] [PointGreyCameraNodelet::devicePoll():548]: PointGreyCamera::getCameraTemperature Could not get property. | FlyCapture2::ErrorType 28 Feature register read failed.

    At this point, the state in the devicePoll() loop changes to ERROR, then STOPPED, then to DISCONNECTED. When I subsequently plug the camera back in, it connects and resumes publishing the image_raw. However, when I unplug it AGAIN, and on consequent repeats of this test, I get this warning instead of the error:

    [PointGreyCameraNodelet::devicePoll():540]: PointGreyCamera: Failed to retrieve buffer within timeout.

    The state in the devicePoll() loop remains as STARTED. The only way I've been able to force a reconnection here is to unsubscribe from the image_raw topic, and subscribing again.

I am using a Blackfly BFLY-PGE-23S6C with version 0.15.0 of pointgrey_camera_driver. Am I missing something? Is this intended behavior? It clearly recognizes that the camera is available, but the nodelet does not seem to handle this. Any help would be greatly appreciated, thank you!