tsid  1.8.0
Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio
trajectory-se3.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_se3_hpp__
19 #define __tsid_python_traj_se3_hpp__
20 
22 
24 namespace tsid {
25 namespace python {
26 namespace bp = boost::python;
27 
28 template <typename TrajSE3>
30  : public boost::python::def_visitor<
31  TrajectorySE3ConstantPythonVisitor<TrajSE3> > {
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, pinocchio::SE3>(
38  (bp::arg("name"), bp::arg("reference")),
39  "Default Constructor with name and ref_vec"))
40 
41  .add_property("size", &TrajSE3::size)
43  bp::arg("M_ref"))
45  .def("getLastSample",
47  bp::arg("sample"))
48  .def("has_trajectory_ended",
51  bp::arg("time"));
52  }
53  static void setReference(TrajSE3& self, const pinocchio::SE3& ref) {
54  self.setReference(ref);
55  }
57  return self.computeNext();
58  }
59  static void getLastSample(const TrajSE3& self,
61  self.getLastSample(sample);
62  }
63  static bool has_trajectory_ended(const TrajSE3& self) {
64  return self.has_trajectory_ended();
65  }
66  static trajectories::TrajectorySample getSample(TrajSE3& self, double time) {
67  return self.operator()(time);
68  }
69 
70  static void expose(const std::string& class_name) {
71  std::string doc = "Trajectory SE3 Constant info.";
72  bp::class_<TrajSE3>(class_name.c_str(), doc.c_str(), bp::no_init)
74  }
75 };
76 } // namespace python
77 } // namespace tsid
78 
79 #endif // ifndef __tsid_python_traj_se3_hpp__
Definition: trajectory-base.hpp:33
pinocchio::SE3 SE3
Definition: trajectory-base.hpp:31
Definition: constraint-bound.hpp:25
Definition: trajectory-se3.hpp:31
static void setReference(TrajSE3 &self, const pinocchio::SE3 &ref)
Definition: trajectory-se3.hpp:53
static void getLastSample(const TrajSE3 &self, trajectories::TrajectorySample &sample)
Definition: trajectory-se3.hpp:59
static void expose(const std::string &class_name)
Definition: trajectory-se3.hpp:70
void visit(PyClass &cl) const
Definition: trajectory-se3.hpp:34
static trajectories::TrajectorySample getSample(TrajSE3 &self, double time)
Definition: trajectory-se3.hpp:66
static bool has_trajectory_ended(const TrajSE3 &self)
Definition: trajectory-se3.hpp:63
static trajectories::TrajectorySample computeNext(TrajSE3 &self)
Definition: trajectory-se3.hpp:56