Loading...
Searching...
No Matches
task-actuation-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_actuation_bounds_hpp__
19#define __tsid_python_task_actuation_bounds_hpp__
20
22
27
28namespace tsid
29{
30 namespace python
31 {
32 namespace bp = boost::python;
33
34 template<typename Task>
36 : public boost::python::def_visitor< TaskActuationBoundsPythonVisitor<Task> >
37 {
38
39 template<class PyClass>
40
41
42 void visit(PyClass& cl) const
43 {
44 cl
45 .def(bp::init<std::string, robots::RobotWrapper &> ((bp::arg("name"), bp::arg("robot")), "Default Constructor"))
46 .add_property("dim", &Task::dim, "return dimension size")
47 .add_property("mask", bp::make_function(&TaskActuationBoundsPythonVisitor::getmask, bp::return_value_policy<bp::copy_const_reference>()), "Return mask")
48 .def("setMask", &TaskActuationBoundsPythonVisitor::setmask, bp::arg("mask"))
49 .def("setBounds", &TaskActuationBoundsPythonVisitor::setBounds, bp::args("lower", "upper"))
50 .def("compute", &TaskActuationBoundsPythonVisitor::compute, bp::args("t", "q", "v", "data"))
52 .add_property("getLowerBounds", bp::make_function(&TaskActuationBoundsPythonVisitor::getLowerBounds, bp::return_value_policy<bp::copy_const_reference>()))
53 .add_property("getUpperBounds", bp::make_function(&TaskActuationBoundsPythonVisitor::getUpperBounds, bp::return_value_policy<bp::copy_const_reference>()))
54 .add_property("name", &TaskActuationBoundsPythonVisitor::name)
55 ;
56 }
57 static std::string name(Task & self){
58 std::string name = self.name();
59 return name;
60 }
61 static math::ConstraintInequality compute(Task & self, const double t, const Eigen::VectorXd & q, const Eigen::VectorXd & v, pinocchio::Data & data){
62 self.compute(t, q, v, data);
63 math::ConstraintInequality cons(self.getConstraint().name(), self.getConstraint().matrix(),
64 self.getConstraint().lowerBound(), self.getConstraint().upperBound());
65 return cons;
66 }
67 static math::ConstraintInequality getConstraint(const Task & self){
68 math::ConstraintInequality cons(self.getConstraint().name(), self.getConstraint().matrix(),
69 self.getConstraint().lowerBound(), self.getConstraint().upperBound());
70 return cons;
71 }
72 static const Eigen::VectorXd & getmask(const Task & self){
73 return self.mask();
74 }
75 static void setmask (Task & self, const Eigen::VectorXd mask){
76 return self.mask(mask);
77 }
78 static const Eigen::VectorXd & getLowerBounds (const Task & self){
79 return self.getLowerBounds();
80 }
81 static const Eigen::VectorXd & getUpperBounds (const Task & self){
82 return self.getUpperBounds();
83 }
84 static void setBounds (Task & self, const Eigen::VectorXd lower, const Eigen::VectorXd upper){
85 return self.setBounds(lower, upper);
86 }
87 static void expose(const std::string & class_name)
88 {
89 std::string doc = "Task info.";
90 bp::class_<Task>(class_name.c_str(),
91 doc.c_str(),
92 bp::no_init)
94 }
95 };
96 }
97}
98
99
100#endif // ifndef __tsid_python_task_actuation_bounds_hpp__
Definition: constraint-inequality.hpp:29
Definition: constraint-bound.hpp:27
Definition: task-actuation-bounds.hpp:37
static const Eigen::VectorXd & getUpperBounds(const Task &self)
Definition: task-actuation-bounds.hpp:81
void visit(PyClass &cl) const
Definition: task-actuation-bounds.hpp:42
static const Eigen::VectorXd & getmask(const Task &self)
Definition: task-actuation-bounds.hpp:72
static const Eigen::VectorXd & getLowerBounds(const Task &self)
Definition: task-actuation-bounds.hpp:78
static void setBounds(Task &self, const Eigen::VectorXd lower, const Eigen::VectorXd upper)
Definition: task-actuation-bounds.hpp:84
static math::ConstraintInequality getConstraint(const Task &self)
Definition: task-actuation-bounds.hpp:67
static void setmask(Task &self, const Eigen::VectorXd mask)
Definition: task-actuation-bounds.hpp:75
static void expose(const std::string &class_name)
Definition: task-actuation-bounds.hpp:87
static math::ConstraintInequality compute(Task &self, const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, pinocchio::Data &data)
Definition: task-actuation-bounds.hpp:61
static std::string name(Task &self)
Definition: task-actuation-bounds.hpp:57