Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running usb_cam_node does not give proper feedback when using a video device without proper permissions #285

Closed
lukas-czy opened this issue Oct 25, 2023 · 1 comment · Fixed by #286

Comments

@lukas-czy
Copy link

Issue Description
When attempting to run the usb_cam_node with a /dev/video device without the necessary permissions, the node fails and crashes. The problem lies in the error handling, as the exception is not adequately handled, resulting in a vague error message.

Current Behavior
The current log output when starting the node without proper permission is as follows:

❯ ros2 run usb_cam usb_cam_node_exe
[INFO] [1698243801.072328729] [usb_cam]: camera_name value: default_cam
[WARN] [1698243801.072534313] [usb_cam]: framerate: 30.000000
[INFO] [1698243801.073781020] [usb_cam]: using default calibration URL
[INFO] [1698243801.073798354] [usb_cam]: camera calibration URL: file:///home/vm/.ros/camera_info/default_cam.yaml
[ERROR] [1698243801.073881770] [camera_calibration_parsers]: Unable to open camera calibration file [/home/vm/.ros/camera_info/default_cam.yaml]
[WARN] [1698243801.073921020] [usb_cam]: Camera calibration file /home/vm/.ros/camera_info/default_cam.yaml not found
[INFO] [1698243801.073936645] [usb_cam]: Starting 'default_cam' (/dev/video0) at 640x480 via mmap (yuyv) at 30 FPS
terminate called after throwing an instance of 'char*'
[ros2run]: Aborted

Proposed Solution
Notice: I am not a skilled c++ Developer, so I might be wrong
It appears that a potential solution could involve modifying the usb_cam_node.cpp file. Specifically, you might consider adding a try-catch block around the code segment between line 148 and 156. This try-catch block should provide a more informative error message for cases where proper permissions are lacking.

@flynneva
Copy link
Collaborator

Fixed with #286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants