Table of Contents
Fetching ...

ROS2WASM: Bringing the Robot Operating System to the Web

Tobias Fischer, Isabel Paredes, Michael Batchelor, Thorsten Beier, Jesse Haviland, Silvio Traversaro, Wolf Vollprecht, Markus Schmitz, Michael Milford

TL;DR

This work tackles the challenge of accessibility and reproducibility in ROS-based robotics by enabling ROS 2 to run directly in web browsers through WebAssembly. It introduces a three-part methodology: a browser-native middleware (rmw-wasm), a cross-compilation workflow extending RoboStack to WASM, and web integration via JupyterLite, complemented by adaptations of the Robotics Toolbox for Python and the Swift simulator to WASM. The authors demonstrate full-stack browser demonstrations and even a bridge to a non-ROS robot via Web Bluetooth, highlighting potential applications in education, research, and industry. The study showcases the feasibility of install-free, sandboxed, scalable, and secure browser-based ROS environments and outlines future directions such as Zenoh integration and GUI-tool porting to the browser.

Abstract

The Robot Operating System (ROS) has become the de facto standard middleware in robotics, widely adopted across domains ranging from education to industrial applications. The RoboStack distribution, a conda-based packaging system for ROS, has extended ROS's accessibility by facilitating installation across all major operating systems and architectures, integrating seamlessly with scientific tools such as PyTorch and Open3D. This paper presents ROS2WASM, a novel integration of RoboStack with WebAssembly, enabling the execution of ROS 2 and its associated software directly within web browsers, without requiring local installations. ROS2WASM significantly enhances the reproducibility and shareability of research, lowers barriers to robotics education, and leverages WebAssembly's robust security framework to protect against malicious code. We detail our methodology for cross-compiling ROS 2 packages into WebAssembly, the development of a specialized middleware for ROS 2 communication within browsers, and the implementation of https://www.ros2wasm.dev, a web platform enabling users to interact with ROS 2 environments. Additionally, we extend support to the Robotics Toolbox for Python and adapt its Swift simulator for browser compatibility. Our work paves the way for unprecedented accessibility in robotics, offering scalable, secure, and reproducible environments that have the potential to transform educational and research paradigms.

ROS2WASM: Bringing the Robot Operating System to the Web

TL;DR

This work tackles the challenge of accessibility and reproducibility in ROS-based robotics by enabling ROS 2 to run directly in web browsers through WebAssembly. It introduces a three-part methodology: a browser-native middleware (rmw-wasm), a cross-compilation workflow extending RoboStack to WASM, and web integration via JupyterLite, complemented by adaptations of the Robotics Toolbox for Python and the Swift simulator to WASM. The authors demonstrate full-stack browser demonstrations and even a bridge to a non-ROS robot via Web Bluetooth, highlighting potential applications in education, research, and industry. The study showcases the feasibility of install-free, sandboxed, scalable, and secure browser-based ROS environments and outlines future directions such as Zenoh integration and GUI-tool porting to the browser.

Abstract

The Robot Operating System (ROS) has become the de facto standard middleware in robotics, widely adopted across domains ranging from education to industrial applications. The RoboStack distribution, a conda-based packaging system for ROS, has extended ROS's accessibility by facilitating installation across all major operating systems and architectures, integrating seamlessly with scientific tools such as PyTorch and Open3D. This paper presents ROS2WASM, a novel integration of RoboStack with WebAssembly, enabling the execution of ROS 2 and its associated software directly within web browsers, without requiring local installations. ROS2WASM significantly enhances the reproducibility and shareability of research, lowers barriers to robotics education, and leverages WebAssembly's robust security framework to protect against malicious code. We detail our methodology for cross-compiling ROS 2 packages into WebAssembly, the development of a specialized middleware for ROS 2 communication within browsers, and the implementation of https://www.ros2wasm.dev, a web platform enabling users to interact with ROS 2 environments. Additionally, we extend support to the Robotics Toolbox for Python and adapt its Swift simulator for browser compatibility. Our work paves the way for unprecedented accessibility in robotics, offering scalable, secure, and reproducible environments that have the potential to transform educational and research paradigms.
Paper Structure (13 sections, 8 figures, 1 table)

This paper contains 13 sections, 8 figures, 1 table.

Figures (8)

  • Figure 1: Execution of a ROS 2 publisher and subscriber setup within a Jupyter Notebook environment running entirely in the browser, with no local installation required (www.ros2wasm.dev). The notebook creates publishers for topics topic_a and topic_b, as well as two minimal subscribers listening to these topics. The log output at the bottom shows the concurrent execution of these nodes, with messages being published and received, verifying seamless communication between ROS 2 nodes directly within the browser-based interface.
  • Figure 2: Overview of the pipeline for compiling C/C++ source code into WebAssembly (WASM) using Emscripten. The process begins with the C/C++ source code (e.g., talker.cpp), which is passed through the Emscripten compiler. Emscripten converts this source code into three primary outputs: a WebAssembly module (talker.wasm), an HTML document (talker.html) that serves as the interface to load and run the WASM module, and JavaScript glue code (talker.js) that manages the interaction between the WebAssembly module and the web environment. This pipeline allows native C/C++ applications to be executed in the browser, offering near-native performance and seamless integration with web technologies.
  • Figure 3: Architecture of the rmw-wasm middleware enabling ROS 2 communication in the browser. The system comprises three main components: rmw-wasm-cpp (interfaces ROS 2 packages with the WebAssembly-based middleware), wasm-cpp (the C++ core that processes messages and communicates with JavaScript), and wasm-js (manages network participants and message traffic within the browser). Communication between wasm-cpp and wasm-js is facilitated by emscripten::val, allowing seamless integration between C++ and JavaScript.
  • Figure 4: Class diagram of the wasm-cpp package, showing the relationships between ROS 2 entities. The Participant class is the base, with Publisher, Subscriber, ServiceServer, and ServiceClient as derived classes. Each class handles specific ROS 2 functions, such as publishing, subscribing, and managing service requests and responses, enabling communication within the WebAssembly environment.
  • Figure 5: Data flow between a ROS service client and server within wasm-cpp. The service client initiates a request by publishing to the /request_topic, which is received by the service server's subscriber. The server processes the request and then publishes a response to the /response_topic, which is received by the client's subscriber. This setup demonstrates how service clients and servers in ROS are built on top of publisher-subscriber pairs, ensuring communication via specific request and response topics.
  • ...and 3 more figures