Skip to main content

Communication library using Zenoh with ROS-like functionality

Project description

DexComm - Zenoh-based Communication Library

A high-performance communication library built on top of Zenoh, providing three levels of abstraction for distributed systems. Designed for robotics and real-time applications.

Features

  • Three Abstraction Levels:
    • Raw API: Direct publisher/subscriber for simple scripts
    • Node Pattern: ROS-like component organization with namespaces
    • Manager Pattern: Dynamic topic management for gateways and monitoring
  • Shared Session Management: Efficient resource usage with singleton Zenoh session
  • High-Precision Rate Limiting: Nanosecond-precision rate control with adaptive processing compensation
  • Flexible Configuration: Support for all Zenoh configuration options with config file loading
  • Quality of Service: Configurable reliability, congestion control, and priority
  • Service Support: Request-reply pattern with timeout and async calls

Installation

pip install dexcomm

Platform Support

  • Python: 3.10, 3.11, 3.12, 3.13
  • Operating Systems: Linux, macOS, Windows
  • Architectures: x86_64, ARM64 (Apple Silicon), AArch64 (Linux)

Quick Start

Important: All imports are available directly from the dexcomm module, regardless of which pattern you use.

Choosing the Right Pattern

Use Case Recommended Pattern Why
Simple script with 1-2 topics Raw API Minimal code, direct control
Robot/device controller Node Component encapsulation, namespaces
ROS/ROS2 migration Node Familiar interface
Data logger/recorder Manager Dynamic topic management
Gateway/bridge service Manager Runtime topic addition/removal
Microservice Node Clean interfaces, lifecycle management
Quick prototype Raw API Zero boilerplate

Pattern 1: Raw API (Simplest)

from dexcomm import Publisher, Subscriber

# Create publisher anywhere in your code
pub = Publisher("sensor/temperature")
pub.publish(25.5)

# Create subscriber anywhere else
sub = Subscriber("sensor/temperature", lambda msg: print(f"Temp: {msg}°C"))

# Quick functions for one-off operations
from dexcomm import publish, wait_for_message
publish("alert", "High temperature detected!")
msg = wait_for_message("alert", timeout=1.0)

Pattern 2: Node-based (ROS-like)

from dexcomm import Node

class RobotController:
    def __init__(self):
        # Create node with namespace
        self.node = Node("controller", namespace="robot1")
        
        # Publishers and subscribers are namespaced
        self.cmd_pub = self.node.create_publisher("cmd_vel")
        self.odom_sub = self.node.create_subscriber("odometry", self.on_odometry)
        
        # Services
        self.node.create_service("reset", self.handle_reset)
        
    def on_odometry(self, msg):
        # Process odometry and publish commands
        self.cmd_pub.publish({"linear": 0.5, "angular": 0.0})
        
    def handle_reset(self, request):
        # Reset robot state
        return {"success": True}
        
    def run(self):
        self.node.spin()  # Process callbacks

# Usage
controller = RobotController()
controller.run()

Pattern 3: Manager Pattern (Dynamic Topics)

from dexcomm import PublisherManager, SubscriberManager

class DataLogger:
    def __init__(self):
        self.subscribers = SubscriberManager()
        self.recording = {}
        
    def start_recording(self, topics):
        """Dynamically subscribe to topics"""
        for topic in topics:
            self.subscribers.add(
                topic, 
                callback=lambda msg, t=topic: self.record(t, msg),
                buffer_size=100
            )
            
    def record(self, topic, msg):
        if topic not in self.recording:
            self.recording[topic] = []
        self.recording[topic].append(msg)
        
    def stop_recording(self, topic):
        """Dynamically unsubscribe"""
        self.subscribers.remove(topic)
        
    def get_latest_all(self):
        """Get latest message from all topics"""
        return self.subscribers.get_all_latest()

# Usage
logger = DataLogger()
logger.start_recording(["sensors/lidar", "sensors/camera", "robot/pose"])
# Topics can be added/removed at runtime
logger.start_recording(["sensors/imu"])
logger.stop_recording("sensors/camera")

Configuration

Zenoh Configuration

from dexcomm import Publisher, ZenohConfig

# Peer mode (default) - automatic discovery
config = ZenohConfig.default_peer()

# Client mode - connect to router
config = ZenohConfig.default_client("tcp/localhost:7447")

# Custom configuration
config = ZenohConfig(
    mode="peer",
    connect=["tcp/192.168.1.100:7447"],
    multicast_scouting=True
)

# Use config with any component
pub = Publisher("my/topic", config=config)

Quality of Service

from dexcomm import Publisher

# Publisher with QoS settings
pub = Publisher(
    "important/topic",
    qos={
        "reliability": "reliable",
        "congestion_control": "block",
        "priority": "real_time"
    }
)

Rate Limiting

from dexcomm.utils import RateLimiter
from dexcomm import Node

# High-precision rate limiter
limiter = RateLimiter(rate_hz=30.0)  # 30 Hz
for data in sensor_stream:
    limiter.sleep()  # Maintain 30 Hz
    process(data)

# Adaptive mode - automatically compensates for processing time
limiter = RateLimiter(rate_hz=30.0, adaptive=True)
for data in sensor_stream:
    limiter.sleep()  # Automatically learns and adjusts
    result = heavy_processing(data)  # Variable 10-50ms

# Rate-limited publisher
node = Node("my_node")
pub = node.create_rate_limited_publisher("sensor/data", rate=20.0)
for data in stream:
    pub.publish(data)  # Automatically rate-limited to 20 Hz

Services

from dexcomm import Service, ServiceClient

# Create service
service = Service("math/add", lambda req: {"sum": req["a"] + req["b"]})

# Call service
client = ServiceClient("math/add")
result = client.call({"a": 5, "b": 3})
print(result)  # {"sum": 8}

# Quick one-off call
from dexcomm import call_service
result = call_service("math/add", {"a": 10, "b": 20})

Environment Variables

DexComm can be configured using environment variables. See ENVIRONMENT_VARIABLES.md for complete documentation of all available variables.

Quick setup:

# Copy the example environment file
cp .env.example .env
# Edit .env with your configuration
# Your application will automatically use these settings

Using Configuration Files

DexComm can load Zenoh configuration from files via environment variables:

# Using DEXCOMM_ZENOH_CONFIG (preferred)
export DEXCOMM_ZENOH_CONFIG=/path/to/zenoh_config.json
python your_script.py

# Or using ZENOH_CONFIG (fallback)
export ZENOH_CONFIG=/path/to/zenoh_config.json
python your_script.py

Configuration priority order:

  1. Programmatic configuration (passed to constructors)
  2. Config file from DEXCOMM_ZENOH_CONFIG or ZENOH_CONFIG
  3. Mode from ZENOH_MODE environment variable
  4. Default configuration (peer mode with multicast)

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.

Copyright (C) 2025 Dexmate Inc.

For commercial licensing options, please contact: contact@dexmate.ai

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dexcomm-0.1.18-cp313-cp313-win_amd64.whl (455.6 kB view details)

Uploaded CPython 3.13Windows x86-64

dexcomm-0.1.18-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (797.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

dexcomm-0.1.18-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (716.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

dexcomm-0.1.18-cp313-cp313-macosx_11_0_arm64.whl (542.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

dexcomm-0.1.18-cp312-cp312-win_amd64.whl (456.4 kB view details)

Uploaded CPython 3.12Windows x86-64

dexcomm-0.1.18-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (793.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

dexcomm-0.1.18-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (710.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

dexcomm-0.1.18-cp312-cp312-macosx_11_0_arm64.whl (539.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

dexcomm-0.1.18-cp311-cp311-win_amd64.whl (463.2 kB view details)

Uploaded CPython 3.11Windows x86-64

dexcomm-0.1.18-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (693.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

dexcomm-0.1.18-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (646.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

dexcomm-0.1.18-cp311-cp311-macosx_11_0_arm64.whl (526.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dexcomm-0.1.18-cp310-cp310-win_amd64.whl (450.4 kB view details)

Uploaded CPython 3.10Windows x86-64

dexcomm-0.1.18-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (678.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

dexcomm-0.1.18-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (632.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

dexcomm-0.1.18-cp310-cp310-macosx_11_0_arm64.whl (522.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file dexcomm-0.1.18-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: dexcomm-0.1.18-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 455.6 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for dexcomm-0.1.18-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 988b5e39b8880ab97e53c71e8b5af725d791f8706425b611e0038c2d19364b50
MD5 0f3cd6740eb5467ca5829fadcab47698
BLAKE2b-256 91864b8cb509055dd5dbeace0d4ab95745c3ba2d69f5432fb170e8bdbf89fad3

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 506c39b1ced4c3907d985aa1784ef19b2cc453eae682e6a96504e81a3998cd5a
MD5 0d80930626382b69fcdb22cbc351ac51
BLAKE2b-256 c00c4dd518263c0bf33a949a0d785ccf3d52beeca7094b2b3f7c564282c6d91c

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 869c7190936d4cf0959a5b4a44f1f306d3dfd4f18f5862fa8677e02d832fdf4f
MD5 a016ddf393f895f339770d5ce9fc2613
BLAKE2b-256 0a11dfa2f39b94aad1859d5a5ef00f9ef1371959df645568cad135e2d4011592

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ad2c09b50e0b4e67d5d27eea2b254a3545729e012ba7ba89ebdb25cad1329853
MD5 90c2c344af62ae44f84b12faaa8622f9
BLAKE2b-256 919cae6ad3ac6f9b709f6d035975b21133c49b5ac20fdbf43ee1282c5bd6cfc0

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: dexcomm-0.1.18-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 456.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for dexcomm-0.1.18-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 50d1909398cdc6e836e0a28cda1ce16c41a60e4f1f8324e8e3d45b78d9fc7219
MD5 2ea733e15748c8e437bf9029cd351bf2
BLAKE2b-256 be14f2069e1556a8c23d9ce561b08c3d0fe0a548e0637cbe85e6df5f67a0107b

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cd54f20d8a1729049e7b78856b922df916abdd55b5a135e54723e530061b22e2
MD5 258622aae6d171481497e20cda899c76
BLAKE2b-256 6b4508f6ee5d44cd9076eea97c8a175a412ce5e03ff97c50444237c8f82d2f26

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 796dbdd8b16b239da39081b6d1262455f7a8896469010f4dc4c552a34347393c
MD5 5e938d6c0f4616ceaafbd63d2bab285b
BLAKE2b-256 6b6c4bd16f6f5732c9ab7c362b9e0f7895ab341791521cf0cf840f1ddfb2c5b0

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f9889056481f95f11adf33ce5cc14c1212378c286746e6aec41055324c5384c6
MD5 60fa585dcad18b05686b1c984ddd7832
BLAKE2b-256 bda6051f0b60541f5df60fac1d5d399b5cd6f8c21cb683223f3799ea296f14e1

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: dexcomm-0.1.18-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 463.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for dexcomm-0.1.18-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cd09423ff93f90b5482ab4f6c06c6fc3fe73defcfd2c15cc120bbcc004872b4f
MD5 4760e5d151ffe7879dd5b89e24acedab
BLAKE2b-256 af33799bea892891caf5008aa78be330689109c17cfb09879075537780cf9c8b

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0e1783800f87648ed71575b4e9d9c5e30f982879dd451d48e6038a518d77c197
MD5 19acb55f5f13add6b42ced6cddf4e23c
BLAKE2b-256 128cfcd93fe766d338ce4c7b44588c234c71cdf1dcf23d94f6abf02c329cdfc6

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6ee9746516451473f1db78fa24ddb76d65b8a645b6a9dc5b57ca7e644ba522b8
MD5 f3be89cd75f79d0a15773ce820a4bb25
BLAKE2b-256 3247773845b804d6fdbf65bb9c32d2fe3feda220c398dea5065085c283808968

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dcf617a4d123cd70adbb405c4b4a48b68eab14e7a73c0a499350545471b6b8fc
MD5 03ecf0a5a803dd358116764dafcdfd41
BLAKE2b-256 e7c1112293273296986fc9a86b7f50270f078892cc68a79e8e591f18e5f27cb7

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: dexcomm-0.1.18-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 450.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for dexcomm-0.1.18-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8543aa13b50638f371eb9dbf7ea40c026cc45d22b96956e3450d90d29b873c93
MD5 10cf86c16165bdbde12a666730f72c41
BLAKE2b-256 18a821fc043b916455b704be63cd290e600ca1ea1328feda35c5a91eeb088ab3

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c4c19485e3528ed2eededd0b1c69d3c50feec46dadcdee55e1668c0f2bfcf9ef
MD5 2044e5d0bdf0d667e66cd1a9baef05fb
BLAKE2b-256 ceddef15662d80a4e88290d8c6b8cba0afb510f272ea2f233c4f1e30a90634c6

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4b416ad4e608bb5ec176884e4cbf3f16c753e119ccd6f51d8c79c6e50c3141f0
MD5 c5c951508d70a594307d39fd035f6239
BLAKE2b-256 f34ef54ba575270744282e7f86412242cbe1683fbdb028a166bd9b1b0cac1f9d

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.18-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.18-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57b68ac8c2aa6cdb9c04975e2cb5601cb1d3a7dfe3739b928f18d3048ac7bf03
MD5 93d9362274e559e280669f0ad8b46390
BLAKE2b-256 59e74c05148de6483d9b03d3c0fe53044dc1dbf9433081a7888bc7a09fad8159

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page