space-concordia-robotics / robotics-prototype

Teleoperated Mars rover with autonomous capabilities intended for robotics competitions.
https://spaceconcordia.github.io/robotics.html
25 stars 18 forks source link

Camera request feedback does not handle device busy error case #518

Closed PeterGhimself closed 1 year ago

PeterGhimself commented 3 years ago

Steps to reproduce

Testing this locally should go along the lines of:

  1. start local_rover process and startgui + rosgui
  2. start your webcam streaming on whatever platform other than our GUI
  3. try to request the webcam to turn on in our GUI: note how the console log on the GUI will say that the stream started succesfully

What should happen instead is that the error message that is already caught in the backend should be forwarded as the response to the client.

Sample output

From the error messages from local_rover process, when triggering this issue:

Attempting to start listener service...
/home/beep/Programming/robotics-prototype/robot/rospackages/src/task_handler/scripts/start_ros_stream.sh: line 4: v4l2-ctl: command not found
Assigned process id: 13369
VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Unable to stop the stream: Device or resource busy
[ERROR] [1613851718.446077295]: cv camera open failed: device_path /dev/video0 cannot be opened
[video0Cam-1] process has died [pid 13386, exit code 1, cmd /home/beep/Programming/robotics-prototype/robot/rospackages/devel/lib/cv_camera/cv_camera_node __name:=video0Cam __log:=/home/beep/.ros/log/24ec5298-73b7-11eb-bcc7-8cec4b23e11a/video0Cam-1.log].
log file: /home/beep/.ros/log/24ec5298-73b7-11eb-bcc7-8cec4b23e11a/video0Cam-1*.log
[ INFO] [1613851718.931521381]: Handling Request: /stream?topic=/video0Cam/image_raw
[ INFO] [1613851719.246761499]: Removed Stream: /video0Cam/image_raw