From 8a40642ba9e39f8023e4dbf1cd7f77e559a8a16c Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Sat, 6 Nov 2021 14:49:16 +0100 Subject: [PATCH 01/28] Implement raw buffer constructor for the Position class --- src/core/include/iDynTree/Core/Position.h | 5 +++++ src/core/src/Position.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/core/include/iDynTree/Core/Position.h b/src/core/include/iDynTree/Core/Position.h index 0906e5daed7..1233e4ac51e 100644 --- a/src/core/include/iDynTree/Core/Position.h +++ b/src/core/include/iDynTree/Core/Position.h @@ -67,6 +67,11 @@ namespace iDynTree */ Position(iDynTree::Span other); + /** + * Constructor from a raw buffer of 3 doubles. + */ + Position(const double* in_data, const unsigned int in_size); + /** * Geometric operations */ diff --git a/src/core/src/Position.cpp b/src/core/src/Position.cpp index e0bf0511ec3..35db5b9c44a 100644 --- a/src/core/src/Position.cpp +++ b/src/core/src/Position.cpp @@ -73,6 +73,11 @@ namespace iDynTree { } + Position::Position(const double* in_data, const unsigned int in_size) + : PositionRaw(in_data, in_size) + { + } + const Position& Position::changePoint(const Position& newPoint) { this->PositionRaw::changePoint(newPoint); From f2f6237c3cd4417dabac29d3d42654080d8791e0 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Sat, 6 Nov 2021 14:50:26 +0100 Subject: [PATCH 02/28] Implement pybind11 type_caster for iDynTree core types --- bindings/pybind11/CMakeLists.txt | 3 +- bindings/pybind11/idyntree_type_caster.h | 224 +++++++++++++++++++++++ 2 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 bindings/pybind11/idyntree_type_caster.h diff --git a/bindings/pybind11/CMakeLists.txt b/bindings/pybind11/CMakeLists.txt index 898021d2364..ba500d7dec7 100644 --- a/bindings/pybind11/CMakeLists.txt +++ b/bindings/pybind11/CMakeLists.txt @@ -4,7 +4,8 @@ pybind11_add_module(pybind11_idyntree SYSTEM idyntree.cpp error_utilities.h error_utilities.cpp idyntree_model.h idyntree_model.cpp idyntree_sensors.h idyntree_sensors.cpp - idyntree_modelio_urdf.h idyntree_modelio_urdf.cpp) + idyntree_modelio_urdf.h idyntree_modelio_urdf.cpp + idyntree_type_caster.h) target_link_libraries(pybind11_idyntree PUBLIC idyntree-core idyntree-model diff --git a/bindings/pybind11/idyntree_type_caster.h b/bindings/pybind11/idyntree_type_caster.h new file mode 100644 index 00000000000..5be9cb1330a --- /dev/null +++ b/bindings/pybind11/idyntree_type_caster.h @@ -0,0 +1,224 @@ +#ifndef IDYNTREE_PYBIND11_IDYNTREE_TYPE_CASTER_H +#define IDYNTREE_PYBIND11_IDYNTREE_TYPE_CASTER_H + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +namespace pybind11 +{ +namespace detail +{ +template