6 #ifndef __pinocchio_python_spatial_se3_hpp__ 7 #define __pinocchio_python_spatial_se3_hpp__ 11 #include <boost/python/tuple.hpp> 13 #include "pinocchio/spatial/se3.hpp" 14 #include "pinocchio/spatial/motion.hpp" 15 #include "pinocchio/spatial/force.hpp" 16 #include "pinocchio/spatial/inertia.hpp" 17 #include "pinocchio/spatial/explog.hpp" 31 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(isIdentity_overload,
SE3::isIdentity,0,1)
33 template<typename
T> struct
call;
40 static bool isApprox(
const SE3 &
self,
const SE3 & other,
41 const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision())
43 return self.isApprox(other,prec);
49 template<
typename SE3>
51 :
public boost::python::def_visitor< SE3PythonVisitor<SE3> >
61 template<
class PyClass>
65 .def(bp::init<Matrix3,Vector3>
66 (bp::args(
"self",
"rotation",
"translation"),
67 "Initialize from a rotation matrix and a translation vector."))
68 .def(bp::init<Quaternion,Vector3>
69 (bp::args(
"self",
"quat",
"translation"),
70 "Initialize from a quaternion and a translation vector."))
71 .def(bp::init<int>(bp::args(
"self",
"int"),
"Init to identity."))
72 .def(bp::init<SE3>(bp::args(
"self",
"other"),
"Copy constructor."))
73 .def(bp::init<Matrix4>
74 (bp::args(
"self",
"array"),
75 "Initialize from an homogeneous matrix."))
77 .add_property(
"rotation",
78 bp::make_function((
typename SE3::AngularRef (SE3::*)()) &
SE3::rotation,bp::return_internal_reference<>()),
80 "The rotation part of the transformation.")
81 .add_property(
"translation",
82 bp::make_function((
typename SE3::LinearRef (SE3::*)()) &
SE3::translation,bp::return_internal_reference<>()),
84 "The translation part of the transformation.")
87 "Returns the equivalent homegeneous matrix (acting on SE3).")
89 "Returns the related action matrix (acting on Motion).")
91 "Returns the related action matrix (acting on Motion).")
93 "Returns the inverse of the action matrix (acting on Motion).\n" 94 "This is equivalent to do m.inverse().action")
96 "Returns the inverse of the action matrix (acting on Motion).\n" 97 "This is equivalent to do m.inverse().toActionMatrix()")
99 "Returns the related dual action matrix (acting on Force).")
101 "Returns the related dual action matrix (acting on Force).")
104 "Set *this to the identity placement.")
106 "Set *this to a random placement.")
109 "Returns the inverse transform")
111 .def(
"act", (Vector3 (SE3::*)(
const Vector3 &)
const) &
SE3::act,
112 bp::args(
"self",
"point"),
113 "Returns a point which is the result of the entry point transforms by *this.")
114 .def(
"actInv", (Vector3 (SE3::*)(
const Vector3 &)
const) &
SE3::actInv,
115 bp::args(
"self",
"point"),
116 "Returns a point which is the result of the entry point by the inverse of *this.")
118 .def(
"act", (SE3 (SE3::*)(
const SE3 & other)
const) &SE3::act,
119 bp::args(
"self",
"M"),
"Returns the result of *this * M.")
120 .def(
"actInv", (SE3 (SE3::*)(
const SE3 & other)
const) &SE3::actInv,
121 bp::args(
"self",
"M"),
"Returns the result of the inverse of *this times M.")
123 .def(
"act", (
Motion (SE3::*)(
const Motion &)
const) &SE3::act,
124 bp::args(
"self",
"motion"),
"Returns the result action of *this onto a Motion.")
125 .def(
"actInv", (
Motion (SE3::*)(
const Motion &)
const) &SE3::actInv,
126 bp::args(
"self",
"motion"),
"Returns the result of the inverse of *this onto a Motion.")
128 .def(
"act", (
Force (SE3::*)(
const Force &)
const) &SE3::act,
129 bp::args(
"self",
"force"),
"Returns the result of *this onto a Force.")
130 .def(
"actInv", (
Force (SE3::*)(
const Force &)
const) &SE3::actInv,
131 bp::args(
"self",
"force"),
"Returns the result of the inverse of *this onto an Inertia.")
134 bp::args(
"self",
"inertia"),
"Returns the result of *this onto a Force.")
135 .def(
"actInv", (
Inertia (SE3::*)(
const Inertia &)
const) &SE3::actInv,
136 bp::args(
"self",
"inertia"),
"Returns the result of the inverse of *this onto an Inertia.")
140 isApproxSE3_overload(bp::args(
"self",
"other",
"prec"),
141 "Returns true if *this is approximately equal to other, within the precision given by prec."))
145 isIdentity_overload(bp::args(
"self",
"prec"),
146 "Returns true if *this is approximately equal to the identity placement, within the precision given by prec."))
148 .def(
"__invert__",&
SE3::inverse,
"Returns the inverse of *this.")
149 .def(bp::self * bp::self)
150 .def(
"__mul__",&__mul__<Motion>)
151 .def(
"__mul__",&__mul__<Force>)
152 .def(
"__mul__",&__mul__<Inertia>)
153 .def(
"__mul__",&__mul__<Vector3>)
156 .def(bp::self == bp::self)
157 .def(bp::self != bp::self)
159 .def(
"Identity",&
SE3::Identity,
"Returns the identity transformation.")
160 .staticmethod(
"Identity")
161 .def(
"Random",&
SE3::Random,
"Returns a random transformation.")
162 .staticmethod(
"Random")
163 .def(
"Interpolate",&SE3::template Interpolate<double>,
164 bp::args(
"A",
"B",
"alpha"),
165 "Linear interpolation on the SE3 manifold.\n\n" 166 "This method computes the linear interpolation between A and B, such that the result C = A + (B-A)*t if it would be applied on classic Euclidian space.\n" 167 "This operation is very similar to the SLERP operation on Rotations.\n" 169 "\tA: Initial transformation\n" 170 "\tB: Target transformation\n" 171 "\talpha: Interpolation factor")
172 .staticmethod(
"Interpolate")
182 #if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 6 && EIGENPY_VERSION_AT_LEAST(2,9,0) 185 typedef ::boost::python::detail::not_specified HolderType;
187 bp::class_<SE3,HolderType>(
"SE3",
188 "SE3 transformation defined by a 3d vector and a rotation matrix.",
189 bp::init<>(bp::arg(
"self"),
"Default constructor."))
211 template<
typename Spatial>
212 static Spatial
__mul__(
const SE3 &
self,
const Spatial & other)
213 {
return self.act(other); }
219 #endif // ifndef __pinocchio_python_spatial_se3_hpp__
SE3GroupAction< D >::ReturnType actInv(const D &d) const
by = aXb.actInv(ay)
static boost::python::tuple getinitargs(const SE3 &M)
Set the Python method str and repr to use the overloading operator<<.
bool isIdentity(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
BOOST_PYTHON_FUNCTION_OVERLOADS(computeKKTContactDynamicMatrixInverse_overload, computeKKTContactDynamicMatrixInverse_proxy, 4, 5) static const Eigen
static Spatial __mul__(const SE3 &self, const Spatial &other)
SE3::Quaternion Quaternion
ActionMatrixType toDualActionMatrix() const
static void setRandom(SE3 &self)
ActionMatrixType toActionMatrix() const
The action matrix of .
void visit(PyClass &cl) const
static bool isApprox(const SE3 &self, const SE3 &other, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision())
Eigen::Quaternion< Scalar, Options > Quaternion
SE3Tpl< Scalar, Options > SE3
SE3Tpl inverse() const
aXb = bXa.inverse()
#define PINOCCHIO_SHARED_PTR_HOLDER_TYPE(T)
traits< SE3Tpl >::Matrix4 Matrix4
Add the Python method copy to allow a copy of this by calling the copy constructor.
static bool getstate_manages_dict()
HomogeneousMatrixType toHomogeneousMatrix() const
traits< SE3Tpl >::Vector3 Vector3
ConstAngularRef rotation() const
Main pinocchio namespace.
auto call(R(*f)(Args...), typename convert_type< Args >::type... args)
SE3GroupAction< D >::ReturnType act(const D &d) const
ay = aXb.act(by)
ActionMatrixType toActionMatrixInverse() const
The action matrix of .
#define EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(...)
traits< SE3Tpl >::Matrix3 Matrix3
static void setIdentity(SE3 &self)
ConstLinearRef translation() const