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.17-cp313-cp313-win_amd64.whl (514.6 kB view details)

Uploaded CPython 3.13Windows x86-64

dexcomm-0.1.17-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (789.4 kB view details)

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

dexcomm-0.1.17-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (711.7 kB view details)

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

dexcomm-0.1.17-cp313-cp313-macosx_11_0_arm64.whl (527.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

dexcomm-0.1.17-cp312-cp312-win_amd64.whl (515.6 kB view details)

Uploaded CPython 3.12Windows x86-64

dexcomm-0.1.17-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (786.5 kB view details)

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

dexcomm-0.1.17-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (704.4 kB view details)

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

dexcomm-0.1.17-cp312-cp312-macosx_11_0_arm64.whl (525.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

dexcomm-0.1.17-cp311-cp311-win_amd64.whl (523.2 kB view details)

Uploaded CPython 3.11Windows x86-64

dexcomm-0.1.17-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (687.6 kB view details)

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

dexcomm-0.1.17-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (641.0 kB view details)

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

dexcomm-0.1.17-cp311-cp311-macosx_11_0_arm64.whl (509.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dexcomm-0.1.17-cp310-cp310-win_amd64.whl (511.4 kB view details)

Uploaded CPython 3.10Windows x86-64

dexcomm-0.1.17-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (670.8 kB view details)

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

dexcomm-0.1.17-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (628.3 kB view details)

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

dexcomm-0.1.17-cp310-cp310-macosx_11_0_arm64.whl (505.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for dexcomm-0.1.17-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 387e59217a28f9db86f0024ceee3577c26b79084d871f2127f18a253751b9744
MD5 1264a20480f3a12aec19eba38401486a
BLAKE2b-256 968a8772c91793947137abdc36256d8bc55bdb93720f898f9dff441763a21cf8

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.17-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.17-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 792119cc1cf6d806e2d46fb93aca681a9f92dce02565ec1c2b1d30037e9c33fb
MD5 8f6ad44da253d8ece041b39ac9e22e1c
BLAKE2b-256 f289cfbd3baec19047717c7b7a10b42cf9b3f711983cabe25fda396c5350f92e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.17-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0ed050a9709ead97789ae56605096a54cc664257dff28fc08e0b0510ebc120e5
MD5 2962bdc0c33b8bb5f4bc570c5df17a2d
BLAKE2b-256 eac6caa4f797df8664c853602cc6e945f3cfe72a3a1dde6cc7aed1a44d73d928

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.17-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f98c7d60ffbabcec9bed960acd8a7d4681e4ae54f79e11ec7aae99c35f495417
MD5 e16d1f1289dedb527a12e526518ada60
BLAKE2b-256 cb59d2c32e0522bfd79053e73795be73900e0832b6a106035af63e92f002b0f9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for dexcomm-0.1.17-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 49428909349a10f2152e35d3c6211355fc9b85d96d7c684df638f8f41c8f91e3
MD5 b926ff86df1067cf3f4e7af98830b1c0
BLAKE2b-256 97ef185d4c04c75556541d0585b4dc6275ce778d41ca880b4676198d36009300

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.17-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.17-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bc64f94aca0cb5bdbc5db4a54d66789633196a9b7feb0c812343184e3a17bb62
MD5 ed09d2eb6eacb2ccf2bb33aa0bac9ef9
BLAKE2b-256 a693e154c49a159d98880b88e74a568b026665381ac71b5b3dc7a66ff1b5c35b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.17-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 23146c6fcbb3ec4ed3fab46047f454d19419a3d1caec597fe58c05b9fed147a5
MD5 671c31044b072ff344677b1dcf252cc0
BLAKE2b-256 a14bb5449876a8de5173e9cbd4dad3914e436d81f4d88201655e73b5c7be8049

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.17-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 734049f054aff6202f3fe1e98326697aa9c034caa0b2ec9342a49242d336f8e6
MD5 46f160264abfd981342df0a2c0ed22f5
BLAKE2b-256 4a95a56d47571a11cad24ff3af2d02dae1e2d960eab30f0f9f42dce5714d8cd6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for dexcomm-0.1.17-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a3a530c7e30e173a02b1ea725ce8e2dec7535ee2a1056d735cdace6de513cc4f
MD5 d3ddf33b3896ea7329bec36630de921f
BLAKE2b-256 a06b487917f5761ec5dfc14d8784b89838a3f34c9180226ae7794ee45ace321b

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.17-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.17-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7cc59721093503f7dfa26bdd098b5c8f5ddff5cee0c27bc30949197acfc5e9c5
MD5 e8f4a8ecb136e75463f6c49f1ffffe09
BLAKE2b-256 f17caae100064e234c288435a94fbca5d60723ca9a42ac83fdb7c19d31e06d5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.17-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 641d10d1f10317cf4fd1b1ce97b6704cf4eabf50b7f5dce9da28a038533af663
MD5 a2c0f356f29a5002a800289ec0f53dd2
BLAKE2b-256 7c638ff1933db7fb1b4dcbbba35f8bdb44554047029477f24b09049e65dae1d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.17-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7d4d505148e3fb1d4c26054caa858bb1da480bc117ef45110c8ad6ce02b74e36
MD5 2dd10e43c7f0c8c5b211209a5d5853a1
BLAKE2b-256 7f093af4cb649fb076e4c320911e260c9f8e973499d0c65ca14960676c40f43a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for dexcomm-0.1.17-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bf02a5c1dea11217df7f3af780841030f245c0a691a3146329eba990254cf6cd
MD5 ef7218642f8120f82645010cb087ddd6
BLAKE2b-256 61ff3ff5ea6705dd929962a715ac8807df691bfcc802a0a324cba2b53f33f1bc

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.17-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.17-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 51b4e0a86565c5670d2ff568a98a20b3e7721b924b43225a1bf6144720d8013c
MD5 126fe7eac7b2aae22d5f1449e85be872
BLAKE2b-256 0e14065f2bf13ede181cce682423ed2fdbadc80149ff57db5586025318c7d666

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.17-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3044c412a4769e28ec1db8bb21122f620b2217295e28299c11d1343d337f42ef
MD5 6db213680f10620357002ae8bd7a6018
BLAKE2b-256 5707a8c76cf79cc7ab214c0fd697eb76ff1bda5a775a6625cf60bbcea41165bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.17-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 42dabd4f6cfa1b023a2b825cb5f1915ca80530465fcba00b2f96a3bbc604dd7e
MD5 acd9afc96534881512a150bfbe2cc4e6
BLAKE2b-256 4e30f0b3ad2754cb0d38353a6d91f77f90443d300d3d4e03fcea6e27f0f9f662

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