idyntree icon indicating copy to clipboard operation
idyntree copied to clipboard

🚧 Implement pybind11 bindings for the KinDynComputations object

Open GiulioRomualdi opened this issue 3 years ago • 1 comments

The PR is still in draft since I've to implement the bindings for the twist and I've to add the tests

This is an example of usage

import idyntree.pybind as iDynTree

kindyn = iDynTree.KinDynComputations()
kindyn.model = iDynTree.get_random_model(10)
kindyn.set_robot_state([0] * kindyn.get_nr_of_degrees_of_freedom(),
                       [0] * kindyn.get_nr_of_degrees_of_freedom(),
                       [0,0,-9.81])

mass_matrix = kindyn.get_free_floating_mass_matrix()
print(mass_matrix)

this is the output

array([[  25.57634706,    0.        ,    0.        ,    0.        ,
         -15.9249302 ,  -54.83262385,   -8.8700384 ,    4.9886203 ,
           4.58045113],
       [   0.        ,   25.57634706,    0.        ,   15.9249302 ,
           0.        ,   17.75681755,   12.90257969,   -8.81148874,
           0.98227791],
       [   0.        ,    0.        ,   25.57634706,   54.83262385,
         -17.75681755,    0.        ,  -29.49926001,   -2.30219837,
           3.81275983],
       [   0.        ,   15.9249302 ,   54.83262385,  319.99566805,
         -83.66501237, -109.7314934 ,  -97.47332486,   25.4046302 ,
          -2.72756328],
       [ -15.9249302 ,    0.        ,  -17.75681755,  -83.66501237,
         322.25186762,   50.53625654,   99.22406621,    5.48370803,
          -3.07273261],
       [ -54.83262385,   17.75681755,    0.        , -109.7314934 ,
          50.53625654,  405.52787367,   76.84201426,  -65.68563465,
           2.72448946],
       [  -8.8700384 ,   12.90257969,  -29.49926001,  -97.47332486,
          99.22406621,   76.84201426,  103.53784748,  -33.24504489,
           0.        ],
       [   4.9886203 ,   -8.81148874,   -2.30219837,   25.4046302 ,
           5.48370803,  -65.68563465,  -33.24504489,   27.92202853,
           0.        ],
       [   4.58045113,    0.98227791,    3.81275983,   -2.72756328,
          -3.07273261,    2.72448946,    0.        ,    0.        ,
           6.64783251]])

GiulioRomualdi avatar Nov 07 '21 18:11 GiulioRomualdi

Removing myself from the reviewers, feel free to add me back if the PR is being worked on.

traversaro avatar May 30 '22 08:05 traversaro

We can close since https://github.com/robotology/idyntree/pull/1001 implements the same feature

GiulioRomualdi avatar Dec 13 '22 09:12 GiulioRomualdi