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.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81b66ea03575d5e94a05f3a93677ce05414108e33555aef4cd5ef49d017eb158 |
|
MD5 | d145a7735801b31a6bd310992362df21 |
|
BLAKE2b-256 | ef88e28cd39ed5b65b05c937e414f33489b75c22ed6da6acfeea73bfe2c89ec9 |
Close
Hashes for coppeliasim_zmqremoteapi_client-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21ad24fa46ad09ac76ef6d949f08300083d80e39388dcf656bf5e85e2c3b6c49 |
|
MD5 | ec786d4ae098da985e9545b732c894a5 |
|
BLAKE2b-256 | c7a908a5e3b89475fe8dfc2f9514a1a4deab3d468095221ad0b3c472a15b694c |