This repository has been archived by the owner on Jan 5, 2019. It is now read-only.
Respawn usb_cam_node after crash caused by usb port reconnection improve get_topic_data message and error handling #339
+36
−22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The usb_cam_node driver crashes frequently because the USB port loses connection with the camera and the driver tries to read from it before the port gets automatically reconnected by the Raspberry Pi's OS.
You'll see an error like the following:
Note that the USB port automatically gets reconnected but not before the driver attempts a read which causes it to crash.
The errors above are generated in the usb_cam ros driver here:
which caused the process to be killed:
The simple solution is to specify the respawn = "true" attribute for the usb_cam_node in the launch file so that if it crashes ROS will automatically restart it.
This seems to work well as evidenced by the roslaunch log file:
It's not clear why the USB ports disconnect in the first place but since they get automatically reconnected this will mitigate the crash of the USB camera driver. We should still seek the root cause of the Raspberry Pi's USB ports in this regard.