tsid 1.9.0
Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio
Loading...
Searching...
No Matches
constraint-bound.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_constriant_bound_hpp__
19#define __tsid_python_constriant_bound_hpp__
20
22
24
25namespace tsid {
26namespace python {
27namespace bp = boost::python;
28
29template <typename ConstraintBound>
31 : public boost::python::def_visitor<
32 ConstraintPythonVisitor<ConstraintBound> > {
33 template <class PyClass>
34
35 void visit(PyClass& cl) const {
36 cl.def(bp::init<std::string>((bp::arg("name")),
37 "Default constructor with name."))
38 .def(bp::init<std::string, unsigned int>(
39 (bp::arg("name"), bp::arg("size")),
40 "Default constructor with name and size."))
41 .def(bp::init<std::string, Eigen::VectorXd, Eigen::VectorXd>(
42 (bp::arg("name"), bp::arg("lb"), bp::arg("ub")),
43 "Default constructor with name and constraint."))
44
45 .add_property("rows", &ConstraintBound::rows)
46 .add_property("cols", &ConstraintBound::cols)
47 .def("resize", &ConstraintBound::resize, (bp::arg("r"), bp::arg("c")),
48 "Resize constraint size.")
49
50 .add_property("isEquality", &ConstraintBound::isEquality)
51 .add_property("isInequality", &ConstraintBound::isInequality)
52 .add_property("isBound", &ConstraintBound::isBound)
53
54 .add_property("vector", &ConstraintPythonVisitor::vector)
55 .add_property("lowerBound", &ConstraintPythonVisitor::lowerBound)
56 .add_property("upperBound", &ConstraintPythonVisitor::upperBound)
57
58 .def("setVector",
59 (bool (ConstraintBound::*)(
60 const Eigen::Ref<
61 const Eigen::VectorXd>))&ConstraintBound::setVector,
62 bp::args("vector"), "Set Vector")
63 .def("setLowerBound",
64 (bool (ConstraintBound::*)(
65 const Eigen::Ref<
66 const Eigen::VectorXd>))&ConstraintBound::setLowerBound,
67 bp::args("lb"), "Set LowerBound")
68 .def("setUpperBound",
69 (bool (ConstraintBound::*)(
70 const Eigen::Ref<
71 const Eigen::VectorXd>))&ConstraintBound::setUpperBound,
72 bp::args("ub"), "Set UpperBound");
73 }
74 static Eigen::VectorXd vector(const ConstraintBound& self) {
75 return self.vector();
76 }
77 static Eigen::VectorXd lowerBound(const ConstraintBound& self) {
78 return self.lowerBound();
79 }
80 static Eigen::VectorXd upperBound(const ConstraintBound& self) {
81 return self.upperBound();
82 }
83
84 static void expose(const std::string& class_name) {
85 std::string doc = "Constraint Bound info.";
86 bp::class_<ConstraintBound>(class_name.c_str(), doc.c_str(), bp::no_init)
88 }
89};
90} // namespace python
91} // namespace tsid
92
93#endif // ifndef __tsid_python_constriant_bound_hpp__
Definition constraint-bound.hpp:26
Definition constraint-bound.hpp:25
Definition constraint-bound.hpp:32
static void expose(const std::string &class_name)
Definition constraint-bound.hpp:84
void visit(PyClass &cl) const
Definition constraint-bound.hpp:35
static Eigen::VectorXd lowerBound(const ConstraintBound &self)
Definition constraint-bound.hpp:77
static Eigen::VectorXd vector(const ConstraintBound &self)
Definition constraint-bound.hpp:74
static Eigen::VectorXd upperBound(const ConstraintBound &self)
Definition constraint-bound.hpp:80