Difference Between ROS2 and Zenoh

FeatureROS 2Zenoh
PurposeFull robotics framework (pub/sub, services, actions, params)Middleware for data communication
Connection LayerDDS (Data Distribution Service)Lightweight protocol (UDP, TCP, QUIC, etc.)
Use CaseComplete robot software stackEfficient, flexible data exchange
PC-to-Robot CommunicationNative but brittle across networksRobust and NAT-friendly
Real-Time SupportDDS supports it, but can be heavyLightweight and real-time-friendly
Bandwidth EfficiencyDDS can be verboseHighly optimized for low-bandwidth and lossy networks

Detailed Comparison

1. Design Philosophy

  • ROS 2: Full robotic framework, includes message passing, services, parameters, lifecycle management.
  • Zenoh: Focused on data movement — pub/sub, querying, storage. Built for flexible networking and performance.

2. PC ↔ Robot Communication

ScenarioROS 2Zenoh
LAN (same subnet)Works well with default DDS discoveryWorks well (via multicast or peer config)
Different subnets / NATFails by default unless tunedWorks out of the box, NAT/firewall friendly
Wireless / Mobile RobotPerformance issues possibleDesigned for low latency / jitter
Partial ConnectivityFragileZenoh can cache/store-forward

3. Resource Usage

  • ROS 2 + DDS: Can be heavy, not ideal for constrained devices.
  • Zenoh: Lightweight, written in Rust/C++, supports embedded and microcontroller platforms.

4. Use Together?

Yes! Use zenoh-bridge-ros2:

  • Bridge ROS 2 topics to/from Zenoh
  • Enable remote and reliable communication

Recommendation: PC ↔ Robot Setup

ConditionSuggestion
Same subnet (LAN)Use ROS 2 directly (Fast DDS, etc.)
Remote, across networks or mobileUse Zenoh to bridge ROS 2
Low-bandwidth or unstable networksPrefer Zenoh for reliability

Example Use Case

Scenario:
Robot runs ROS 2 on Ubuntu, PC is remote or on a cloud/VPN network. Direct ROS 2 connection fails.

Use zenoh-bridge-ros2:

  • Robot publishes sensor_msgs/Image
  • Zenoh relays data to PC through NAT/firewall