Skip to content

add robot arm demo#1

Open
yuanknv wants to merge 8 commits intoros2:mainfrom
yuanknv:native_buffer_demo
Open

add robot arm demo#1
yuanknv wants to merge 8 commits intoros2:mainfrom
yuanknv:native_buffer_demo

Conversation

@yuanknv
Copy link
Copy Markdown

@yuanknv yuanknv commented Apr 10, 2026

Description

Add an end-to-end robot arm demo to utilize the rosidl_buffer_backends. The demo is a two-node ROS 2 application where a renderer node renders an SDF-based pencil-sketch robot arm animation entirely on the GPU via pure torch and publishes BGRA frames as sensor_msgs/msg/Image, while a display node subscribes and presents them in an SDL2/OpenGL window.

It demonstrates the torch_buffer_backend with CUDA zero-copy IPC against the default transport (no buffer backend). For the CUDA path, data stays on the GPU across processes. For the default path, frames are copied to host and go through standard ROS 2 middleware.

The benchmark shows around 3-6x throughput improvement with zero-copy over the default path: ~117 vs ~36 fps at 1080p, ~91 vs ~21 at 1440p, and ~60 vs ~10 at 4K on an RTX 3090.

Fixes # (issue)

Is this user-facing behavior change?

Did you use Generative AI?

Yes. Claude (claude-4.6-opus) via Cursor was used to assist with creating an initial prototype version of the changes contained in this PR.

Additional Information

This PR is part of the broader ROS 2 native buffer feature introduced in this post.

Copy link
Copy Markdown

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Add CONTRIBUTION.md and LICENSE
  • Add common linters
  • Add full license header in file

Comment thread robot_arm_demo/launch/robot_arm_compare.launch.py Outdated
Comment thread robot_arm_demo/src/display.h Outdated
Comment thread robot_arm_demo/src/display.h Outdated
Comment thread robot_arm_demo/src/display.h Outdated
Comment thread robot_arm_demo/src/display_node.cpp Outdated
Comment thread robot_arm_demo/src/display_node.cpp
Comment thread robot_arm_demo/package.xml
Comment thread README.md Outdated
Comment on lines +25 to +26
- [rcl_buffer_ws](https://github.com/yuanknv/ros2) workspace with `pixi`
- LibTorch (see [torch_buffer_backend prerequisites](https://github.com/yuanknv/torch_buffer_backend#prerequisites))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we place this information in ros2/ repositories ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now out of date since we already have the libtorch_vendor package inside the rosidl_buffer_backends

Comment thread robot_arm_demo/package.xml
Comment thread README.md Outdated
Comment thread README.md Outdated

### Dependencies

- [rcl_buffer_ws](https://github.com/yuanknv/ros2) workspace with `pixi`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should assume to use the ros2/ros2 but not the pixi-patched one.
We should also list out key packages like cuda_buffer_backend and torch_buffer_backend, in addition to the ros2/ros2 repo, which will be helpful as a tutorial to show what are being tested here.

Comment thread README.md Outdated
Comment on lines +35 to +39
# 1. Build CUDA device backend
pixi run build cuda_buffer_backend

# 2. Build the demo
pixi run build robot_arm_demo
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not use pixi commands as they are not in the rolling branch in ros2/ros2.
Let's use plain colocon build commands in this tutorial.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the readme to use rosdep and colcon to build and verified in the pixi shell.

yuanknv and others added 6 commits April 15, 2026 23:03
Thanks for the suggestion, all applied

Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Signed-off-by: yuanknv <113960800+yuanknv@users.noreply.github.com>
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.

3 participants