Skip to content

ROS2: GPU/NVEncoder Acceleration#20

Closed
Owen-Liuyuxuan wants to merge 4 commits intogalacticfrom
jetson_process
Closed

ROS2: GPU/NVEncoder Acceleration#20
Owen-Liuyuxuan wants to merge 4 commits intogalacticfrom
jetson_process

Conversation

@Owen-Liuyuxuan
Copy link

@Owen-Liuyuxuan Owen-Liuyuxuan commented May 21, 2024

This PR is the ROS2 refinement of #11.

It is still under-test.

Basic idea

  • Break ros2_v4l2_camera as two standalone packages. (If we further stress on efficiency instead of flexibility, we should consider merging them in the future).
  • The ros2_v4l2_camera stays the same as in the main. But I do not recommend launching the camera drivers with image_transport (which automatically use CPU encoding).
  • The new gpu_imgproc is the ROS2 refreshment of the ROS1 - GPU acceleration #11 .

Parameteres and Topics Changes:

Topics Direction Launch Parameters Description
/image_raw subscribe ${input_image_topic} Input raw image with RGB8 encoding sensor_msgs/Image
/camera_info subscribe ${camera_info_topic} The camera calibration information sensor_msgs/CameraInfo
/image_raw/compressed publish ${input_image_topic}/compressed The compressed output sensor_msgs/CompressedImage
/image_rect publish ${input_image_topic}/image_rect The rectified raw image sensor_msgs/Image
/image_rect/compressed publish ${input_image_topic}/image_rect/compressed The output compressed rectified image sensor_msgs/CompressedImage
Parameters default Description
rect_impl npp select rectifier implementation from npp, opencv_cpu, opencv_gpu.
use_opencv_map_init False select implementation of rectifier mapping, from OpenCV or NPP
alpha 0.0 The free scaling parameter for rectification; see OpenCV Documentation
input_image_topic image_raw Input image topic, will also influence the output
camera_info_topic camera_info Input camera info topic

Test going to implement:

  • As part of integration research, we will test the code on work on both x64 CPUs but also on Jetson machines. The base platform will be the Adlink ROSCube 580&58g.
  • We are first going to make sure we are actually using GPU/NVEncoder to compress the data.
  • Then we will benchmark the results.
  • Hopefully, all ROSCube/Orin-related projects should be using the GPU encoder instead of the CPU encoder.

Quick Testing Use of this PR:

# Beforehand, set up ROS2 download/paths and CUDA download/paths;
# Then under a workspace
cd  src
git clone --branch galactic https://github.com/tier4/ros2_v4l2_camera.git
git clone jetson_process
cd ../
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

Testing:

image

  • Firstly, it works on ROSCube 58g and it boosts up NVJPEG.
  • Comparing the decompressing capability of image_transport and our PR. Testing against 20Hz of 1920*1440 image streams. ROS2 image_transport will use 60%-80% of CPU. This PR uses 20%-30% of CPU. We can see a significant reduction on the CPU time.

HinsRyu added 2 commits May 21, 2024 17:59
Signed-off-by: Yuxuan Liu <uken.ryu.2@tier4.jp>
Signed-off-by: Yuxuan Liu <uken.ryu.2@tier4.jp>
@Owen-Liuyuxuan
Copy link
Author

With the new commit, I have tested with x86-64 computers and the decompress process works well. (At least it is not dying and libturbojpeg works fine)

Signed-off-by: Yuxuan Liu <uken.ryu.2@tier4.jp>
@Owen-Liuyuxuan Owen-Liuyuxuan marked this pull request as ready for review May 22, 2024 02:40
@Owen-Liuyuxuan Owen-Liuyuxuan requested a review from kentdotn May 22, 2024 02:41
Signed-off-by: Yuxuan Liu <uken.ryu.2@tier4.jp>
@Owen-Liuyuxuan
Copy link
Author

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 this pull request may close these issues.

2 participants