3#include <boost/python.hpp>
4#include <boost/python/implicit.hpp>
5#include <boost/python/module.hpp>
6#include <boost/python/numpy.hpp>
7#include <base/JointState.hpp>
8#include <base/samples/Joints.hpp>
9#include <base/JointLimits.hpp>
11namespace py = boost::python;
12namespace np = boost::python::numpy;
17 base::samples::Joints joints_out;
18 joints_out.elements = joints_in.elements;
19 joints_out.names = joints_in.names;
20 joints_out.time = base::Time::now();
24base::NamedVector<base::JointState>
toNamedVector(
const base::samples::Joints &joints_in){
25 base::NamedVector<base::JointState> joints_out;
26 joints_out.elements = joints_in.elements;
27 joints_out.names = joints_in.names;
31base::NamedVector<base::JointLimitRange>
fromJointLimits(
const base::JointLimits &limits_in){
32 base::NamedVector<base::JointLimitRange> limits_out;
33 limits_out.elements = limits_in.elements;
34 limits_out.names = limits_in.names;
43template <
class Jo
intVectorType>
52 if (!PySequence_Check(obj_ptr))
55 py::list arr = py::extract<py::list>(obj_ptr);
59 static void construct(PyObject* obj_ptr, py::converter::rvalue_from_python_stage1_data* data)
61 py::list arr = py::extract<py::list>(obj_ptr);
62 auto len = py::len(arr);
64 using storage_type = py::converter::rvalue_from_python_storage<JointVectorType>;
65 void* storage =
reinterpret_cast<storage_type*
>(data)->storage.bytes;
67 new (storage) JointVectorType;
68 JointVectorType& vec = *
static_cast<JointVectorType*
>(storage);
72 for (
long i = 0; i < len; ++i)
73 vec[i] = py::extract<base::JointState>(arr[i]);
75 data->convertible = storage;
Definition base_types_conversion.h:41
Definition base_types_conversion.h:14
base::samples::Joints tobaseSamplesJoints(const base::NamedVector< base::JointState > &joints_in)
Definition base_types_conversion.h:16
base::NamedVector< base::JointState > toNamedVector(const base::samples::Joints &joints_in)
Definition base_types_conversion.h:24
base::NamedVector< base::JointLimitRange > fromJointLimits(const base::JointLimits &limits_in)
Definition base_types_conversion.h:31
Definition base_types_conversion.h:44
static void * convertible(PyObject *obj_ptr)
Definition base_types_conversion.h:50
static void construct(PyObject *obj_ptr, py::converter::rvalue_from_python_stage1_data *data)
Definition base_types_conversion.h:59
python_list_to_joint_vector()
Definition base_types_conversion.h:45