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

Uploaded CPython 3.13Windows x86-64

dexcomm-0.1.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (767.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

dexcomm-0.1.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (703.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

dexcomm-0.1.5-cp313-cp313-macosx_11_0_arm64.whl (516.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

dexcomm-0.1.5-cp312-cp312-win_amd64.whl (506.1 kB view details)

Uploaded CPython 3.12Windows x86-64

dexcomm-0.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (765.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

dexcomm-0.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (703.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

dexcomm-0.1.5-cp312-cp312-macosx_11_0_arm64.whl (512.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

dexcomm-0.1.5-cp311-cp311-win_amd64.whl (513.8 kB view details)

Uploaded CPython 3.11Windows x86-64

dexcomm-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (689.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

dexcomm-0.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (647.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

dexcomm-0.1.5-cp311-cp311-macosx_11_0_arm64.whl (501.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dexcomm-0.1.5-cp310-cp310-win_amd64.whl (500.5 kB view details)

Uploaded CPython 3.10Windows x86-64

dexcomm-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (669.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

dexcomm-0.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (636.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

dexcomm-0.1.5-cp310-cp310-macosx_11_0_arm64.whl (497.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: dexcomm-0.1.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 505.1 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.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c267aa259d6baf4a0ec44d6ef63aee61f343be3930448a1bfa310097502ac92b
MD5 b701f2158a149ef6ab6ac33cc3dcec98
BLAKE2b-256 91db691b1bc1b3c11c4da775140347e271e91aeb542313db482b4a6a256b2de9

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 57e85de6d3236bf1a52c11be24a844e9c68149addc0cd4c3425c09a28a21fcb0
MD5 c8f2535eb747cb9594ce9e067890e519
BLAKE2b-256 74dfe1b04a97a9dc6e0b97e8ed33417ff6a4c03cdfe7c12df78d4880c94d6b56

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b6e247ebb84dea3cf3ef6861c7701b2ddd7c4d8d9da7ee9ee7711fba2db4bb91
MD5 f3824830eb0134e4ce25137b78a999ba
BLAKE2b-256 31fbd5561e4d8b038645ec5b59727ccdebe24ce46bab70fc759706ac6ec1ef7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9fc2aaa54447ca79b8e3858be980a7cebb187ccc84b9a68540df9b75791a75a2
MD5 de2e74a3321c837774a0dbdc72e92132
BLAKE2b-256 889f18a4aa055451a4428f8d87766376696762c855f4740b895b60e035739f3a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dexcomm-0.1.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 506.1 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.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 99c4c54025bca6333c6ef473193eab282247124988ceeab116bb595408373c43
MD5 154fd071af8967a3a736f2815d1b9e2a
BLAKE2b-256 3b9ba4057a6090b6ddddddb3b21087011ee98ada8a02fe25a2bf5fbc222d3670

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d856a0700391f48e4b96f7cf556e0cd62a458609c13c9a46b34ae9c1a1dda8a2
MD5 83673677a9d7be0da6c6ca18c1b41d27
BLAKE2b-256 aceb22af058f2d9de6a64bb6dc445758f635bbc48ae722de179a03cb12adeade

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 44ad8c17632131af2fb2a61adb4c2288ca66f3216ff4718c50db0b3f261c6f49
MD5 493d60fa9c50d86002cc2deb4ccdf3da
BLAKE2b-256 35dcab6a065eb0868d2ade254c4f8ef592e2e820e075330e51699d8d3cd5f64a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22d68f545db3eb785cd4a527628f75ad9c87528b6b19239e5bd458e7b8b11db2
MD5 71f290182f1ea037292dd7cf35c49156
BLAKE2b-256 06292dbb9a95a31498e0c555c45a42ea908e08ace8d5545449b2ef9085bc7533

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dexcomm-0.1.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 513.8 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.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e4daf37b5b2d322c28ef225cb8cf7186f9100d23578ab2d27b525e110d075645
MD5 72c35ad71831d72838c64874f763145c
BLAKE2b-256 cd14eb0471586faf9259b0d606a8d47733374dacbd85ef31487c28ba9304f8da

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 99310352cbf8cdf5ab2ce7edd531204b0af40b50927eff2755ff6b43b069346e
MD5 4ffdc909f065450fd470b326356c489d
BLAKE2b-256 78ecabfb386eb854ceda744fac44a9133f1c8192a89c26f5fe154275d71a67ed

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 131858caad1a95385fbfc9fe9522f3aade84417412135a3fa48b1c0ddbedc8af
MD5 dafa4be2ba105fec54d2ff87b9f613d2
BLAKE2b-256 fdd31db51c2e97ccd016d8c713b90494a0cc98100716d17a4c2654e8bca2d8f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2800fb30fada5f1ce8418f2816d1871ffb611d75b5837e93f94e65df269b6101
MD5 c2534463f4c6d64b930ac4337b472ade
BLAKE2b-256 1323613865828b6bd630b74ecee14bfbbce8d5b705bac82553984290ffe35101

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dexcomm-0.1.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 500.5 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.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 04b9d9d4292db543fd62922a4de90537ef49d9d16d4784aab1030f8276c12cc2
MD5 c1224a661a8c82e8e3986f52bc8d4cf2
BLAKE2b-256 df32ba0ebf254b2fc301bbe5d6b1fb5a071ba74323545597d64af91d99cc4ce0

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1ad39ec1331a5c959a6dd89f08670c17f35369b2ea0a893924752d5a66dc526d
MD5 d8798afb31bcbed9f1a07f8a00a66c7f
BLAKE2b-256 64e293e4c0913df88a5444bd7052c8ffb22cb6f29a62e0b3cc7a6a1cca74047f

See more details on using hashes here.

File details

Details for the file dexcomm-0.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 13db6a9792dbb336ba14bf9cdd75effbf58b3404e4fef1c450561d1a8bedf649
MD5 355cf80f7426acf4450e6ff8556c1209
BLAKE2b-256 4011f9d11964090c16b3c983b4a43b301d4f2feebce0b8ec0e2613795bf6910a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 688871df22efd6da9a5c1854ccb8dbffd4d58631bc4d5ca863f1aca26451c46b
MD5 dc8b91aebf7afdfd923c2df9242b2348
BLAKE2b-256 0abccb8e440fdb85ee0e20d0fe48a856c0077a0165b00eb7878861b7954d89b1

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