Skip to main content

Accelerated communication library using Zenoh for robotics and AI

Project description

DexComm - High-Performance Communication Library

A high-performance communication library providing three levels of abstraction for distributed systems. Designed for robotics, AI, and real-time applications with minimal latency and maximum throughput.

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
  • Efficient Resource Management: Shared session management for optimal resource usage
  • High-Precision Rate Limiting: Nanosecond-precision rate control with adaptive processing compensation
  • Flexible Configuration: Comprehensive configuration options with file and environment variable support
  • Quality of Service: Configurable reliability, congestion control, and priority
  • Service Support: Request-reply pattern with timeout and async calls

Installation

System Requirements

DexComm requires FFmpeg and libjpeg-turbo libraries to be installed on your system before installing the Python package.

Linux (Ubuntu/Debian)

sudo apt-get update
sudo apt-get install ffmpeg libjpeg-turbo8 -y

macOS

brew install ffmpeg libjpeg-turbo

Windows

Option 1 - Automated (Easiest):

# Run in PowerShell (as Administrator)
irm https://raw.githubusercontent.com/dexmate-ai/dexcomm/main/scripts/setup_windows_dependencies.ps1 | iex

Option 2 - Using Chocolatey:

choco install ffmpeg libjpeg-turbo -y

Install DexComm

After installing system dependencies:

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

Pattern 1: Raw API (Simplest)

from dexcomm import Publisher, Subscriber
from dexcomm.codecs import PickleDataCodec

# Create publisher with AutoData encoding
pub = Publisher("sensor/temperature", encoder=PickleDataCodec.encode)
pub.publish(25.5)

# Create subscriber with AutoData decoding
sub = Subscriber("sensor/temperature",
                 decoder=PickleDataCodec.decode,
                 callback=lambda msg: print(f"Temp: {msg}°C"))

# For raw bytes (default), no encoder/decoder needed
raw_pub = Publisher("sensor/raw")
raw_pub.publish(b"raw sensor data")

Pattern 2: Node-based (ROS-like)

from dexcomm import Node
from dexcomm.codecs import PickleDataCodec

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", encoder=PickleDataCodec.encode)
        self.odom_sub = self.node.create_subscriber("odometry",
                                                     self.on_odometry,
                                                     decoder=PickleDataCodec.decode)

        # Services
        self.node.create_service("reset", self.handle_reset,
                                 request_decoder=PickleDataCodec.decode,
                                 response_encoder=PickleDataCodec.encode)

    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 SubscriberManager
from dexcomm.codecs import PickleDataCodec

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),
                decoder=PickleDataCodec.decode,
                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_stats(self):
        """Get statistics for all subscribers"""
        return self.subscribers.get_stats()

# 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

Network Configuration

from dexcomm import Publisher, ZenohConfig

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

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

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

Quality of Service

Configure reliability, congestion control, and priority:

from dexcomm import Publisher

# Critical: guaranteed delivery, highest priority
pub = Publisher("robot/emergency_stop", encoder=PickleDataCodec.encode,
    qos={"reliability": "reliable", "congestion_control": "block", "priority": "real_time"})

# Sensors: fast delivery, drop old data
pub = Publisher("sensors/lidar", encoder=PickleDataCodec.encode,
    qos={"reliability": "best_effort", "congestion_control": "drop", "priority": "data_high"})

Parameters: reliability (best_effort/reliable), congestion_control (drop/block), priority (background → real_time)

Rate Limiting

from dexcomm.utils import RateLimiter
from dexcomm import RateLimitedPublisher

# 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 - built-in rate limiting
pub = RateLimitedPublisher("sensor/data", rate=20.0)
for data in stream:
    pub.publish(data)  # Automatically rate-limited to 20 Hz

Services

from dexcomm import Service, ServiceClient
from dexcomm.codecs import PickleDataCodec

# Create service with AutoData encoding/decoding
service = Service("math/add",
                  lambda req: {"sum": req["a"] + req["b"]},
                  request_decoder=PickleDataCodec.decode,
                  response_encoder=PickleDataCodec.encode)

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

# For raw bytes (default), no encoder/decoder needed
raw_service = Service("echo", lambda req: req)
raw_client = ServiceClient("echo")
result = raw_client.call(b"hello")

Using Configuration Files

DexComm can load network configuration from JSON files via environment variables:

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

License

This project is licensed under a Proprietary Software License - see the LICENSE file for details.

Copyright (c) 2025 Dexmate. All rights reserved.

For licensing inquiries, 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.4.0-cp313-cp313-manylinux_2_34_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

dexcomm-0.4.0-cp313-cp313-manylinux_2_34_aarch64.whl (5.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

dexcomm-0.4.0-cp312-cp312-manylinux_2_34_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

dexcomm-0.4.0-cp312-cp312-manylinux_2_34_aarch64.whl (5.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

dexcomm-0.4.0-cp311-cp311-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

dexcomm-0.4.0-cp311-cp311-manylinux_2_34_aarch64.whl (5.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ ARM64

dexcomm-0.4.0-cp310-cp310-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

dexcomm-0.4.0-cp310-cp310-manylinux_2_34_aarch64.whl (5.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ ARM64

File details

Details for the file dexcomm-0.4.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.4.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 0d84794fedff31084f079510b5fd9b55d51ec8aa867312c8f82f92fc2cf0d3cc
MD5 0f5b806bfbba19fa59fcf975740a1ad8
BLAKE2b-256 d9c87c889ae4fa216e427d6c7cef0583105bd7a2df858e8c2f6e83b833dca4fb

See more details on using hashes here.

File details

Details for the file dexcomm-0.4.0-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.4.0-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 f3994058eb6b367ac11fe5256b6cc70ecb29e596b34848fd3ad1ffd99afdd9a5
MD5 0232f0955628e552a4b736048ea6632b
BLAKE2b-256 cb8b5cec0faa32e68a52a2b30bdf7a2347661574653f68f88eb0ce517233ace5

See more details on using hashes here.

File details

Details for the file dexcomm-0.4.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.4.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1c9009ee39b77393c9c3bfcf74875d6c771b7ca478f4835a8a59c6edc59e4c94
MD5 fd769b0f9c3be6b4e4992c2866de0b5d
BLAKE2b-256 34784f2260ad924213da55f79698012bbea95286f15631b413f0ee9271f204a2

See more details on using hashes here.

File details

Details for the file dexcomm-0.4.0-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.4.0-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 f156717e37110a66868fea610d756d4dae749e45fff469fc453ccc39acc45e0f
MD5 3c4f25493797cb1b288fccacfcc8f2e9
BLAKE2b-256 efa7aaf39ab2c3662bdd18eff4dc63c4ce538c2ab4242351e9ece23b73d6c951

See more details on using hashes here.

File details

Details for the file dexcomm-0.4.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.4.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a4f382f15f805e843841eb29219b0c804749fb2dd3920bfc63885614dc4871dc
MD5 3d255118d868376cc769672fd24d7834
BLAKE2b-256 b526e96fb5f88d4185fef38afa28cf1548bb1714f6c5b901b117f78e5bdf93d7

See more details on using hashes here.

File details

Details for the file dexcomm-0.4.0-cp311-cp311-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.4.0-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 bff2c0573e4fe8e322f1f70f32471018c129755c1701be3c0aebb6a66cdf276f
MD5 e0e230a6e227d08e60b5a898ec9f935d
BLAKE2b-256 925cb76fbacd3304c3a1955516a5d53af3995edacddf0f01ed9da5bc639b2d45

See more details on using hashes here.

File details

Details for the file dexcomm-0.4.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.4.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a6feee2fb1b162c51c5ce053bc3b5b42b2e5fe402eaf71226eb335f1791f3225
MD5 95453debd2142d9ed196a94393698651
BLAKE2b-256 0e78595e1c89f64af0dc45713d7c8216381cad0a92f096704b5eed2c58d6c0d8

See more details on using hashes here.

File details

Details for the file dexcomm-0.4.0-cp310-cp310-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.4.0-cp310-cp310-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 2800b26b4d016c3c29ce5f7f7518f5fba2363cbfad5737bb3e43cb902535cf5f
MD5 ed4f29c6079cac339b2676b633be86f2
BLAKE2b-256 19c032f9451a80897f05507f6992df8ee15cd8d7a1e1ce6cd89d2ab15b9d94e7

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