lbr-stack / pyfri

KUKA Fast Robot Interface Python SDK.
https://lbr-stack.readthedocs.io/en/latest/pyfri/doc/pyfri.html
Apache License 2.0
21 stars 3 forks source link

Convert numpy arrays to required format internally to wrapper.cpp #2

Closed cmower closed 1 year ago

cmower commented 1 year ago

Currently, the user is required to ensure the dtype of a numpy array passed to the "set" commands (e.g. setJointPosition) is a np.float32, for example:

https://github.com/cmower/FRI-Client-SDK_Python/blob/2cb8023c2e47c3250f231a6bc4d6b5760a2b6857/examples/LBRJointSineOverlay.py#L31-L33

What's worse, is that the "get" methods, e.g. getIpoJointPosition as above, output numpy arrays with dtype=np.float64. Two things should be changed in wrapper.cpp:

cmower commented 1 year ago

Alternatively, perhaps to be cleaner, the "get" methods should return np.float32 and the "set" methods only accept np.float32. @mhubii, do you have any thoughts on this?

cbergeles commented 1 year ago

If I can add here, having two data types is not a good idea. The float32 should be good enough, so maybe stick to that?

mhubii commented 1 year ago

on my system, having the data type conversion was not necessary for running the robot

cmower commented 1 year ago

thanks both, I will make the interface float32 for the get/set, since both fri versions succeed