ros2-web-integration

Integrate ROS2 systems with web technologies using rosbridge, FastAPI, Flask, and WebSocket bridges.

Updated Aug 16, 2026
One-click install
npx skills add https://github.com/three1324/yeonjinautomotive --skill ros2-web-integration-three1324
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ros2-web-integration
Source: https://github.com/three1324/yeonjinautomotive/tree/main/.claude/skills/ros2-web-integration
Command: npx skills add https://github.com/three1324/yeonjinautomotive --skill ros2-web-integration-three1324

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires rclpy, fastapi, uvicorn, flask, pydantic.

What problem does it solve? Connecting a ROS2 robot to browsers and web clients requires choosing between rosbridge_suite and custom bridges, managing two event loops (rclpy and an async web server) without deadlocks, and handling streaming, authentication, and rate limiting correctly. This Skill provides tested patterns and working code for each approach. ## Core Features & Use Cases - Bridge Selection Guidance: Compares rosbridge_suite, custom FastAPI, and Flask bridges across latency, throughput, auth, and production readiness so you pick the right architecture. - Complete Integration Code: Includes a thread-safe ROS2 node with shared state, FastAPI WebSocket/REST endpoints, MJPEG and binary WebSocket video streaming, teleop with a safety watchdog, and a token-bucket rate limiter. - Use Case: You need a browser dashboard showing a live camera feed and odometry from a robot, plus a virtual joystick publishing to /cmd_vel. Use the FastAPI pattern: spin rclpy in a background thread, serve uvicorn in the main thread, stream JPEG frames over WebSocket, and enforce a 500ms command timeout watchdog. ## Quick Start Ask the assistant to set up a FastAPI web bridge that streams my robot's compressed camera topic to a browser and exposes a REST endpoint for sending cmd_vel commands.

Frequently Asked Questions about ros2-web-integration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stream a ROS2 camera feed to a web browser?

Stream compressed image topics over WebSocket as base64 JSON or binary frames, or serve an MJPEG endpoint that works directly in an <img> tag. For lowest latency, use the webrtc_ros package with WebRTC.

Should I use rosbridge_suite or a custom FastAPI bridge for ROS2?

Use rosbridge_suite for quick prototyping and foxglove integration where security is not a concern. Use a custom FastAPI bridge when you need authentication, rate limiting, selective topic exposure, or production deployment.

How do I run FastAPI and rclpy in the same process?

Spin rclpy in a background daemon thread using a MultiThreadedExecutor, then run uvicorn in the main thread. Coordinate shutdown with signal handlers that stop the executor, destroy the node, and call rclpy.shutdown.

What are the limitations of rosbridge_suite?

rosbridge serializes all messages to JSON, adding roughly 30 percent overhead for base64 images, exposes the entire topic graph without filtering, runs on a single Tornado event loop, and offers only minimal MAC-based authentication via rosauth.

How do I prevent a robot from running away when a web teleop client disconnects?

Implement a watchdog that publishes zero velocity if no command arrives within a timeout such as 500 milliseconds, and always send a zero cmd_vel on WebSocket disconnect. Clamp incoming linear and angular values to safe ranges.