Skip to main content

A high-performance Python client for real-time management of XTablesServer network tables, designed for robotics and complex data-driven systems.

Project description

XTablesClient

XTablesClient is a Python client library for connecting to an XTABLES server, supporting both direct socket and ZeroMQ-based communication. This client provides methods for data operations on network tables and offers convenient functionality for interacting with robotic applications or distributed systems.

Features

  • Flexible Initialization: Connects to a server directly or discovers it via mDNS.
  • Data Operations: Supports multiple data types (Boolean, String, Integer, Float, Array, Class, Bytes) for seamless data transmission.
  • ZeroMQ Support: Configurable ZeroMQ PUSH/PULL and PUB/SUB communication for real-time message streaming.
  • Robust Connection Management: Includes automatic reconnection and resubscription after disconnection.
  • Subscription: Allows for subscriptions to data updates for specific keys, invoking consumer functions on updates.

Installation

Install xtables-client from PyPI:

pip install xtables-client

Usage

Import and Initialization

from xtables_client import XTablesClient

# Initialize the client
client = XTablesClient(server_ip="192.168.1.10", server_port=1735, useZeroMQ=True)

Data Operations

  1. Setting Values

    • Boolean: client.executePutBoolean("key", True)
    • String: client.executePutString("key", "value")
    • Integer: client.executePutInteger("key", 42)
    • Float: client.executePutFloat("key", 3.14)
  2. Retrieving Values

    • Get Integer: value = client.getInteger("key")
    • Get String: value = client.getString("key")
    • Get Float: value = client.getFloat("key")
  3. Subscriptions

    • Subscribe to updates for a key and handle updates with a custom function:
      def my_consumer(key, value):
          print(f"Update for {key}: {value}")
      
      client.subscribeForUpdates("key", my_consumer)
      
  4. ZeroMQ Operations

    • Push Data: client.push_frame("identifier", "message")
    • Receive Next: key, value = client.recv_next()

Connection Management

  • Reconnect: Automatic reconnection and re-subscription to previously subscribed keys.
  • Shutdown: Gracefully shuts down the client connection.
    client.shutdown()
    

Example

from xtables_client import XTablesClient

client = XTablesClient(useZeroMQ=True, server_port=1735)
client.subscribe("image")

while True:
    key, value = client.recv_next()
    if key is not None:
        print(f"Received data for {key}: {value}")

License

This project is licensed under the MIT License.


This README provides a clear overview of the client’s capabilities, installation instructions, and usage examples to facilitate integration with any XTABLES server.

Project details


Release history Release notifications | RSS feed

This version

5.0.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xtablesclient-5.0.7.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

XTablesClient-5.0.7-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file xtablesclient-5.0.7.tar.gz.

File metadata

  • Download URL: xtablesclient-5.0.7.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for xtablesclient-5.0.7.tar.gz
Algorithm Hash digest
SHA256 d89c7eaebda4bf54fb6e45d616ea2787b6c20a5cb5cb5df0591492b8191db74f
MD5 26537b1478e12b4a629f896cae0f9347
BLAKE2b-256 e4f2e1c6e85b6d7d29f83066320fdb0aa8b46a4e7f8e110ae4407ac24104e464

See more details on using hashes here.

File details

Details for the file XTablesClient-5.0.7-py3-none-any.whl.

File metadata

  • Download URL: XTablesClient-5.0.7-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for XTablesClient-5.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c96368c83d9517a1fab92b04ba6c76ec5dc4e0a5631ebf0904a72a748c01b887
MD5 0569fe2487c55215d46b259243fcf52c
BLAKE2b-256 312353c7e517e8ec49f7796cae7cec14c0ccbe3194f6e5c63ac6a9c506fa28c5

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