Skip to main content

A Python binding for https://gitlab.com/etherlab.org/rtipc

Project description

rtipc

A Python binding for https://gitlab.com/etherlab.org/rtipc

Note: importing rtipc raises ImportError if librtipc.so is not available. Users should handle the exception.

Example

import numpy
import ctypes
try:
    import rtipc
except ImportError:
    rtipc = None

rtipcObj = rtipc.RtIPC('simulator')
rtipcGroup = rtipcObj.CreateGroup(1.0)
receiveMemory = numpy.zeros(16, numpy.uint8)
sendMemory = numpy.zeros(16, numpy.uint8)
connected = ctypes.c_uint8(0)
rtipcGroup.AddReceivePdo(b'receive', rtipc.DataType.uint8_T, receiveMemory.ctypes.data_as(ctypes.POINTER(ctypes.c_uint8)), 16, ctypes.byref(connected))
rtipcGroup.AddSendPdo(b'send', rtipc.DataType.uint8_T, sendMemory.ctypes.data_as(ctypes.POINTER(ctypes.c_uint8)), 16)

with rtipcObj:
    rtipcGroup.Receive()
    rtipcGroup.Send()

Retaining Memory

While rtipc.RtIPC is running, please retain receiveMemory, sendMemory and connected; otherwise rtipcGroup.Receive/Send will cause SEGV. Especially be careful about connected.

If you are an experienced C++ programmer, you can imagine like AddReceivePdo/AddSendPdo is passing shared_ptr<char[]>::get() (and without retaining variables the shared_ptr is gone).

License Note (also for contributors)

Licensed under LGPL/MIT so that if etherlab rtipc license is changed to more permissive one this binding can follow the change.

As long as etherlab rtipc is licensed under LGPL, the USER of this binding should consider it as LGPL-only.

(On the otherhand, if they unfortunately move to GPL, I will stop supporting this binding.)

Project details


Download files

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

Source Distribution

rtipc-0.0.0.2.tar.gz (7.2 kB view details)

Uploaded Source

File details

Details for the file rtipc-0.0.0.2.tar.gz.

File metadata

  • Download URL: rtipc-0.0.0.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for rtipc-0.0.0.2.tar.gz
Algorithm Hash digest
SHA256 9756a720ab16ea05b4f88c5657e92c5ce5fcbd71af5539ea686ce7f37774578b
MD5 37c8b81cdacfe5b40df630ceb6e95359
BLAKE2b-256 06d1bdd7ad62e83fb656db19dea4f3ca204ace6dfb04e9598bce69c007bfce11

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