diff --git a/CHANGELOG.md b/CHANGELOG.md index af01fa092..a9c14cffd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Support the new Pinocchio 4 release (https://github.com/Simple-Robotics/aligator/pull/390) +- manifolds: add `PinocchioLieGroup::lieGroup()` getter, expose to Python ### Changed - Deprecate `` (https://github.com/Simple-Robotics/aligator/pull/390) diff --git a/bindings/python/src/modelling/multibody/expose-pinocchio-manifolds.cpp b/bindings/python/src/modelling/multibody/expose-pinocchio-manifolds.cpp index cd2f8561f..c727ada8a 100644 --- a/bindings/python/src/modelling/multibody/expose-pinocchio-manifolds.cpp +++ b/bindings/python/src/modelling/multibody/expose-pinocchio-manifolds.cpp @@ -21,8 +21,10 @@ using PolyManifold = xyz::polymorphic; /// and no-arg default constructor. template void exposeLieGroup(const char *name, const char *docstring) { - bp::class_, bp::bases>( - name, docstring, bp::init<>("self"_a)) + using wrapper_t = PinocchioLieGroup; + bp::class_>(name, docstring, + bp::init<>("self"_a)) + .add_property("lg", &wrapper_t::lieGroup) .def(PolymorphicVisitor()) .enable_pickling_(true); } diff --git a/include/aligator/modelling/spaces/pinocchio-groups.hpp b/include/aligator/modelling/spaces/pinocchio-groups.hpp index 05e98bd40..769d70b09 100644 --- a/include/aligator/modelling/spaces/pinocchio-groups.hpp +++ b/include/aligator/modelling/spaces/pinocchio-groups.hpp @@ -14,15 +14,16 @@ namespace pin = pinocchio; /// Type trait. Indicates whether @tparam G is derived from /// pinocchio::LieGroupBase. template -inline constexpr bool is_pinocchio_lie_group = - std::is_base_of_v, G>; +inline constexpr bool is_pinocchio_lie_group_v = + is_tpl_base_of_v; /// @brief Wrap a Pinocchio Lie group into a ManifoldAbstractTpl object. /// -template > * = nullptr> -struct PinocchioLieGroup : ManifoldAbstractTpl { +template +struct PinocchioLieGroup : ManifoldAbstractTpl { public: - using LieGroup = G; + using LieGroup = LieGroup_; + static_assert(is_pinocchio_lie_group_v); using Scalar = typename LieGroup::Scalar; using Base = ManifoldAbstractTpl; using Base::ndx; @@ -51,6 +52,7 @@ struct PinocchioLieGroup : ManifoldAbstractTpl { } operator LieGroup() const { return lg_; } + LieGroup lieGroup() const { return lg_; } bool isNormalized(const ConstVectorRef &x) const { if (x.size() < nx())