Client for the CoppeliaSim's zmqRemoteApi
Project description
CoppeliaSim zmqRemoteApi Python client
Python client for the zmqRemoteApi.
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
Close
Hashes for coppeliasim_zmqremoteapi_client-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfbac7cf74fe9410bbdde367a8269ecc1c147e95476ddab81474da4c0be5aaa3 |
|
MD5 | 6ca7ac884bb9acffbf362572fca603d2 |
|
BLAKE2b-256 | 378c172521d711b13ef37fc5a4d6404eced211c1cb41b9943a40036a3f9adcfa |
Close
Hashes for coppeliasim_zmqremoteapi_client-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4baab7af9b89798d2d95fa6e96cf88305ac2281264af69450a6582ed7986f7c1 |
|
MD5 | 46db3613492c6bfa2a08b3fe576af40a |
|
BLAKE2b-256 | 20cc8e7826c7c91c31a72f7d2051f8f89efb5d08210d9adc40196f672b04cc26 |