File pybind_helper.hpp¶
Helper functions for creating Python bindings.
- License:
BSD 3-clause
- Copyright
2019, Max Planck Gesellschaft. All rights reserved.
-
template<typename Types>
struct BindTipForceIfExists<Types, decltype((void)Types::Observation::tip_force, 0)>¶ - #include <pybind_helper.hpp>
-
namespace robot_interfaces
Functions
-
template<typename Types>
void create_python_bindings(pybind11::module &m)¶ Create Python bindings for the specified robot Types.
With this function, Python bindings can easily be created for new robots that are based on the NJointRobotTypes. Example:
PYBIND11_MODULE(py_fortytwo_types, m) { create_python_bindings<NJointRobotTypes<42>>(m); }
- Template Parameters
Types – An instance of NJointRobotTypes.
- Parameters
m – The second argument of the PYBIND11_MODULE macro.
-
template<typename Types, typename = int>
struct BindTipForceIfExists¶ - #include <pybind_helper.hpp>
@bind Add Python bindings for Types::Observaton::tip_force if it exists.
Uses black SFINAE magic to add bindings for “tip_force” if it exists. Further the pickle functions differ due to this, so handle this here as well.
Usage:
BindTipForceIfExists<Types>::bind(pybind_class);
This is based on https://stackoverflow.com/a/16000226, see there for an explanation how/why this works.
- template<typename Types> tip_force, 0)>
- #include <pybind_helper.hpp>
Public Static Functions
-
static inline void bind(pybind11::class_<typename Types::Observation> &c)¶
-
static inline void bind(pybind11::class_<typename Types::Observation> &c)¶
-
template<typename Types>