cyberbotics / epuck_ros2

ROS2 node for the e-puck robot and its simulation model
https://cyberbotics.com/doc/guide/epuck
Apache License 2.0
57 stars 19 forks source link

Fix camera `/image_raw` topic #15

Closed lukicdarkoo closed 4 years ago

lukicdarkoo commented 4 years ago

Describe the Bug Topic image_raw/compressed publishes compressed image, however, there is a problem with image_raw. In order to be published, the image has to be converted from YUV to RGB and optionally resized. Unfortunately, the GPU block for image conversion is SISO (Single Input Single Output) and therefore, GPU cannot facilitate image_raw/compressed and image_raw simultaneously. Currently, it tries to use CPU for the conversion, but this approach is CPU intensive and also, OpenCV fails to perform the conversion.

There are two possible solutions:

I would prefer the second option since it is unlikely both topics will be used simultaneously. Furthermore, using the two topics simultaneously can cause very high CPU usage.

Steps to Reproduce Subscribe to image_raw topic

Expected behavior User should be able to receive an image from image_raw topic.

omichel commented 4 years ago

I agree the second solution is the best. It should however be clearly documented that only one topic can be used at a time and possibly display a warning or an error if the user tries to use two topics simultaneously.

DavidMansolino commented 4 years ago

Just for the note, a new node for the raspberrypi camera was released (ROS1), it would be nice to see if we are close to it (topics names, open parameters, etc): https://discourse.ros.org/t/raspberry-pi-camera-node/1388 For example, it would be interesting to publish the camera_info topic.

lukicdarkoo commented 4 years ago

Just for the note, a new node for the raspberrypi camera was released (ROS1), it would be nice to see if we are close to it (topics names, open parameters, etc): https://discourse.ros.org/t/raspberry-pi-camera-node/1388

Yes, raspicam_node is available for ROS2 as well (https://github.com/christianrauch/raspicam2_node), we have already considered it. But, the camera on e-puck2 doesn't use Raspberry Pi Camera (OV760 instead) and it is not connected through standard CSI port (but through onboard MCU). All this makes raspicam_node unusable for our use case. We also confirmed this with GCtronic.

For example, it would be interesting to publish the camera_info topic.

Sure, I will add an issue or implement it with the next camera-related PR. It is already implemented in webots_ros2_epuck2 (https://github.com/cyberbotics/webots_ros2/blob/64d48a40b6b687f7759a1ec4ec45c6cbd703d252/webots_ros2_epuck2/webots_ros2_epuck2/driver.py#L372)

DavidMansolino commented 4 years ago

Yes, raspicam_node is available for ROS2 as well (https://github.com/christianrauch/raspicam2_node), we have already considered it. But, the camera on e-puck2 doesn't use Raspberry Pi Camera (OV760 instead) and it is not connected through standard CSI port (but through onboard MCU). All this makes raspicam_node unusable for our use case. We also confirmed this with GCtronic.

Yes of course I am not saying we should use it, but just to be 'compatible' with it as much as possible.