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

Uploaded CPython 3.13Windows x86-64

dexcomm-0.1.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (767.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

dexcomm-0.1.6-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.6-cp313-cp313-macosx_11_0_arm64.whl (517.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

dexcomm-0.1.6-cp312-cp312-win_amd64.whl (505.8 kB view details)

Uploaded CPython 3.12Windows x86-64

dexcomm-0.1.6-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.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (703.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

dexcomm-0.1.6-cp312-cp312-macosx_11_0_arm64.whl (511.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

dexcomm-0.1.6-cp311-cp311-win_amd64.whl (513.6 kB view details)

Uploaded CPython 3.11Windows x86-64

dexcomm-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (690.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

dexcomm-0.1.6-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.6-cp311-cp311-macosx_11_0_arm64.whl (501.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dexcomm-0.1.6-cp310-cp310-win_amd64.whl (500.3 kB view details)

Uploaded CPython 3.10Windows x86-64

dexcomm-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (670.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

dexcomm-0.1.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (636.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

dexcomm-0.1.6-cp310-cp310-macosx_11_0_arm64.whl (497.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: dexcomm-0.1.6-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 504.8 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.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4a34d81617bf3517b78426f928ba60e16328ebf0bc88bd2fd6734dccb09d89a8
MD5 2e8036e4f04fad8ab55b85be0888cc4d
BLAKE2b-256 4c0856c8a7c977f5a50dff2734af60fbd36eb47f32a4bf91928a72db164a63f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9c51f7cf2eae5eddef4cb0ed970746f8858f03a67e9fe063cf0c62fe7f97f12d
MD5 9e3b4abf4915a9b7ac341d47346927e5
BLAKE2b-256 c555ab8fe6af25f0d7c6a62d1f57fa8edded42ae74ae80d5d872af951909e328

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b828ee8ad64c1b6d38dc2ad1aa86a6a148a407b4f5a5a3684919bb0e5401a225
MD5 39b39c00356129907562d58352c948dd
BLAKE2b-256 85678f5a812ea74566663c4906770cf779f9a48739f2fa768e5d960ecf7d4db1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a883c3075c399f3c0c6e71b9eea8abb3e5bc4a8f26e77e6f0320eff33ab3775f
MD5 fc4ec04d6a9063eea0ebc205522b0983
BLAKE2b-256 47ae3f4a63c509256757d1ac0e3f4d331a99c570fa18debf1356d776d794d955

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dexcomm-0.1.6-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 505.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.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1db20597d4e457c0bae63a0ff07a5a3e4807a6e4453bea617f1377f6f9d4d8dc
MD5 b3068f3dc98581f287d4af6915d4bb4f
BLAKE2b-256 eee0316c70ef55f51f108a065b46d4775d9c4f2915abb04c16f0540bdc2168a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd2696daf9748deaa163daee4b474159188fdc87239d2119efa8270ac2e84af9
MD5 c865324893aebd04cdc90ddbe103b8cb
BLAKE2b-256 11cd1c9ec31bd89b24cd4d82d8b164c4a8f697702e7c82258d8e08d21fc292cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f8f9dc59b7e9e5b799334e1c4c8ae22146f16d7c5eaca678fb9f1db27f118064
MD5 4ac5f16a3e743f5a9b83431bb3a50ed5
BLAKE2b-256 58adea9e90da5b25f81599912ea793d4a728d075370e41909d2fac4003fb81d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2c201ac31cb4aa686761077203e2289b6269f61d76a50b0c35cf6c1c634fa278
MD5 2e2f75c5b2c078444f302cd189feee79
BLAKE2b-256 8198d6cf82b83da1f2404d988ba4f89cf01b82474fd02a6b23c39db742c2001a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dexcomm-0.1.6-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 513.6 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.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c8ae5ef3f884fadeb1477800b317ea85cd9184b49bd5fdb59eb86b776488e3af
MD5 fcb1415661c1af28e5a40674d2c3bf8f
BLAKE2b-256 4f50d98708485b546ee6c2bb653ec592eb42bf3dcc37b045cfd138cc899c301f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 27a7275a6bdc53e86aa65b210beeac6db9b170ae679a8985abd7f8f4f52c919d
MD5 cc06b48f6f5c6e2e83c0d5ea47d8b843
BLAKE2b-256 db2d7c3cbace8b968988a2951fa2dd3ceb24fcaea0609c6f004c9e0cb0a55fa7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 320fe11204b9e9700399184e86b15b93a0cdfc0e8261ff34df3251758435023c
MD5 cfd51a6a3667059c7db0edbe4700fb7b
BLAKE2b-256 63c70a017da48780636bd100fa8d49e8267e9bf01d2be1e0470a126d949b9c3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a6716932b02c4f832ffbcdae59e6a1fee088ea37afd9af8bfb7ead6388162fba
MD5 9916b3fb27b7fcba2bc22877f6411ad1
BLAKE2b-256 aee0f4daaeaee13b0778b8f5d169e2358f04bb8bf1fb154081463e019073e595

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dexcomm-0.1.6-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 500.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.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4e365133e3272ea938e24fab9a2e3d71647e74ae704ddbc95d4cc179298dd81d
MD5 5d8ee7b54e96c1384fbd48d4cf81ed1e
BLAKE2b-256 cb98091d3a34441d0fd9ab82da20bc67e8d3c43ff496bcd8f86bfbf7ed95bfff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 05e1dcaf04d05f4289f4653acafd1086dcf639eeeeff546f7df0309e8c438348
MD5 e6f30242a1e67aa8346744a16dcd53db
BLAKE2b-256 834db33a927fea73b09ab0c4835cebb05f503773b893ab5b0c7098106f69fa91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 67b8f284978bd1e086ef589cc6bd74f2ea05c19f6f0251e28d9d50a7f37f442b
MD5 891857ba49faafa410729be9fc4bdf89
BLAKE2b-256 4111c6d8ba771bd84b85857cb8076d2767e3dac79a33c883f4890cc408d246c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexcomm-0.1.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c9076a814578dff619fe1b176730237c446f54350bd17b2e64198272e32620d9
MD5 0d6729a8f5197dd14c5774fcbcaf6add
BLAKE2b-256 b15d9b8a10d8308d6e83c0eff9dc8c96bf754560d208b0432970fe3f99d76a36

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