-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #465 from ami-iit/python/conversions
Implement the python bindings for the manif conversions methods
- Loading branch information
Showing
8 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (C) 2021 Istituto Italiano di Tecnologia (IIT). All rights reserved. | ||
# This software may be modified and distributed under the terms of the | ||
# GNU Lesser General Public License v2.1 or any later version. | ||
|
||
if(FRAMEWORK_COMPILE_ManifConversions) | ||
|
||
set(H_PREFIX include/BipedalLocomotion/bindings/Conversions) | ||
|
||
add_bipedal_locomotion_python_module( | ||
NAME ManifConversionsBindings | ||
SOURCES src/ManifConversions.cpp src/Module.cpp | ||
HEADERS ${H_PREFIX}/ManifConversions.h ${H_PREFIX}/Module.h | ||
LINK_LIBRARIES BipedalLocomotion::ManifConversions) | ||
|
||
endif() |
26 changes: 26 additions & 0 deletions
26
...ings/python/Conversions/include/BipedalLocomotion/bindings/Conversions/ManifConversions.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @file ManifConversions.h | ||
* @authors Giulio Romualdi | ||
* @copyright 2021 Istituto Italiano di Tecnologia (IIT). This software may be modified and | ||
* distributed under the terms of the GNU Lesser General Public License v2.1 or any later version. | ||
*/ | ||
|
||
#ifndef BIPEDAL_LOCOMOTION_BINDINGS_CONVERSIONS_MANIF_CONVERSIONS_H | ||
#define BIPEDAL_LOCOMOTION_BINDINGS_CONVERSIONS_MANIF_CONVERSIONS_H | ||
|
||
#include <pybind11/pybind11.h> | ||
|
||
namespace BipedalLocomotion | ||
{ | ||
namespace bindings | ||
{ | ||
namespace Conversions | ||
{ | ||
|
||
void CreateManifConversions(pybind11::module& module); | ||
|
||
} // namespace Conversions | ||
} // namespace bindings | ||
} // namespace BipedalLocomotion | ||
|
||
#endif // BIPEDAL_LOCOMOTION_BINDINGS_CONVERSIONS_MANIF_CONVERSIONS_H |
26 changes: 26 additions & 0 deletions
26
bindings/python/Conversions/include/BipedalLocomotion/bindings/Conversions/Module.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @file Module.h | ||
* @authors Giulio Romualdi | ||
* @copyright 2021 Istituto Italiano di Tecnologia (IIT). This software may be modified and | ||
* distributed under the terms of the GNU Lesser General Public License v2.1 or any later version. | ||
*/ | ||
|
||
#ifndef BIPEDAL_LOCOMOTION_BINDINGS_CONVERSIONS_MODULE_H | ||
#define BIPEDAL_LOCOMOTION_BINDINGS_CONVERSIONS_MODULE_H | ||
|
||
#include <pybind11/pybind11.h> | ||
|
||
namespace BipedalLocomotion | ||
{ | ||
namespace bindings | ||
{ | ||
namespace Conversions | ||
{ | ||
|
||
void CreateModule(pybind11::module& module); | ||
|
||
} // namespace Conversions | ||
} // namespace bindings | ||
} // namespace BipedalLocomotion | ||
|
||
#endif // BIPEDAL_LOCOMOTION_BINDINGS_CONVERSIONS_MODULE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @file ManifConversions.cpp | ||
* @authors Giulio Romualdi | ||
* @copyright 2021 Istituto Italiano di Tecnologia (IIT). This software may be modified and | ||
* distributed under the terms of the GNU Lesser General Public License v2.1 or any later version. | ||
*/ | ||
|
||
#include <pybind11/eigen.h> | ||
#include <pybind11/pybind11.h> | ||
|
||
#include <Eigen/Dense> | ||
|
||
#include <BipedalLocomotion/Conversions/ManifConversions.h> | ||
|
||
namespace BipedalLocomotion | ||
{ | ||
namespace bindings | ||
{ | ||
namespace Conversions | ||
{ | ||
|
||
void CreateManifConversions(pybind11::module& module) | ||
{ | ||
namespace py = ::pybind11; | ||
|
||
module | ||
.def("to_manif_pose", | ||
py::overload_cast<const Eigen::Matrix<double, 3, 3>&, | ||
const Eigen::Matrix<double, 3, 1>&>( | ||
&::BipedalLocomotion::Conversions::toManifPose<double>), | ||
py::arg("rotation"), | ||
py::arg("translation")) | ||
.def("to_manif_rot", | ||
py::overload_cast<const Eigen::Matrix<double, 3, 3>&>( | ||
&::BipedalLocomotion::Conversions::toManifRot<double>), | ||
py::arg("rotation")); | ||
} | ||
|
||
} // namespace Conversions | ||
} // namespace bindings | ||
} // namespace BipedalLocomotion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @file Module.cpp | ||
* @authors Giulio Romualdi | ||
* @copyright 2021 Istituto Italiano di Tecnologia (IIT). This software may be modified and | ||
* distributed under the terms of the GNU Lesser General Public License v2.1 or any later version. | ||
*/ | ||
|
||
#include <pybind11/pybind11.h> | ||
|
||
#include <BipedalLocomotion/bindings/Conversions/ManifConversions.h> | ||
|
||
namespace BipedalLocomotion | ||
{ | ||
namespace bindings | ||
{ | ||
namespace Conversions | ||
{ | ||
void CreateModule(pybind11::module& module) | ||
{ | ||
module.doc() = "Conversions module."; | ||
|
||
CreateManifConversions(module); | ||
} | ||
} // namespace Conversions | ||
} // namespace bindings | ||
} // namespace BipedalLocomotion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters