tsid  1.8.0
Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio
trajectory-euclidian.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_euclidian_hpp__
19 #define __tsid_python_traj_euclidian_hpp__
20 
22 
24 namespace tsid {
25 namespace python {
26 namespace bp = boost::python;
27 
28 template <typename Traj>
30  : public boost::python::def_visitor<
31  TrajectoryEuclidianConstantPythonVisitor<Traj> > {
32  template <class PyClass>
33 
34  void visit(PyClass& cl) const {
35  cl.def(bp::init<std::string>((bp::arg("name")),
36  "Default Constructor with name"))
37  .def(bp::init<std::string, Eigen::VectorXd>(
38  (bp::arg("name"), bp::arg("reference")),
39  "Default Constructor with name and ref_vec"))
40 
41  .add_property("size", &Traj::size)
42  .def("setReference",
44  bp::arg("ref_vec"))
45  .def("computeNext",
47  .def("getLastSample",
49  bp::arg("sample"))
50  .def("has_trajectory_ended",
53  bp::arg("time"));
54  }
55  static void setReference(Traj& self, const Eigen::VectorXd& ref) {
56  self.setReference(ref);
57  }
59  return self.computeNext();
60  }
61  static void getLastSample(const Traj& self,
63  self.getLastSample(sample);
64  }
65  static bool has_trajectory_ended(const Traj& self) {
66  return self.has_trajectory_ended();
67  }
68  static trajectories::TrajectorySample getSample(Traj& self, double time) {
69  return self.operator()(time);
70  }
71 
72  static void expose(const std::string& class_name) {
73  std::string doc = "Trajectory Euclidian Constant info.";
74  bp::class_<Traj>(class_name.c_str(), doc.c_str(), bp::no_init)
76  }
77 };
78 } // namespace python
79 } // namespace tsid
80 
81 #endif // ifndef __tsid_python_traj_euclidian_hpp__
Definition: trajectory-base.hpp:33
Definition: constraint-bound.hpp:25
Definition: trajectory-euclidian.hpp:31
static trajectories::TrajectorySample getSample(Traj &self, double time)
Definition: trajectory-euclidian.hpp:68
static void setReference(Traj &self, const Eigen::VectorXd &ref)
Definition: trajectory-euclidian.hpp:55
static bool has_trajectory_ended(const Traj &self)
Definition: trajectory-euclidian.hpp:65
static trajectories::TrajectorySample computeNext(Traj &self)
Definition: trajectory-euclidian.hpp:58
static void expose(const std::string &class_name)
Definition: trajectory-euclidian.hpp:72
void visit(PyClass &cl) const
Definition: trajectory-euclidian.hpp:34
static void getLastSample(const Traj &self, trajectories::TrajectorySample &sample)
Definition: trajectory-euclidian.hpp:61