bindings/python/spatial/symmetric3.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2022 INRIA
3 //
4 
5 #ifndef __pinocchio_python_spatial_symmetric3_hpp__
6 #define __pinocchio_python_spatial_symmetric3_hpp__
7 
8 #include <eigenpy/exception.hpp>
9 #include <eigenpy/memory.hpp>
11 #include <boost/python/tuple.hpp>
12 
14 
18 
19 namespace pinocchio
20 {
21  namespace python
22  {
23  namespace bp = boost::python;
24 
25  template<typename Symmetric3>
27  : public boost::python::def_visitor<Symmetric3PythonVisitor<Symmetric3>>
28  {
29  enum
30  {
32  };
33  typedef typename Symmetric3::Scalar Scalar;
34  typedef typename Symmetric3::Vector3 Vector3;
35  typedef typename Symmetric3::Vector6 Vector6;
36  typedef typename Symmetric3::Matrix3 Matrix3;
37  typedef typename Symmetric3::Matrix2 Matrix2;
38  typedef typename Symmetric3::Matrix32 Matrix32;
39 
40  typedef Eigen::Matrix<Scalar, 3, 1, Options> Vector3Like;
41  typedef Eigen::Matrix<Scalar, 3, 3, Options> Matrix3Like;
42  typedef typename Symmetric3::SkewSquare SkewSquare;
43  typedef typename Symmetric3::AlphaSkewSquare AlphaSkewSquare;
44 
45  public:
46  template<class PyClass>
47  void visit(PyClass & cl) const
48  {
49  static const Scalar dummy_precision = Eigen::NumTraits<Scalar>::dummy_precision();
52  cl.def(bp::init<>((bp::arg("self")), "Default constructor."))
53  .def(bp::init<const Matrix3 &>(
54  (bp::arg("self"), bp::arg("I")), "Initialize from symmetrical matrix I of size 3x3."))
55  .def(bp::init<const Vector6 &>(
56  (bp::arg("self"), bp::arg("I")), "Initialize from vector I of size 6."))
57  .def(bp::init<
58  const Scalar &, const Scalar &, const Scalar &, const Scalar &, const Scalar &,
59  const Scalar &>(
60  (bp::arg("self"), bp::arg("a0"), bp::arg("a1"), bp::arg("a2"), bp::arg("a3"),
61  bp::arg("a4"), bp::arg("a5")),
62  "Initialize from 6 scalar values."))
63  .def(
64  bp::init<const Symmetric3 &>((bp::arg("self"), bp::arg("other")), "Copy constructor."))
65  .def("Zero", &Symmetric3::Zero, "Returns a zero 3x3 matrix.")
66  .staticmethod("Zero")
67  .def(
68  "setZero", &Symmetric3::setZero, bp::arg("self"),
69  "Set all the components of *this to zero.")
70  .def("Random", &Symmetric3::Random, "Returns a random symmetric 3x3 matrix.")
71  .staticmethod("Random")
72  .def(
73  "setRandom", &Symmetric3::setRandom, bp::arg("self"),
74  "Set all the components of *this randomly.")
75  .def("Identity", &Symmetric3::Identity, "Returns identity matrix.")
76  .staticmethod("Identity")
77  .def(
78  "setIdentity", &Symmetric3::setIdentity, bp::arg("self"),
79  "Set the components of *this to identity.")
80 #ifndef PINOCCHIO_PYTHON_SKIP_COMPARISON_OPERATIONS
81  .def(bp::self == bp::self)
82  .def(bp::self != bp::self)
83 #endif
84 #ifndef PINOCCHIO_PYTHON_SKIP_COMPARISON_OPERATIONS
85  .def(
86  "isApprox", &Symmetric3::isApprox,
87  (bp::arg("self"), bp::arg("other"), bp::arg("prec") = dummy_precision),
88  "Returns true if *this is approximately equal to other, within the precision given "
89  "by prec.")
90  .def(
91  "isZero", &Symmetric3::isZero, (bp::arg("self"), bp::arg("prec") = dummy_precision),
92  "Returns true if *this is approximately equal to the zero matrix, within the "
93  "precision given by prec.")
94 #endif
95  .def(
96  "setDiagonal", &Symmetric3::template setDiagonal<Vector3Like>, bp::args("self", "diag"),
97  "Set the diagonal elements of 3x3 matrix.")
98  .def(
99  "inverse", &Symmetric3::template inverse<Matrix3Like>, bp::args("self", "res"),
100  "Invert the symmetrical 3x3 matrix.")
101  .def("fill", &Symmetric3::fill, bp::args("self", "value"))
102  .def(bp::self - bp::other<SkewSquare>())
103  .def(bp::self -= bp::other<SkewSquare>())
104  .def(bp::self - bp::other<AlphaSkewSquare>())
105  .def(bp::self -= bp::other<AlphaSkewSquare>())
106  .add_property(
108  "6D vector containing the data of the symmetric 3x3 matrix.")
109  .def(
110  "matrix", &Symmetric3::matrix, bp::arg("self"),
111  "Returns a matrix representation of the data.")
112  .def("vtiv", &Symmetric3::vtiv, bp::args("self", "v"))
113  .def(
114  "vxs", &Symmetric3::template vxs<Vector3>, bp::args("v", "S3"),
115  "Performs the operation \f$ M = [v]_{\times} S_{3} \f$., Apply the cross product of "
116  "v on each column of S and return result matrix M.")
117  .staticmethod("vxs")
118  .def(
119  "svx", &Symmetric3::template vxs<Vector3>, bp::args("v", "S3"),
120  "Performs the operation \f$ M = S_{3} [v]_{\times} \f$.")
121  .staticmethod("svx")
122  .def(
123  "rhsMult", &Symmetric3::template rhsMult<Vector3, Vector3>,
124  bp::args("SE3", "vin", "vout"))
125  .staticmethod("rhsMult")
126 
127  .def(bp::self + bp::self)
128  .def(bp::self += bp::self)
129  .def(bp::self - bp::self)
130  .def(bp::self -= bp::self)
131  .def(bp::self *= bp::other<Scalar>())
132  .def(bp::self * bp::other<Vector3Like>())
133  .def(bp::self - bp::other<Matrix3Like>())
134  .def(bp::self + bp::other<Matrix3Like>())
135 
136  .def(
137  "decomposeltI", &Symmetric3::decomposeltI, bp::arg("self"),
138  "Computes L for a symmetric matrix S.")
139  .def(
140  "rotate", &Symmetric3::template rotate<Matrix3>, bp::args("self", "R"),
141  "Computes R*S*R'")
142 
143 #ifndef PINOCCHIO_PYTHON_NO_SERIALIZATION
144  .def_pickle(Pickle())
145 #endif
146  ;
148  }
149 
150  static Vector6 getData(const Symmetric3 & self)
151  {
152  return self.data();
153  }
154  static void setData(Symmetric3 & self, Vector6 data)
155  {
156  self.data() = data;
157  }
158 
159  static void expose()
160  {
161  bp::class_<Symmetric3>(
162  "Symmetric3",
163  "This class represents symmetric 3x3 matrices.\n\n"
164  "Supported operations ...",
165  bp::no_init)
171  }
172 
173  private:
174  struct Pickle : bp::pickle_suite
175  {
176  static boost::python::tuple getinitargs(const Symmetric3 & I)
177  {
178  return bp::make_tuple(I);
179  }
180  };
181 
182  }; // struct Symmetric3PythonVisitor
183 
184  } // namespace python
185 } // namespace pinocchio
186 
187 #endif // __pinocchio_python_spatial_symmetric3_hpp__
init
void init(bool compute_local_aabb=true)
boost::python
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Options
@ Options
Definition: spatial/symmetric3.hpp:27
pinocchio::python::Symmetric3PythonVisitor::Matrix3Like
Eigen::Matrix< Scalar, 3, 3, Options > Matrix3Like
Definition: bindings/python/spatial/symmetric3.hpp:41
pinocchio::python::Symmetric3PythonVisitor::Matrix3
Symmetric3::Matrix3 Matrix3
Definition: bindings/python/spatial/symmetric3.hpp:36
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Vector3
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
Definition: spatial/symmetric3.hpp:29
pinocchio::python::Symmetric3PythonVisitor::Pickle::getinitargs
static boost::python::tuple getinitargs(const Symmetric3 &I)
Definition: bindings/python/spatial/symmetric3.hpp:176
PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_SELF_ASSIGN_OVERLOADED
#define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_SELF_ASSIGN_OVERLOADED
Definition: include/pinocchio/macros.hpp:134
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::isApprox
bool isApprox(const Symmetric3Tpl &other, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: spatial/symmetric3.hpp:146
pinocchio::python::ExposeConstructorByCastVisitor
Definition: bindings/python/utils/cast.hpp:33
PINOCCHIO_COMPILER_DIAGNOSTIC_POP
#define PINOCCHIO_COMPILER_DIAGNOSTIC_POP
Definition: include/pinocchio/macros.hpp:131
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Scalar
context::Scalar Scalar
Definition: spatial/symmetric3.hpp:24
eigen-to-python.hpp
exception.hpp
pinocchio::python::Symmetric3PythonVisitor::visit
void visit(PyClass &cl) const
Definition: bindings/python/spatial/symmetric3.hpp:47
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::setRandom
void setRandom()
Definition: spatial/symmetric3.hpp:105
pinocchio::python::Symmetric3PythonVisitor::expose
static void expose()
Definition: bindings/python/spatial/symmetric3.hpp:159
pinocchio::python::Symmetric3PythonVisitor::Vector6
Symmetric3::Vector6 Vector6
Definition: bindings/python/spatial/symmetric3.hpp:35
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Matrix3
Eigen::Matrix< Scalar, 3, 3, Options > Matrix3
Definition: spatial/symmetric3.hpp:31
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::vtiv
Scalar vtiv(const Vector3 &v) const
Definition: spatial/symmetric3.hpp:323
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Random
static Symmetric3Tpl Random()
Definition: spatial/symmetric3.hpp:101
cast.hpp
pinocchio::python::Symmetric3PythonVisitor::Vector3
Symmetric3::Vector3 Vector3
Definition: bindings/python/spatial/symmetric3.hpp:34
pinocchio::python::PrintableVisitor
Set the Python method str and repr to use the overloading operator<<.
Definition: printable.hpp:21
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::fill
void fill(const Scalar value)
Definition: spatial/symmetric3.hpp:158
python
symmetric3.hpp
pinocchio::python::CopyableVisitor
Add the Python method copy to allow a copy of this by calling the copy constructor.
Definition: copyable.hpp:21
PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
#define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
macros for pragma push/pop/ignore deprecated warnings
Definition: include/pinocchio/macros.hpp:130
pinocchio::python::Symmetric3PythonVisitor
Definition: bindings/python/spatial/symmetric3.hpp:26
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::isZero
bool isZero(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: spatial/symmetric3.hpp:153
pinocchio::python::Symmetric3PythonVisitor::Vector3Like
Eigen::Matrix< Scalar, 3, 1, Options > Vector3Like
Definition: bindings/python/spatial/symmetric3.hpp:40
pinocchio::python::CastVisitor
Add the Python method cast.
Definition: bindings/python/utils/cast.hpp:23
pinocchio::python::Symmetric3PythonVisitor::SkewSquare
Symmetric3::SkewSquare SkewSquare
Definition: bindings/python/spatial/symmetric3.hpp:42
copyable.hpp
pinocchio::python::Symmetric3PythonVisitor::Scalar
Symmetric3::Scalar Scalar
Definition: bindings/python/spatial/symmetric3.hpp:33
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::matrix
Matrix3 matrix() const
Definition: spatial/symmetric3.hpp:304
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Matrix32
Eigen::Matrix< Scalar, 3, 2, Options > Matrix32
Definition: spatial/symmetric3.hpp:33
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Matrix2
Eigen::Matrix< Scalar, 2, 2, Options > Matrix2
Definition: spatial/symmetric3.hpp:32
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >
pinocchio::python::Symmetric3PythonVisitor::Pickle
Definition: bindings/python/spatial/symmetric3.hpp:174
pinocchio::python::Symmetric3PythonVisitor::getData
static Vector6 getData(const Symmetric3 &self)
Definition: bindings/python/spatial/symmetric3.hpp:150
pinocchio::python::Symmetric3PythonVisitor::Matrix32
Symmetric3::Matrix32 Matrix32
Definition: bindings/python/spatial/symmetric3.hpp:38
pinocchio::python::Symmetric3PythonVisitor::Options
@ Options
Definition: bindings/python/spatial/symmetric3.hpp:31
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Identity
static Symmetric3Tpl Identity()
Definition: spatial/symmetric3.hpp:117
cl
cl
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::decomposeltI
Matrix32 decomposeltI() const
Computes L for a symmetric matrix A.
Definition: spatial/symmetric3.hpp:552
memory.hpp
pinocchio::python::Symmetric3PythonVisitor::AlphaSkewSquare
Symmetric3::AlphaSkewSquare AlphaSkewSquare
Definition: bindings/python/spatial/symmetric3.hpp:43
pinocchio::python::Symmetric3PythonVisitor::setData
static void setData(Symmetric3 &self, Vector6 data)
Definition: bindings/python/spatial/symmetric3.hpp:154
printable.hpp
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::setIdentity
void setIdentity()
Definition: spatial/symmetric3.hpp:121
pinocchio::python::Symmetric3PythonVisitor::Matrix2
Symmetric3::Matrix2 Matrix2
Definition: bindings/python/spatial/symmetric3.hpp:37
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Zero
static Symmetric3Tpl Zero()
Definition: spatial/symmetric3.hpp:92
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::setZero
void setZero()
Definition: spatial/symmetric3.hpp:96
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Vector6
Eigen::Matrix< Scalar, 6, 1, Options > Vector6
Definition: spatial/symmetric3.hpp:30


pinocchio
Author(s):
autogenerated on Tue Jun 25 2024 02:42:41