From c4a1c5734d581a7799ecd5e3a85853aa7c5e93cd Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Tue, 13 Dec 2022 10:22:22 +0100 Subject: [PATCH 1/5] Enable implicit conversion in the iDynTree bindings --- bindings/iDynTree.i | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindings/iDynTree.i b/bindings/iDynTree.i index 2f7d5091c3b..4a6c2387342 100644 --- a/bindings/iDynTree.i +++ b/bindings/iDynTree.i @@ -1,6 +1,8 @@ /* File : iDynTree.i */ %module iDynTree +%implicitconv; + %include "std_string.i" %include "std_vector.i" From 75d43bcb08fd43d3f311eadf84076506036f5ba9 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Tue, 13 Dec 2022 10:23:02 +0100 Subject: [PATCH 2/5] Change the KinDynComputation holder to std::shared_ptr in swig bindings --- bindings/iDynTree.i | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindings/iDynTree.i b/bindings/iDynTree.i index 4a6c2387342..c9f86e6e69e 100644 --- a/bindings/iDynTree.i +++ b/bindings/iDynTree.i @@ -6,6 +6,7 @@ %include "std_string.i" %include "std_vector.i" +%include "std_shared_ptr.i" // Wrap the std::vector params %template(StringVector) std::vector; @@ -300,6 +301,7 @@ namespace std { %include "iDynTree/InertialParametersSolidShapesHelpers.h" // High level interfaces +%shared_ptr(iDynTree::KinDynComputations) %include "iDynTree/KinDynComputations.h" #ifdef SWIGMATLAB From e911fd279f31487b2b2be6f950f0ba72528164b2 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Tue, 13 Dec 2022 10:34:52 +0100 Subject: [PATCH 3/5] Update the CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84482d1624c..0eed4e63d06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added the possibility to set the alpha channel while loading a model in the meshcat visualizer (https://github.com/robotology/idyntree/pull/1033). - Add the possibility to pass the list containing the mesh path while building the model (https://github.com/robotology/idyntree/pull/1036). +- Enable implicit conversion and change KinDynComputations holder in the iDynTree bindings (https://github.com/robotology/idyntree/pull/1037). ## [7.0.0] - 2022-08-31 From de7b6b1ddb96794c7bba12943e6f40249ca0d8da Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Tue, 13 Dec 2022 16:29:33 +0100 Subject: [PATCH 4/5] Enable std::shared_ptr holder only for python bindigs --- bindings/iDynTree.i | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bindings/iDynTree.i b/bindings/iDynTree.i index c9f86e6e69e..d520c9f5672 100644 --- a/bindings/iDynTree.i +++ b/bindings/iDynTree.i @@ -6,7 +6,11 @@ %include "std_string.i" %include "std_vector.i" + +// std::shared_ptr holder is currently supported only for python bindings +#ifdef SWIGPYTHON %include "std_shared_ptr.i" +#endif // Wrap the std::vector params %template(StringVector) std::vector; @@ -301,7 +305,9 @@ namespace std { %include "iDynTree/InertialParametersSolidShapesHelpers.h" // High level interfaces +#ifdef SWIGPYTHON %shared_ptr(iDynTree::KinDynComputations) +#endif %include "iDynTree/KinDynComputations.h" #ifdef SWIGMATLAB From 9be077867db7f7fcc471ed0efc0f0dd930df0603 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Tue, 13 Dec 2022 17:05:02 +0100 Subject: [PATCH 5/5] Enable the implicit conversion only for the python bindings --- bindings/iDynTree.i | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bindings/iDynTree.i b/bindings/iDynTree.i index d520c9f5672..d8e3614a887 100644 --- a/bindings/iDynTree.i +++ b/bindings/iDynTree.i @@ -1,8 +1,9 @@ /* File : iDynTree.i */ %module iDynTree +#ifdef SWIGPYTHON %implicitconv; - +#endif %include "std_string.i" %include "std_vector.i"