-
Notifications
You must be signed in to change notification settings - Fork 42
Description
Premise: this problem is really subtle and took me quite a while to figure out what was going on. It is highly dependent on the setup, it occurred in my laptop but the problem could happen in any other similar configuration.
My daily setup is a Docker image generated from this Dockerfile
. It uses conda to install a lot of dependencies, and then builds a complete robotology-superbuild and the Ignition stack from sources. While building the image, the default compiler is what provided in conda-forge.
Then, in order to make the QtCreator autocompletion happy, in the runtime container I set Ubuntu's clang as default compiler. My development pattern is having a blf repo mounted in a persistent volume from the host (this means I don't use the blf in the src
folder of the superbuild) but then I install it inside superbuild's build/install
, overriding the previous files.
This means that, when compiling blf outside the superbuild, the runtime compiler is used (clang) as opposed to what used during the image build process (conda-forge's gcc).
In this setup, executing Python code that uses both blf and manif, the following error occurs:
In [1]: import bipedal_locomotion_framework.bindings as blf
...: import numpy as np
...: import manifpy
...: quat = [0.0, 0, 0, 1]
...: c = blf.contacts.ContactBase()
...: c.pose = manifpy.SE3(position=np.array([-0.0072, 0.0786, 0.0]), quaternion=quat)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-da0cdb9a3959> in <module>
4 quat = [0.0, 0, 0, 1]
5 c = blf.contacts.ContactBase()
----> 6 c.pose = manifpy.SE3(position=np.array([-0.0072, 0.0786, 0.0]), quaternion=quat)
TypeError: (): incompatible function arguments. The following argument types are supported:
1. (self: bipedal_locomotion_framework.bindings.contacts.ContactBase, arg0: manif::SE3<double>) -> None
Invoked with: <bipedal_locomotion_framework.bindings.contacts.ContactBase object at 0x7f30e01a7f70>, <manifpy._bindings.SE3 object at 0x7f30d82e8bb0>
At first sight, I though of some incompatibilities between manif, maybe an updated version, and what blf expects. However, the investigation didn't bring me towards any solution.
After some more digging (and related cursing) I read this SO question, and I realized that the problem was similar to what I was experiencing. Matching the compilers, in my case compiling with conda-forge's gcc, solved the problem.
This being said, it is clear that this incompatibility of bindings that do not share the same compiler is quite fragile. We should keep this in mind in case it occurs in the future in other setups. I don't really have any workaround proposal. For sure, exposing as we were doing before just the types we needed would solve it, even though it would be suboptimal for those that already use manifpy
in their code since they would have to convert all objects to the equivalent blf.SE
types.
When @GiulioRomualdi first tried this integration with upstream's manifpy and it magically worked, I was first quite surprised, but then I thought that sooner or later some limitation would have occurred. I sat for a while in the river's side waiting the first floating body, and unfortunately it was my own 😅 If you don't have any suggestion, I'd say to keep things as they are because they work in most of the cases. Let's use this issue as reference to collect problems coming from particular setups like what I described in the beginning.
To conclude, I want to say that an environment fully based on conda-forge packages is not affected by this thanks to the usage of the same compiler. Furthermore, also manylinux*
packages in PyPI should not be affected, under the assumption that the same variant is available for both packages.
cc @dic-iit/blf-developers
Edit: other resources: