How can i use sim.getObjectPosition on python?
I use client = RemoteAPIClient()
sim = client.getObject('sim')
but i cant use sim.getObjectPosition. What i need to add to pycharm?
API function on python with Zeromqremote API
Re: API function on python with Zeromqremote API
Hello,
so you are trying to use the ZeroMQ remote API with your python client?
Your approach looks correct. Is there any error message? (you say "I can't use sim.getObjectPosition"... what does that mean exactly? What is the error?)
Cheers
so you are trying to use the ZeroMQ remote API with your python client?
Your approach looks correct. Is there any error message? (you say "I can't use sim.getObjectPosition"... what does that mean exactly? What is the error?)
Cheers
Re: API function on python with Zeromqremote API
Yes, i want use Zeromq remote api on pycharm.
Using like this:
client = RemoteAPIClient()
sim = client.getObject('sim')
pos = sim.getObjectPosition(sim, -1) (i dont know is this correct?)
It gives the following error.
Using like this:
client = RemoteAPIClient()
sim = client.getObject('sim')
pos = sim.getObjectPosition(sim, -1) (i dont know is this correct?)
It gives the following error.
Code: Select all
Traceback (most recent call last):
File "C:\Program Files\CoppeliaRobotics\CoppeliaSimEdu\programming\zmqRemoteApi\clients\python\deneme.py", line 10, in <module>
pos = sim.getObjectPosition(sim, -1)
File "C:\Program Files\CoppeliaRobotics\CoppeliaSimEdu\programming\zmqRemoteApi\clients\python\zmqRemoteApi\__init__.py", line 82, in <lambda>
setattr(ret, k, lambda *a, func=f'{name}.{k}': self.call(func, a))
File "C:\Program Files\CoppeliaRobotics\CoppeliaSimEdu\programming\zmqRemoteApi\clients\python\zmqRemoteApi\__init__.py", line 70, in call
self._send({'func': func, 'args': args})
File "C:\Program Files\CoppeliaRobotics\CoppeliaSimEdu\programming\zmqRemoteApi\clients\python\zmqRemoteApi\__init__.py", line 45, in _send
rawReq = cbor.dumps(req)
File "C:\Users\PC\AppData\Local\Programs\Python\Python39\lib\site-packages\cbor\cbor.py", line 221, in dumps
return dumps_dict(ob, sort_keys=sort_keys)
File "C:\Users\PC\AppData\Local\Programs\Python\Python39\lib\site-packages\cbor\cbor.py", line 170, in dumps_dict
parts.append(dumps(v, sort_keys=sort_keys))
File "C:\Users\PC\AppData\Local\Programs\Python\Python39\lib\site-packages\cbor\cbor.py", line 218, in dumps
return dumps_array(ob, sort_keys=sort_keys)
File "C:\Users\PC\AppData\Local\Programs\Python\Python39\lib\site-packages\cbor\cbor.py", line 154, in dumps_array
parts = [dumps(x, sort_keys=sort_keys) for x in arr]
File "C:\Users\PC\AppData\Local\Programs\Python\Python39\lib\site-packages\cbor\cbor.py", line 154, in <listcomp>
parts = [dumps(x, sort_keys=sort_keys) for x in arr]
File "C:\Users\PC\AppData\Local\Programs\Python\Python39\lib\site-packages\cbor\cbor.py", line 228, in dumps
raise Exception("don't know how to cbor serialize object of type %s", type(ob))
Exception: ("don't know how to cbor serialize object of type %s", <class 'type'>)
Re: API function on python with Zeromqremote API
That won't work, you are mixing up things. Try with:
Cheers
Code: Select all
# Following for client set-up
client = RemoteAPIClient()
sim = client.getObject('sim')
# Now your actual program:
objectHandle=sim.getObject('/ObjectAlias')
pos = sim.getObjectPosition(objectHandle, -1)
Re: API function on python with Zeromqremote API
Ohh yes, thank you so much.
Cheers.
Cheers.