16 typedef Eigen::Matrix<Scalar, Eigen::Dynamic,1>
VectorXd;
18 typedef Eigen::Map< SE3::Quaternion>
QuatMap;
24 res.head<3>() =
M.translation();
32 return bp::make_tuple (
33 M.translation()(0),
M.translation()(1),
M.translation()(2),
34 q.x(),
q.y(),
q.z(),
q.w());
37 template <
typename TupleOrList>
40 bp::ssize_t
size = bp::len(
v);
43 throw std::invalid_argument(
44 "Wrong size: v(" + std::to_string(
size) +
") should have 7 elements");
47 static_cast<Scalar>(bp::extract<Scalar>(
v[6])),
48 static_cast<Scalar>(bp::extract<Scalar>(
v[3])),
49 static_cast<Scalar>(bp::extract<Scalar>(
v[4])),
50 static_cast<Scalar>(bp::extract<Scalar>(
v[5])));
52 static_cast<Scalar>(bp::extract<Scalar>(
v[0])),
53 static_cast<Scalar>(bp::extract<Scalar>(
v[1])),
54 static_cast<Scalar>(bp::extract<Scalar>(
v[2])));
55 return SE3 (
q.matrix(),
t);
58 template <
typename Vector7Like>
61 if(
v.rows() != 7 ||
v.cols() != 1)
63 std::ostringstream shape;
64 shape <<
"(" <<
v.rows() <<
", " <<
v.cols() <<
")";
65 throw std::invalid_argument(
"Wrong size: v" + shape.str() +
" but should have the following shape (7, 1)");
68 return SE3 (
q.matrix(),
v.template head<3>());
73 const char* doc1 =
"Convert the input SE3 object to a numpy array.";
75 const char* doc1_tuple =
"Convert the input SE3 object to a 7D tuple of floats [X,Y,Z,x,y,z,w].";
78 const char* doc2 =
"Reverse function of SE3ToXYZQUAT: convert [X,Y,Z,x,y,z,w] to an SE3 element.";
79 bp::def(
"XYZQUATToSE3",
80 static_cast<SE3 (*) (
const bp::tuple&)
> (XYZQUATToSE3_bp<bp::tuple>),
81 bp::arg(
"tuple"),doc2);
82 bp::def(
"XYZQUATToSE3",
83 static_cast<SE3 (*) (
const bp::list &)
> (XYZQUATToSE3_bp<bp::list >),
84 bp::arg(
"list"),doc2);
85 bp::def(
"XYZQUATToSE3",
static_cast<SE3 (*) (
const VectorXd &)
> (XYZQUATToSE3_ei<VectorXd >),
86 bp::arg(
"array"),doc2);