Skip to content

[RFC] ExecuTorch for ROS 2: a rosdep package, an inference node and a ros2_control controller #24819

Open

Description

@shoumikhin

Summary

ROS 2 (Robot Operating System 2) is how most robots connect their parts. Camera drivers, models and motor controllers run as separate nodes and exchange messages. Today, to run an exported PyTorch policy (a .pte file) with ExecuTorch in ROS, you install the Python wheel or build ExecuTorch from source, and then write your own node.

We propose 3 pieces:

  1. executorch_vendor: the ExecuTorch C++ runtime as a ROS package, so rosdep install brings it in, the way onnxruntime_vendor does for ONNX Runtime.
  2. An inference node that loads any .pte, maps topics to the program's inputs and outputs, and keeps GPU data on the GPU.
  3. A ros2_control controller that runs a small .pte policy inside the control loop.

The problem

  • ROS installs dependencies with rosdep from released packages. ExecuTorch is not one of them. Its 1.6 wheel also requires torch==2.15.0, so installing it on a robot pulls in PyTorch, which the robot does not need ([RFC] Run a .pte from Python without PyTorch: drop the PyTorch requirement and load CUDA on demand #24820 proposes dropping that).
  • Every team writes the same node: load a program, turn messages into tensors, run it, publish the result.
  • So robot projects default to ONNX. ROS has onnxruntime_vendor for Humble through Rolling, an ONNX Runtime conversion plugin under review in rosidl_buffer_backends, and, since Nov 4, an ONNX policy controller in ros2_control_demos. NVIDIA's Isaac ROS runs TensorRT engines built from ONNX. A PyTorch user has no ExecuTorch equivalent, even though ExecuTorch runs the same policies without LibTorch on CPU, CUDA and TensorRT.

Proposal

flowchart LR
  subgraph WS["Workstation with PyTorch"]
    M["PyTorch policy"] -->|"export"| P["policy.pte"]
  end
  subgraph R["Robot running ROS 2, no PyTorch"]
    C["Camera driver"] -->|"image or tensor, GPU memory on Lyrical"| N["ExecuTorch inference node"]
    J["Joint states"] --> N
    N -->|"actions"| K["ros2_control"]
    K -->|"or: small policy runs in the controller"| A["Motors"]
    V["executorch_vendor"] -.-> N
    V -.-> K
  end
  P -.->|"copied to the robot"| N
  Z["C++ SDK archive (#24816)"] -.->|"downloaded at build time"| V
Loading

1. executorch_vendor

  • Provides the runtime and its CMake targets. One package for CPU, and a CUDA variant that adds the CUDA backend, so CPU users do not need a CUDA toolkit.
  • Downloads the C++ SDK archive proposed in [RFC] Ship the ExecuTorch C++ SDK as a standalone archive with each release, starting with 1.6.0 #24816 for the right architecture and checks a pinned SHA-256. Until that archive exists, it unpacks the C++ part of the pinned wheel, as the vendor packages in ros2/rosidl_buffer_backends#36 already do.
  • An optional TensorRT package with the ExecuTorch TensorRT delegate from Torch-TensorRT 2.15 (torch-tensorrt-executorch-runtime), without PyTorch or Torch-TensorRT itself.
  • Released for Humble, Jazzy, Lyrical and Rolling. A package name can come from only one repository per ROS distribution, so these packages need one home (see "Where the code lives").

2. Inference node

  • A C++ lifecycle node, also registered as a component. It can share a process with a camera driver and receive messages without copies. It loads and warms up the program in on_configure and opens topics in on_activate.
  • Tensor mode: tensors in, tensors out, with isaac_ros_tensor_msgs/TensorList and the parameter names of the Isaac ROS TensorRT node where they apply. So the ExecuTorch node can replace that node in an existing graph.
  • Policy mode: read the policy's description of its observations and actions, map observations to topics (camera images, JointState), keep a queue of actions, and publish one per control tick. The description format should follow what LeRobot adopts for its export.
  • Backends: XNNPACK and CUDA built in. Delegates that ship outside ExecuTorch, like TensorRT, load at run time from a parameter.
  • GPU messages: on Lyrical and Rolling, the node uses ExperimentalTensor with the CUDA buffer backend, through the conversions in rosidl_buffer_backends#36, so camera frames and actions stay in GPU memory. On Jazzy and Humble, it uses ordinary messages.
  • Tests: a launch test that runs a small .pte on CPU, and a CUDA test that skips without a GPU.

3. ros2_control controller

Small reinforcement learning policies, like walking and balance, run hundreds of times a second inside the controller's update(). A separate node adds latency there, so a controller plugin runs the .pte on XNNPACK inside the loop. It follows the ONNX controller in the demos (example 18, Open Duck Mini walking) and keeps the robot-specific observation code out of the generic part. On small policies like these, ExecuTorch with XNNPACK had about the same latency as ONNX Runtime in our tests on Jetson Thor, Jetson Orin Nano and x86, with about 4x less memory and more than 10x faster loading.

How people use it

Package and launch names are placeholders.

Install, with executorch_vendor listed in your package.xml:

rosdep install --from-paths src --ignore-src -y
colcon build

Run an exported policy on CUDA:

executorch_node:
  ros__parameters:
    model_file_path: /models/policy/model.pte
    data_file_paths: [/models/policy/aoti_cuda_blob.ptd]
    input_topics: [/camera/image, /joint_states]
    output_topics: [/policy/action]
ros2 launch executorch_ros executorch_node.launch.py params_file:=policy.yaml

To replace an Isaac ROS TensorRT node, keep its TensorList topics and parameters, and point the node at a .pte exported with the TensorRT delegate.

Plan

  1. Agree where the code lives.
  2. Release the vendor packages for Rolling and Lyrical, then Jazzy and Humble.
  3. Build the controller and check it with a small walking policy on XNNPACK.
  4. Build tensor mode of the node, with launch files, tests and docs.
  5. Add policy mode and check it with an ACT policy on CUDA.
  6. Add the TensorRT package and check the same ACT policy on TensorRT with CUDA.
  7. Switch the vendor download to the C++ SDK archive once [RFC] Ship the ExecuTorch C++ SDK as a standalone archive with each release, starting with 1.6.0 #24816 ships.

Scope

  • Linux on x86_64 and aarch64, where ROS ships binaries. CUDA where the ExecuTorch CUDA build supports it.
  • The node runs programs. Export stays on a machine with PyTorch.
  • No new message types. The node uses existing ROS messages and the experimental tensor message.

Where the code lives

We suggest a separate repository in the pytorch organization, for example pytorch/executorch_ros, with a CI job in this repository that builds it against the current runtime. ExecuTorch already did this for Arduino (meta-pytorch/executorch-arduino), and it is how onnxruntime_vendor ships.

Option For Against
Separate repository released through the ROS build farm like onnxruntime_vendor; a layout ROS developers know a second repository to maintain
extension/ros in this repository close to the runtime; tested by ExecuTorch CI bloom imports the whole large repository at each release; source builds need --base-paths extension/ros, because colcon sees the root setup.py; ROS releases follow ExecuTorch's cycle
Inside rosidl_buffer_backends already the home of the GPU message conversions Lyrical and Rolling only; a general node is not that repository's job

The GPU message conversions stay in rosidl_buffer_backends in every case.

Open questions

  1. Separate repository, or extension/ros here?
  2. Should we support Humble? Its Ubuntu ships CMake 3.22, while the ExecuTorch CMake targets need 3.28 (3.19 works through the EXECUTORCH_* variables).
  3. Which observation and action description should policy mode read? Should it follow the data collection and inference contract that the ROS Physical AI SIG working groups plan to write?
  4. Who maintains the vendor package releases in rosdistro?
  5. On Jetson, should the TensorRT package use the TensorRT that JetPack installs, or the version the delegate was built for? They can differ, and a TensorRT engine only loads with the version that built it.

Activity

  1. digantdesai commented on Nov 10, 2026

    @digantdesai
    Contributor

    FWIW, we did the #2 (second repo) for Arduino - https://github.com/meta-pytorch/executorch-arduino

  2. changed the title [-][RFC] ExecuTorch for ROS 2: an installable runtime package and a general inference node[/-] [+][RFC] ExecuTorch for ROS 2: a rosdep package, an inference node and a ros2_control controller[/+] on Nov 14, 2026
  3. shoumikhin commented on Nov 19, 2026

    @shoumikhin
    ContributorAuthor

    I tried the tensor mode from section 2 inside Isaac ROS: NVIDIA-ISAAC-ROS/isaac_ros_dnn_inference#69 (draft). It's an ExecuTorch node that can replace Isaac's TensorRT node in a graph, with the same topics and tensor name parameters. In Isaac ROS 5.1's DOPE graph, with only the inference node swapped:

    • Speed is a tie: 2.42 frames per second on Orin Nano and 9.26 on AGX Thor, same as the TensorRT node.
    • The container used less memory in every run.

    What I learned along the way:

    • Intra-process delivery has to be on. Without it, the encoder's GPU buffer arrived as a CPU buffer and the node copied every frame back to the GPU, which cost 2% to 3% on Orin. Isaac's nodes turn it on in code, so the general node should too.
    • JetPack's TensorRT 10.16 and the pip TensorRT 11.4 export functions with the same names and no symbol versions, so they can't share a process. The TensorRT package in section 1 should say so.
    • In a multi-threaded container, callbacks move between threads, so the node needs its own CUDA stream.

    I think the PR is a good starting point for the general node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions