bindings/python/trajectories/trajectory-base.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018 CNRS
3 //
4 // This file is part of tsid
5 // tsid is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 // tsid is distributed in the hope that it will be
10 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Lesser Public License for more details. You should have
13 // received a copy of the GNU Lesser General Public License along with
14 // tsid If not, see
15 // <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef __tsid_python_traj_sample_hpp__
19 #define __tsid_python_traj_sample_hpp__
20 
22 
23 #include <tsid/math/utils.hpp>
25 
26 #include <pinocchio/bindings/python/utils/deprecation.hpp>
27 #include <assert.h>
28 namespace tsid {
29 namespace python {
30 namespace bp = boost::python;
32 
33 template <typename TrajSample>
35  : public boost::python::def_visitor<
36  TrajectorySamplePythonVisitor<TrajSample> > {
37  template <class PyClass>
38 
39  void visit(PyClass& cl) const {
40  cl.def(bp::init<unsigned int>((bp::arg("size")),
41  "Default Constructor with size"))
42  .def(bp::init<unsigned int, unsigned int>(
43  (bp::arg("value_size"), bp::arg("derivative_size")),
44  "Default Constructor with value and derivative size"))
45 
46  .def("resize", &TrajectorySamplePythonVisitor::resize, bp::arg("size"))
48  bp::args("value_size", "derivative_size"))
49 
52  .def("second_derivative",
54 
58  .def("second_derivative",
60 
61  // Deprecated methods:
64  "This method is now deprecated. Please use .value"))
67  "This method is now deprecated. Please use .derivative"))
68  .def(
71  "This method is now deprecated. Please use .second_derivative"))
72 
75  "This method is now deprecated. Please use .value"))
78  "This method is now deprecated. Please use .value"))
81  "This method is now deprecated. Please use .derivative"))
84  "This method is now deprecated. Please use "
85  ".second_derivative"));
86  }
87 
88  static void setvalue_vec(TrajSample& self, const Eigen::VectorXd value) {
89  assert(self.getValue().size() == value.size());
90  self.setValue(value);
91  }
92  static void setvalue_se3(TrajSample& self, const pinocchio::SE3& value) {
93  assert(self.getValue().size() == 12);
98  }
99  static void setderivative(TrajSample& self,
100  const Eigen::VectorXd derivative) {
101  assert(self.getDerivative().size() == derivative.size());
102  self.setDerivative(derivative);
103  }
104  static void setsecond_derivative(TrajSample& self,
105  const Eigen::VectorXd second_derivative) {
106  assert(self.getSecondDerivative().size() == second_derivative.size());
107  self.setSecondDerivative(second_derivative);
108  }
109  static void resize(TrajSample& self, const unsigned int& size) {
110  self.resize(size, size);
111  }
112  static void resize2(TrajSample& self, const unsigned int& value_size,
113  const unsigned int& derivative_size) {
114  self.resize(value_size, derivative_size);
115  }
116  static Eigen::VectorXd value(const TrajSample& self) {
117  return self.getValue();
118  }
119  static Eigen::VectorXd derivative(const TrajSample& self) {
120  return self.getDerivative();
121  }
122  static Eigen::VectorXd second_derivative(const TrajSample& self) {
123  return self.getSecondDerivative();
124  }
125 
126  static void expose(const std::string& class_name) {
127  std::string doc = "Trajectory Sample info.";
128  bp::class_<TrajSample>(class_name.c_str(), doc.c_str(), bp::no_init)
130  }
131 };
132 } // namespace python
133 } // namespace tsid
134 
135 #endif // ifndef __tsid_python_traj_euclidian_hpp__
boost::python
class_name
str class_name(str s)
tsid::python::TrajectorySamplePythonVisitor::derivative
static Eigen::VectorXd derivative(const TrajSample &self)
Definition: bindings/python/trajectories/trajectory-base.hpp:119
pinocchio::SE3
context::SE3 SE3
utils.hpp
TSID_DISABLE_WARNING_POP
#define TSID_DISABLE_WARNING_POP
Definition: macros.hpp:28
TSID_DISABLE_WARNING_DEPRECATED
#define TSID_DISABLE_WARNING_DEPRECATED
Definition: macros.hpp:29
TSID_DISABLE_WARNING_PUSH
#define TSID_DISABLE_WARNING_PUSH
Definition: macros.hpp:27
tsid::python::TrajectorySamplePythonVisitor::setsecond_derivative
static void setsecond_derivative(TrajSample &self, const Eigen::VectorXd second_derivative)
Definition: bindings/python/trajectories/trajectory-base.hpp:104
tsid::python::TrajectorySamplePythonVisitor::second_derivative
static Eigen::VectorXd second_derivative(const TrajSample &self)
Definition: bindings/python/trajectories/trajectory-base.hpp:122
tsid::python::SE3
pinocchio::SE3 SE3
Definition: bindings/python/trajectories/trajectory-base.hpp:31
pinocchio::python::deprecated_function
tsid::python::TrajectorySamplePythonVisitor::expose
static void expose(const std::string &class_name)
Definition: bindings/python/trajectories/trajectory-base.hpp:126
trajectory-base.hpp
tsid::python::TrajectorySamplePythonVisitor::setvalue_se3
static void setvalue_se3(TrajSample &self, const pinocchio::SE3 &value)
Definition: bindings/python/trajectories/trajectory-base.hpp:92
tsid::python::TrajectorySamplePythonVisitor::resize2
static void resize2(TrajSample &self, const unsigned int &value_size, const unsigned int &derivative_size)
Definition: bindings/python/trajectories/trajectory-base.hpp:112
python
size
FCL_REAL size() const
pos
pos
tsid::math::SE3ToVector
void SE3ToVector(const pinocchio::SE3 &M, RefVector vec)
Definition: src/math/utils.cpp:30
tsid::python::TrajectorySamplePythonVisitor::resize
static void resize(TrajSample &self, const unsigned int &size)
Definition: bindings/python/trajectories/trajectory-base.hpp:109
tsid::python::TrajectorySamplePythonVisitor::value
static Eigen::VectorXd value(const TrajSample &self)
Definition: bindings/python/trajectories/trajectory-base.hpp:116
tsid
Definition: bindings/python/constraint/constraint-bound.cpp:21
tsid::python::TrajectorySamplePythonVisitor::setvalue_vec
static void setvalue_vec(TrajSample &self, const Eigen::VectorXd value)
Definition: bindings/python/trajectories/trajectory-base.hpp:88
tsid::python::TrajectorySamplePythonVisitor
Definition: bindings/python/trajectories/trajectory-base.hpp:34
cl
cl
fwd.hpp
tsid::python::TrajectorySamplePythonVisitor::setderivative
static void setderivative(TrajSample &self, const Eigen::VectorXd derivative)
Definition: bindings/python/trajectories/trajectory-base.hpp:99
tsid::python::TrajectorySamplePythonVisitor::visit
void visit(PyClass &cl) const
Definition: bindings/python/trajectories/trajectory-base.hpp:39


tsid
Author(s): Andrea Del Prete, Justin Carpentier
autogenerated on Sat May 3 2025 02:48:17