tsid  1.8.0
Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio
task-joint-bounds.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_task_joint_bounds_hpp__
19 #define __tsid_python_task_joint_bounds_hpp__
20 
22 
27 
28 namespace tsid {
29 namespace python {
30 namespace bp = boost::python;
31 
32 template <typename Task>
34  : public boost::python::def_visitor<TaskJointBoundsPythonVisitor<Task> > {
35  template <class PyClass>
36 
37  void visit(PyClass& cl) const {
38  cl.def(bp::init<std::string, robots::RobotWrapper&, double>(
39  (bp::arg("name"), bp::arg("robot"), bp::arg("Time step")),
40  "Default Constructor"))
41  .add_property("dim", &Task::dim, "return dimension size")
42  .def("setTimeStep", &TaskJointBoundsPythonVisitor::setTimeStep,
43  bp::args("dt"))
44  .def("setVelocityBounds",
46  bp::args("lower", "upper"))
47  .def("setAccelerationBounds",
49  bp::args("lower", "upper"))
51  bp::args("t", "q", "v", "data"))
52  .def("getConstraint", &TaskJointBoundsPythonVisitor::getConstraint)
53  .add_property(
54  "getAccelerationLowerBounds",
55  bp::make_function(
57  bp::return_value_policy<bp::copy_const_reference>()))
58  .add_property(
59  "getAccelerationUpperBounds",
60  bp::make_function(
62  bp::return_value_policy<bp::copy_const_reference>()))
63  .add_property("getVelocityLowerBounds",
64  bp::make_function(
66  bp::return_value_policy<bp::copy_const_reference>()))
67  .add_property("getVelocityUpperBounds",
68  bp::make_function(
70  bp::return_value_policy<bp::copy_const_reference>()))
71  .add_property("name", &TaskJointBoundsPythonVisitor::name);
72  }
73  static std::string name(Task& self) {
74  std::string name = self.name();
75  return name;
76  }
77  static math::ConstraintBound compute(Task& self, const double t,
78  const Eigen::VectorXd& q,
79  const Eigen::VectorXd& v,
80  pinocchio::Data& data) {
81  self.compute(t, q, v, data);
83  self.getConstraint().lowerBound(),
84  self.getConstraint().upperBound());
85  return cons;
86  }
87  static math::ConstraintBound getConstraint(const Task& self) {
89  self.getConstraint().lowerBound(),
90  self.getConstraint().upperBound());
91  return cons;
92  }
93  static const Eigen::VectorXd& getAccelerationLowerBounds(const Task& self) {
94  return self.getAccelerationLowerBounds();
95  }
96  static const Eigen::VectorXd& getAccelerationUpperBounds(const Task& self) {
97  return self.getAccelerationUpperBounds();
98  }
99  static const Eigen::VectorXd& getVelocityLowerBounds(const Task& self) {
100  return self.getVelocityLowerBounds();
101  }
102  static const Eigen::VectorXd& getVelocityUpperBounds(const Task& self) {
103  return self.getVelocityUpperBounds();
104  }
105  static void setTimeStep(Task& self, const double dt) {
106  return self.setTimeStep(dt);
107  }
108  static void setVelocityBounds(Task& self, const Eigen::VectorXd lower,
109  const Eigen::VectorXd upper) {
110  return self.setVelocityBounds(lower, upper);
111  }
112  static void setAccelerationBounds(Task& self, const Eigen::VectorXd lower,
113  const Eigen::VectorXd upper) {
114  return self.setAccelerationBounds(lower, upper);
115  }
116  static void expose(const std::string& class_name) {
117  std::string doc = "Task info.";
118  bp::class_<Task>(class_name.c_str(), doc.c_str(), bp::no_init)
120  }
121 };
122 } // namespace python
123 } // namespace tsid
124 
125 #endif // ifndef __tsid_python_task_actuation_bounds_hpp__
Definition: constraint-bound.hpp:26
pinocchio::Data Data
Definition: inverse-dynamics-formulation-acc-force.cpp:30
Definition: constraint-bound.hpp:25
Definition: task-joint-bounds.hpp:34
static const Eigen::VectorXd & getVelocityLowerBounds(const Task &self)
Definition: task-joint-bounds.hpp:99
static math::ConstraintBound getConstraint(const Task &self)
Definition: task-joint-bounds.hpp:87
static void setAccelerationBounds(Task &self, const Eigen::VectorXd lower, const Eigen::VectorXd upper)
Definition: task-joint-bounds.hpp:112
static const Eigen::VectorXd & getVelocityUpperBounds(const Task &self)
Definition: task-joint-bounds.hpp:102
static void expose(const std::string &class_name)
Definition: task-joint-bounds.hpp:116
static void setVelocityBounds(Task &self, const Eigen::VectorXd lower, const Eigen::VectorXd upper)
Definition: task-joint-bounds.hpp:108
void visit(PyClass &cl) const
Definition: task-joint-bounds.hpp:37
static std::string name(Task &self)
Definition: task-joint-bounds.hpp:73
static void setTimeStep(Task &self, const double dt)
Definition: task-joint-bounds.hpp:105
static const Eigen::VectorXd & getAccelerationUpperBounds(const Task &self)
Definition: task-joint-bounds.hpp:96
static const Eigen::VectorXd & getAccelerationLowerBounds(const Task &self)
Definition: task-joint-bounds.hpp:93
static math::ConstraintBound compute(Task &self, const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, pinocchio::Data &data)
Definition: task-joint-bounds.hpp:77