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

Uploaded CPython 3.13Windows x86-64

dexcomm-0.1.15-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (778.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

dexcomm-0.1.15-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (713.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

dexcomm-0.1.15-cp313-cp313-macosx_11_0_arm64.whl (526.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

dexcomm-0.1.15-cp312-cp312-win_amd64.whl (513.8 kB view details)

Uploaded CPython 3.12Windows x86-64

dexcomm-0.1.15-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (777.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

dexcomm-0.1.15-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (712.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

dexcomm-0.1.15-cp312-cp312-macosx_11_0_arm64.whl (523.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

dexcomm-0.1.15-cp311-cp311-win_amd64.whl (520.9 kB view details)

Uploaded CPython 3.11Windows x86-64

dexcomm-0.1.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (700.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

dexcomm-0.1.15-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (657.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

dexcomm-0.1.15-cp311-cp311-macosx_11_0_arm64.whl (507.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dexcomm-0.1.15-cp310-cp310-win_amd64.whl (509.3 kB view details)

Uploaded CPython 3.10Windows x86-64

dexcomm-0.1.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (680.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

dexcomm-0.1.15-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (643.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

dexcomm-0.1.15-cp310-cp310-macosx_11_0_arm64.whl (504.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: dexcomm-0.1.15-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 513.0 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.15-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f68c67adb4b4826722553c60c3b0e81faa12432e9c42c60a8c7749055f267e84
MD5 621edd938b44392878765ea5370f2116
BLAKE2b-256 f35259f812bd1097b0d348b2baaf6044b43944476144b9d07968a3250b6a1cb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 38b2cf47c1e5058d0df9c6129a595d1d8fbde3fd4f38ac09d60f79e1e8637bc8
MD5 d24e5e09a208355fa738bc51fe8bb570
BLAKE2b-256 669ac9f1d50013d623870b6420e047ea3b9002ce8f1d205585343ec6c4a9266d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c9a0df425878c8b93ef09a0fa9e325215ad7058e139feae92d4c3b03d2bb58b6
MD5 d0539bd4c12c725e27f1fdffdcd7ee2e
BLAKE2b-256 7e38410bb6081801d03cde4f3aef9ea4f6d8bd07d11b5597fb9fca9fc346a651

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 022906271bb41c1d2a4940c366981068e5456837a97b2dc21b12c3131785ca73
MD5 d4e570d6918091fb5a16376dc9fe734e
BLAKE2b-256 1c336250075c6d90d2232aed7b19b56920c7ab94516483e137fd4864f6cdfd65

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dexcomm-0.1.15-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 513.8 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.15-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 74b644f5050b4b32a0aba620629bc2d85d919b7f86f68eb61529999df62f6f1f
MD5 d0e664b0d5b4cb27dc877d59102f4488
BLAKE2b-256 217c24e063f511dc4dabdf7cf53edcbf2caba1e5a4d826e11bb7ff7d1ca9f34d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7111db2aeb2069d93b0cf63e1c83ab2dc1430880ba51b8ea917f70015cc29d50
MD5 3fdf2d37c8676f0207c6f9acd4598980
BLAKE2b-256 93cf3f95b3bf136faf50f79ad3885b4d6ef2c32e415efe7f143b252b1b8c58cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5866ee42e90378699631830f7537fe7408c7594d6856f3614532887d68107a5a
MD5 8b705d423e791e8ad1c2e4324b4f5fe7
BLAKE2b-256 2ca063dbdeeed9efabfb16eab324150abf9336e89c81e60f6998b6f1acda77fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ae2d11dea3a3f501541b87574e749440288949f8306a0befd9a17e9ce74fb09f
MD5 6e3114b34c64652697338c93b684c160
BLAKE2b-256 5594fc696f362aa2820bbd01ef03ca4461148eed014abcc128690a6dbaa9caed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dexcomm-0.1.15-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 520.9 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.15-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fb1306e705c3e642a58f92e47adb6bf0c6d8bf37556907ad6e97d3482ed262ae
MD5 4661110e3127a9f22106ac3d27b0eb8d
BLAKE2b-256 39f774d3e0044d13c47a6d031a5e7cc637574e441e527a127baea5d26b58ea25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3145e9124291b950d59316a7cd5b3b1513944c3585892f30670c20a4a49e01dd
MD5 e95df6aa005c651618afbff78c656b57
BLAKE2b-256 9101e508e73f351d9cf1d8b85bb4a27c0c730f21ae81c8332469eb1123cb896f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fad14141d15ee25ab554787478ffdc9197032f6bd8ab71146aa22d9d9099786d
MD5 12ec0bc373828d05e5c715f5de128c0c
BLAKE2b-256 b142ea15fbd4ac2c9b08edfd5966d1d02e1c094099fb64f2acb5b2785b82ff41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e1509439f8aa5235dea75ac5c239415c27442602d9cb5ca16d710d18adf00a47
MD5 a7a508fa70b252fd91787eb8c8ff4632
BLAKE2b-256 58165c7e425d7a275d6e51212dedca98a9439b5c44eb201b2f868c3039ae6cdd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dexcomm-0.1.15-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 509.3 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.15-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 79e7dba99289ee84a5c7ac19d8309671ce9538a3646be96e477dd48796a89816
MD5 370ed66ce18f9321f9487428385a99c1
BLAKE2b-256 aa29029db5d3ac9a0b6909c1234639baf91393b3341c6b9e47dba40e7cc0717b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 922515b4250bd6da67b2da985d8a332715b6644ce4b9c72522f9d7cb980b88df
MD5 03b766d0ace12727c5594f5d2af4c0a3
BLAKE2b-256 9a446c85dd51aace4c10f471d5dd5a5e65280b945c1f511a6aa36f0af995fc4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4e2d788fa85c02df54110648047fa3ad982df0ce6ef1b9261fcaf4359f710f76
MD5 f2786a8b693bf7aa8905d7d97ff22285
BLAKE2b-256 587b2fd28410f57a1cb04bd4f279a504f4160cdfa299a7d3dd93a8d15fb7e54c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.15-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3b2bd3584c7b36badf57ad9a602043c3d1e3ba5213524b31087a01d1a4e9c63a
MD5 fe112c09496252e44bc31cd8616f3a35
BLAKE2b-256 67b9dfdbc4e8f45431a7aa50fd387d8fb8bc8c99d80a14b10c2c7fecbd567746

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