UM-ARM-Lab / pytorch_kinematics

Robot kinematics implemented in pytorch
MIT License
443 stars 42 forks source link

How to output tensor array directly instead of transform3d format? #5

Closed WangXingfang closed 2 years ago

WangXingfang commented 2 years ago

Thank you very much for your work. It gives me great help! In the process of using the forward kinematics function, I want to output the position of the robot joint directly, rather than an transform3d format.

_ret = chain.forward_kinematics(th_batch, endonly=False) _mat = ret.getmatrix()

I don't want to use the "_getmatrix()" function, because it will take some time. So how to take "ret" as a tensor array which can be used directly.

LemonPi commented 2 years ago

To get the positions the full transform has to be computed from its lazy state, which get_matrix() will do. Retrieving the matrix itself should be almost free since we're not making a copy of it. get_matrix() is currently the best way to get the position sensors.