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.2-cp310-abi3-win_amd64.whl (4.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

dexcomm-0.4.2-cp310-abi3-manylinux_2_34_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ x86-64

dexcomm-0.4.2-cp310-abi3-manylinux_2_34_aarch64.whl (4.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ ARM64

dexcomm-0.4.2-cp310-abi3-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file dexcomm-0.4.2-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: dexcomm-0.4.2-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for dexcomm-0.4.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8c01256e0ca4b9dc4971a6e50ea3c1a15ba8ab1a491107c7877beb50d97a8074
MD5 dd0d11cb171270b00223d9dbe7ea9aa1
BLAKE2b-256 ed51b76f699242161d0457510d783c385c1bdf8a8224270985f4261a78b2b02c

See more details on using hashes here.

File details

Details for the file dexcomm-0.4.2-cp310-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for dexcomm-0.4.2-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 26905ee927ed5f39473f47b4a4e4d974ea409524012994907a95c611459beef6
MD5 7eae37f5e4c7f9245262ebbd5f7de091
BLAKE2b-256 6f5d158751ccef0bfe0561785d99a8f3e339faf5f659819997d3a5f6a672fc71

See more details on using hashes here.

File details

Details for the file dexcomm-0.4.2-cp310-abi3-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for dexcomm-0.4.2-cp310-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 662df1c8bad0181bf48806f922087b34b3e88a354aaf6617712e8dff4c6ff40e
MD5 257b2c960277611a035026d3a4913943
BLAKE2b-256 beea0b45b788d56a4f9f9af7f70471850f90d79e499d0909c76d9d5875f876d2

See more details on using hashes here.

File details

Details for the file dexcomm-0.4.2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dexcomm-0.4.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 79dafa5cf1b8d1edd58ef9771f466f8348d70f9ad810a81a50d68f934a4b0bcc
MD5 6ec262eb4ca495017be3a3850556888b
BLAKE2b-256 a284a25285e3e5a52d3a5e2a08f4e025003da3e9916079cd419494d79557e9a7

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