Communicates data between dopl and devices
Project description
Data Communicator Client
Sends and receives data between clients connected to Dopl
Usage
# Robot
import threading
import time
from doplcommunicator import DoplCommunicator
from doplcommunicator.controllerdata import ControllerData
def on_joined_session(session_id: int):
print('Joined session id', session_id)
def on_controller_data(controller_data: ControllerData):
print('Controller data received', controller_data.toDict())
def run_loop(communicator):
while(True):
# Use sparingly as this causes a read lock
controller_data = communicator.controller_data
# Apply controller data to robot
time.sleep(0.01)
communicator = DoplCommunicator("http://localhost:3000")
communicator.on_joined_session(on_joined_session)
communicator.on_controller_data(on_controller_data)
communicator.connect()
threading.Thread(target=run_loop, args=(communicator))
# Robot Controller
import time
from doplcommunicator import DoplCommunicator
from doplcommunicator.controllerdata import ControllerData
def on_joined_session(session_id: int):
print('Joined session id', session_id)
def run_loop(communicator):
while(True):
x = y = z = rx = ry = rz = rw = 0
communicator.controller_data = ControllerData(x, y, z, rx, ry, rz, rw)
time.sleep(0.01)
communicator = DoplCommunicator("http://localhost:3000")
communicator.on_joined_session(on_joined_session)
communicator.connect()
threading.Thread(target=run_loop, args=(communicator))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file doplcommunicator-1.0.6.tar.gz
.
File metadata
- Download URL: doplcommunicator-1.0.6.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 983a9270b7c2ff181462d730d9845a306d95aa0e3806f4db71ff548971dd92fd |
|
MD5 | 451edab780ed572691aa387612e9dc01 |
|
BLAKE2b-256 | 8a2daa30af80ffb5ec7a8549f15af7774e0a72aecb1e0bf80e1d5927c6b0c18e |
File details
Details for the file doplcommunicator-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: doplcommunicator-1.0.6-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64fc22c23d5dde306f038d3f25f80965f45905d795b6faeaa1c8d29f9c4e6f06 |
|
MD5 | 6fcbcf54552ca90e023f34ec0eefcfd9 |
|
BLAKE2b-256 | 4463c811d7b8486248b338e9df0c896752318a480ef942ac7bf58b66eff61fb2 |