-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restructure the python bindings to support official iDynTree bindings #578
Conversation
Important then for all @ami-iit/artificial-mechanical-intelligence |
…KinDynComputations python class
effae01
to
e6cf70e
Compare
To fix conda ci:
|
e6cf70e
to
e4b3f4a
Compare
Sorry for that, I did not originally planned for those name changes, but they were required as part of the conda-forge review process, and then I forgot to advertise them properly. |
Don't worry :) |
…ges in the conda CI - `lie-group-controllers` -> `liblie-group-controllers` - `unicycle-footstep-planner` -> `libunicycle-footstep-planner` - `matio-cpp` -> `libmatio-cpp`
… iDynTree bindings
Conda ci fails because of
while apt/brew fails with https://github.com/ami-iit/bipedal-locomotion-framework/actions/runs/3705058484/jobs/6278469743#step:22:445 @traversaro do you know anything about this? |
Conda ci on ubuntu now fails due to an incompatibility between manifpy and blf/numpy, perhaps it is similar to #514 |
That is due to an old manifpy version installed for some reason, that for some reason is is caused by the numpy fixed to 1.22.4, see:
@GiulioRomualdi could we try to remove the numpy pinning? |
Actually, I know the reason. The matrix of Python Versions/Numpy Versions build by conda-forge is limited, and the one requested is not available, while it is available for the old _7 build. |
This will not be necessary after conda-forge/manif-feedstock#28 is merged. |
I suspect this is related to robotology/idyntree#1040 . However, we can you compile iDynTree can you install assimp and enable the IDYNTREE_USES_ASSIMP option? Even if assimp is already installed, differently from the option dependency related option IDYNTREE_USES_ASSIMP needs to be enabled manually for historical reason. |
…f ros-humble-desktop in conda ci
192742d
to
c1948c2
Compare
We're almost there: only ubuntu is not working |
Good catch with the |
As you may know, the iDynTree python bindings are designed using
swig
while blf bindings usepybind11
. This choice causes several problems so far, indeed it was not possible to have out-of-the-box interoperability between the bindings of the two libraries (See this issue if you are interested in more details pybind/pybind11#1706).The only
iDynTree
object exposed in the blf interface is theiDynTree::KinDynComputations
. As a consequence, we were forced to developiDynTree::KinDynComputations
bindings inside blf, for this reason, the user had to instantiate ablf
binding ofiDynTree::KinDynComputations
and use it inside the code. This approach has some issues:iDynTree::KinDynComputations
were not automatically handled and thepybind11
glue code need to be manually modifiediDynTree
user, I would like to exploit all the iDynTree framework along with blf and I don't want to use a subset of function only because the blf iDynTree bindings are not implementedIn light of this, I decided to restructure the python code to automatically handle swig objects.
The core of this PR is given by a9e3a68. Here, following what was written here I implemented
extract_swig_wrapped_pointer
function that allows us to extract a swig pointer and use it in C++.So what I implemented is the following conversion
This conversion is not only related to iDynTree but it can be used to exploit all the libraries that use swig bindings in the interface of python blf (for instance casadi @Giulero)
⚠️ The other direction (i.e. From C++ to Python swig compatible) is not implemented since we do not need it in blf. Moreover, it is not super clear to me how to design it.
Thanks to a9e3a68 I then simplified the python bindings by directly using the official iDynTree bindings and I removed C++ classes required only to design the blf iDynTree bindings.
To conclude thanks to this PR we can finally write the following
As far as I know, only @paolo-viceconte and @RiccardoZuppetti will be affected by this breaking change. We can schedule a meeting to update the code in case you need it. Sorry for the inconvenience 😭