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