Loading...
Searching...
No Matches
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
28namespace tsid
29{
30 namespace python
31 {
32 namespace bp = boost::python;
33
34 template<typename Task>
36 : public boost::python::def_visitor< TaskJointBoundsPythonVisitor<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 &, double> ((bp::arg("name"), bp::arg("robot"), bp::arg("Time step")), "Default Constructor"))
46 .add_property("dim", &Task::dim, "return dimension size")
47 .def("setTimeStep", &TaskJointBoundsPythonVisitor::setTimeStep, bp::args("dt"))
48 .def("setVelocityBounds", &TaskJointBoundsPythonVisitor::setVelocityBounds, bp::args("lower", "upper"))
49 .def("setAccelerationBounds", &TaskJointBoundsPythonVisitor::setAccelerationBounds, bp::args("lower", "upper"))
50 .def("compute", &TaskJointBoundsPythonVisitor::compute, bp::args("t", "q", "v", "data"))
52 .add_property("getAccelerationLowerBounds", bp::make_function(&TaskJointBoundsPythonVisitor::getAccelerationLowerBounds, bp::return_value_policy<bp::copy_const_reference>()))
53 .add_property("getAccelerationUpperBounds", bp::make_function(&TaskJointBoundsPythonVisitor::getAccelerationUpperBounds, bp::return_value_policy<bp::copy_const_reference>()))
54 .add_property("getVelocityLowerBounds", bp::make_function(&TaskJointBoundsPythonVisitor::getVelocityLowerBounds, bp::return_value_policy<bp::copy_const_reference>()))
55 .add_property("getVelocityUpperBounds", bp::make_function(&TaskJointBoundsPythonVisitor::getVelocityUpperBounds, bp::return_value_policy<bp::copy_const_reference>()))
56 .add_property("name", &TaskJointBoundsPythonVisitor::name)
57 ;
58 }
59 static std::string name(Task & self){
60 std::string name = self.name();
61 return name;
62 }
63 static math::ConstraintBound compute(Task & self, const double t, const Eigen::VectorXd & q, const Eigen::VectorXd & v, pinocchio::Data & data){
64 self.compute(t, q, v, data);
65 math::ConstraintBound cons(self.getConstraint().name(),
66 self.getConstraint().lowerBound(),
67 self.getConstraint().upperBound());
68 return cons;
69 }
70 static math::ConstraintBound getConstraint(const Task & self){
71 math::ConstraintBound cons(self.getConstraint().name(),
72 self.getConstraint().lowerBound(),
73 self.getConstraint().upperBound());
74 return cons;
75 }
76 static const Eigen::VectorXd & getAccelerationLowerBounds (const Task & self){
77 return self.getAccelerationLowerBounds();
78 }
79 static const Eigen::VectorXd & getAccelerationUpperBounds (const Task & self){
80 return self.getAccelerationUpperBounds();
81 }
82 static const Eigen::VectorXd & getVelocityLowerBounds (const Task & self){
83 return self.getVelocityLowerBounds();
84 }
85 static const Eigen::VectorXd & getVelocityUpperBounds (const Task & self){
86 return self.getVelocityUpperBounds();
87 }
88 static void setTimeStep (Task & self, const double dt){
89 return self.setTimeStep(dt);
90 }
91 static void setVelocityBounds (Task & self, const Eigen::VectorXd lower, const Eigen::VectorXd upper){
92 return self.setVelocityBounds(lower, upper);
93 }
94 static void setAccelerationBounds (Task & self, const Eigen::VectorXd lower, const Eigen::VectorXd upper){
95 return self.setAccelerationBounds(lower, upper);
96 }
97 static void expose(const std::string & class_name)
98 {
99 std::string doc = "Task info.";
100 bp::class_<Task>(class_name.c_str(),
101 doc.c_str(),
102 bp::no_init)
104 }
105 };
106 }
107}
108
109
110#endif // ifndef __tsid_python_task_actuation_bounds_hpp__
Definition: constraint-bound.hpp:29
Definition: constraint-bound.hpp:27
Definition: task-joint-bounds.hpp:37
static math::ConstraintBound getConstraint(const Task &self)
Definition: task-joint-bounds.hpp:70
static const Eigen::VectorXd & getAccelerationUpperBounds(const Task &self)
Definition: task-joint-bounds.hpp:79
static void setAccelerationBounds(Task &self, const Eigen::VectorXd lower, const Eigen::VectorXd upper)
Definition: task-joint-bounds.hpp:94
static void expose(const std::string &class_name)
Definition: task-joint-bounds.hpp:97
static void setVelocityBounds(Task &self, const Eigen::VectorXd lower, const Eigen::VectorXd upper)
Definition: task-joint-bounds.hpp:91
static const Eigen::VectorXd & getAccelerationLowerBounds(const Task &self)
Definition: task-joint-bounds.hpp:76
void visit(PyClass &cl) const
Definition: task-joint-bounds.hpp:42
static const Eigen::VectorXd & getVelocityLowerBounds(const Task &self)
Definition: task-joint-bounds.hpp:82
static const Eigen::VectorXd & getVelocityUpperBounds(const Task &self)
Definition: task-joint-bounds.hpp:85
static std::string name(Task &self)
Definition: task-joint-bounds.hpp:59
static void setTimeStep(Task &self, const double dt)
Definition: task-joint-bounds.hpp:88
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:63