operator-python-module-py.cc
Go to the documentation of this file.
2 #include "operator.hh"
3 
4 namespace dg = dynamicgraph;
5 namespace dgs = dynamicgraph::sot;
6 namespace bp = boost::python;
7 
8 typedef bp::return_value_policy<bp::reference_existing_object>
10 
11 template <typename Operator>
12 void exposeUnaryOp() {
13  typedef dgs::UnaryOp<Operator> O_t;
14  dg::python::exposeEntity<O_t, bp::bases<dg::Entity>,
15  dg::python::AddCommands>()
16  .def_readonly("sin", &O_t::SIN)
17  .def_readonly("sout", &O_t::SOUT);
18 }
19 
20 template <typename Operator>
22  typedef dgs::BinaryOp<Operator> O_t;
23  dg::python::exposeEntity<O_t, bp::bases<dg::Entity>,
24  dg::python::AddCommands>()
25  .def_readonly("sin1", &O_t::SIN1)
26  .def_readonly("sin2", &O_t::SIN2)
27  .def_readonly("sout", &O_t::SOUT);
28 }
29 
30 template <typename Operator>
32  typedef dgs::VariadicOp<Operator> O_t;
33  typedef typename O_t::Base B_t;
34  return dg::python::exposeEntity<O_t, bp::bases<dg::Entity>,
35  dg::python::AddCommands>()
36  .def_readonly("sout", &O_t::SOUT)
37  .def("sin", &B_t::getSignalIn, reference_existing_object())
38  .add_property("n_sin", &B_t::getSignalNumber, &B_t::setSignalNumber,
39  "the number of input signal.")
40 
41  .def("setSignalNumber", &B_t::setSignalNumber,
42  "set the number of input signal.", bp::arg("size"))
43  .def("getSignalNumber", &B_t::getSignalNumber,
44  "get the number of input signal.", bp::arg("size"));
45 }
46 
47 template <typename Operator>
49  static void run() { exposeVariadicOpBase<Operator>(); }
50 };
51 
52 template <typename T>
53 struct exposeVariadicOpImpl<dgs::AdderVariadic<T> > {
54  static void run() {
56  exposeVariadicOpBase<dgs::AdderVariadic<T> >().add_property(
57  "coeffs", +[](E_t &e) { return e.op.coeffs; },
58  +[](E_t &e, const dg::Vector &c) { e.op.setCoeffs(c); },
59  "the multipliers.");
60  }
61 };
62 
63 template <typename Operator>
66 }
67 
69  using namespace dynamicgraph;
70  using namespace dynamicgraph::sot;
71 
72  exposeUnaryOp<VectorSelecter>();
73  exposeUnaryOp<VectorComponent>();
74  exposeUnaryOp<MatrixSelector>();
75  exposeUnaryOp<MatrixColumnSelector>();
76  exposeUnaryOp<MatrixTranspose>();
77  exposeUnaryOp<Diagonalizer>();
78 
79  /* ---------------------------------------------------------------------- */
80  /* --- INVERSION -------------------------------------------------------- */
81  /* ---------------------------------------------------------------------- */
82  exposeUnaryOp<Inverser<Matrix> >();
83  exposeUnaryOp<Inverser<MatrixHomogeneous> >();
84  exposeUnaryOp<Inverser<MatrixTwist> >();
85  exposeUnaryOp<Normalize>();
86  exposeUnaryOp<InverserRotation>();
87  exposeUnaryOp<InverserQuaternion>();
88 
89  /* ----------------------------------------------------------------------- */
90  /* --- SE3/SO3 conversions ----------------------------------------------- */
91  /* ----------------------------------------------------------------------- */
92 
93  exposeUnaryOp<SkewSymToVector>();
94  exposeUnaryOp<PoseUThetaToMatrixHomo>();
95  exposeUnaryOp<MatrixHomoToPoseUTheta>();
96  exposeUnaryOp<MatrixHomoToSE3Vector>();
97  exposeUnaryOp<SE3VectorToMatrixHomo>();
98  exposeUnaryOp<PoseQuaternionToMatrixHomo>();
99  exposeUnaryOp<MatrixHomoToPoseQuaternion>();
100  exposeUnaryOp<MatrixHomoToPoseRollPitchYaw>();
101  exposeUnaryOp<PoseRollPitchYawToMatrixHomo>();
102  exposeUnaryOp<PoseRollPitchYawToPoseUTheta>();
103  exposeUnaryOp<HomoToMatrix>();
104  exposeUnaryOp<MatrixToHomo>();
105  exposeUnaryOp<HomoToTwist>();
106  exposeUnaryOp<HomoToRotation>();
107  exposeUnaryOp<MatrixHomoToPose>();
108  exposeUnaryOp<RPYToMatrix>();
109  exposeUnaryOp<MatrixToRPY>();
110  exposeUnaryOp<RPYToQuaternion>();
111  exposeUnaryOp<QuaternionToRPY>();
112  exposeUnaryOp<QuaternionToMatrix>();
113  exposeUnaryOp<MatrixToQuaternion>();
114  exposeUnaryOp<MatrixToUTheta>();
115  exposeUnaryOp<UThetaToQuaternion>();
116 
117  /* --- MULTIPLICATION --------------------------------------------------- */
118 
119  exposeBinaryOp<Multiplier_double_vector>();
120  exposeBinaryOp<Multiplier_matrix_vector>();
121  exposeBinaryOp<Multiplier_matrixHomo_vector>();
122  exposeBinaryOp<Multiplier_matrixTwist_vector>();
123 
124  /* --- SUBSTRACTION ----------------------------------------------------- */
125  exposeBinaryOp<Substraction<dynamicgraph::Matrix> >();
126  exposeBinaryOp<Substraction<dynamicgraph::Vector> >();
127  exposeBinaryOp<Substraction<double> >();
128 
129  /* --- STACK ------------------------------------------------------------ */
130  exposeBinaryOp<VectorStack>();
131 
132  /* ---------------------------------------------------------------------- */
133  exposeBinaryOp<Composer>();
134 
135  /* --- CONVOLUTION PRODUCT ---------------------------------------------- */
136  exposeBinaryOp<ConvolutionTemporal>();
137 
138  /* --- BOOLEAN REDUCTION ------------------------------------------------ */
139  exposeBinaryOp<Comparison<double> >();
140  exposeBinaryOp<MatrixComparison<Vector> >();
141 
142  exposeBinaryOp<WeightedAdder<dynamicgraph::Matrix> >();
143  exposeBinaryOp<WeightedAdder<dynamicgraph::Vector> >();
144  exposeBinaryOp<WeightedAdder<double> >();
145 
146  /* --- VectorMix ------------------------------------------------------------
147  */
148  exposeVariadicOp<VectorMix>();
149 
150  /* --- ADDITION --------------------------------------------------------- */
151  exposeVariadicOp<AdderVariadic<Matrix> >();
152  exposeVariadicOp<AdderVariadic<Vector> >();
153  exposeVariadicOp<AdderVariadic<double> >();
154 
155  /* --- MULTIPLICATION --------------------------------------------------- */
156  exposeVariadicOp<Multiplier<Matrix> >();
157  exposeVariadicOp<Multiplier<Vector> >();
158  exposeVariadicOp<Multiplier<MatrixRotation> >();
159  exposeVariadicOp<Multiplier<MatrixHomogeneous> >();
160  exposeVariadicOp<Multiplier<MatrixTwist> >();
161  exposeVariadicOp<Multiplier<VectorQuaternion> >();
162  exposeVariadicOp<Multiplier<double> >();
163 
164  /* --- BOOLEAN --------------------------------------------------------- */
165  exposeVariadicOp<BoolOp<0> >();
166  exposeVariadicOp<BoolOp<1> >();
167 }
boost::python
dynamicgraph
BOOST_PYTHON_MODULE
BOOST_PYTHON_MODULE(wrap)
Definition: operator-python-module-py.cc:68
c
Vec3f c
Base
BVNodeBase Base
module.hh
def
void def(const char *name, Func func)
reference_existing_object
bp::return_value_policy< bp::reference_existing_object > reference_existing_object
Definition: operator-python-module-py.cc:9
exposeVariadicOp
void exposeVariadicOp()
Definition: operator-python-module-py.cc:64
exposeVariadicOpImpl::run
static void run()
Definition: operator-python-module-py.cc:49
python
const Eigen::IOFormat python(Eigen::FullPrecision, 0, ", ", ",\n", "[", "]", "[", "]")
dynamicgraph::sot::BinaryOp
Definition: binary-op.hh:40
dynamicgraph::sot::UnaryOp
Definition: unary-op.hh:29
wrap
exposeVariadicOpImpl< dgs::AdderVariadic< T > >::run
static void run()
Definition: operator-python-module-py.cc:54
dynamicgraph::Vector
Eigen::VectorXd Vector
exposeVariadicOpBase
auto exposeVariadicOpBase()
Definition: operator-python-module-py.cc:31
exposeVariadicOpImpl
Definition: operator-python-module-py.cc:48
exposeBinaryOp
void exposeBinaryOp()
Definition: operator-python-module-py.cc:21
dynamicgraph::sot
dynamicgraph::sot::VariadicOp
Definition: variadic-op.hh:139
exposeUnaryOp
void exposeUnaryOp()
Definition: operator-python-module-py.cc:12
operator.hh


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:31