Client for the CoppeliaSim's zmqRemoteApi (protocol version 2)
Project description
CoppeliaSim zmqRemoteApi Python client
Python client for the zmqRemoteApi, protocol verison 2 (note: starting from pip package version 2.x, the major version number (e.g. 2) matches with the protocol version used by CoppeliaSim).
Installing:
python3 -m pip install coppeliasim-zmqremoteapi-client
Usage
from coppeliasim_zmqremoteapi_client import *
# create a client to connect to zmqRemoteApi server:
# (creation arguments can specify different host/port,
# defaults are host='localhost', port=23000)
client = RemoteAPIClient()
# get a remote object:
sim = client.require('sim')
# call API function:
h = sim.getObject('/Floor')
print(h)
There is also an asyncio version of the client. Normal asyncio principles apply, and all methods are async:
from coppeliasim_zmqremoteapi_client.asyncio import *
client = RemoteAPIClient()
async def main():
async with RemoteAPIClient() as client:
sim = await client.require('sim')
h = await sim.getObject('/Floor')
print(h)
asyncio.run(main())
on Windows, if it doesn't work properly, before calling asyncio.run(...) call:
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
A note about performance of sequential requests: if performing many commands in one shot, and results will be used later, consider using asyncio.gather for improved throughput.
E.g. getting the handles of 100 objects:
handles = await asyncio.gather(*[sim.getObject(f'/Object{i+1}') for i in range(100)])
Also check out the examples in clients/python.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coppeliasim_zmqremoteapi_client-2.0.4.tar.gz.
File metadata
- Download URL: coppeliasim_zmqremoteapi_client-2.0.4.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a97cfe1510e1a41cdabe829efb6e0e0aa58f0612938c839bc3780e0f9c794f7a
|
|
| MD5 |
8b9d010b999899042b3e59c626da4bb3
|
|
| BLAKE2b-256 |
23691014369f1d6b14d39a0337d14029fbdf60bd24ced24aaf1f7b971ba8f9a0
|
File details
Details for the file coppeliasim_zmqremoteapi_client-2.0.4-py3-none-any.whl.
File metadata
- Download URL: coppeliasim_zmqremoteapi_client-2.0.4-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b83119f713070f8f4507afca0cc0258f3ec5a498c54c207a70622d9d81d8c229
|
|
| MD5 |
19577d69c4479eae2236f5e1661fe2de
|
|
| BLAKE2b-256 |
43ef0346adebafcaf46166f2b3276d1c5368e0604351604891967c182bf28b68
|