Skip to content
Snippets Groups Projects
Commit 4dc2cc71 authored by rua0ra1's avatar rua0ra1 Committed by Guilhem Saurel
Browse files

created and implemeted task actuation equality cpp

parent 442d8bef
No related branches found
No related tags found
No related merge requests found
//
// Copyright (c) 2018 CNRS
//
// This file is part of tsid
// tsid is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
// tsid is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// tsid If not, see
// <http://www.gnu.org/licenses/>.
//
#include "tsid/bindings/python/tasks/task-actuation-equality.hpp"
#include "tsid/bindings/python/tasks/expose-tasks.hpp"
namespace tsid {
namespace python {
void exposeTaskActuationBounds() {
TaskActuationEqualityPythonVisitor<tsid::tasks::TaskActuationEquality>::expose(
"TaskActuationEquality");
}
} // namespace python
} // namespace tsid
......@@ -30,79 +30,95 @@ struct TaskActuationEqualityPythonVisitor
void visit(PyClass &cl) const {
cl.def(bp::init<std::string, robots::RobotWrapper &>(
(bp::arg("name"),bp::arg("robot")),"Default Constructor"))
(bp::arg("name"), bp::arg("robot")), "Default Constructor"))
.add_property("dim", &TaskAucEq::dim, "return dimension size")
.def("compute", &TaskActuationEqualityPythonVisitor::compute,
bp::args("t", "q", "v", "data"))
.def("getConstraint",
&TaskActuationEqualityPythonVisitor::getConstraint)
.add_property("mask",
bp::make_function(
&TaskActuationEqualityPythonVisitor::getmask,
bp::return_value_policy<bp::copy_const_reference>()),
"Return mask")
.add_property("getReference",
bp::make_function(
&TaskCOMEqualityPythonVisitor::getReference,
bp::return_value_policy<bp::copy_const_reference>()))
.def("setMask", &TaskActuationEqualityPythonVisitor::setmask,
bp::arg("mask"))
.def("compute", &TaskActuationEqualityPythonVisitor::compute,
bp::args("t", "q", "v", "data"))
.def("getConstraint", &TaskActuationEqualityPythonVisitor::getConstraint)
.def("setReference", &TaskActuationEqualityPythonVisitor::setReference,
bp::arg("ref"))
.def("getReference", &TaskActuationEqualityPythonVisitor::getReference)
.def("setWeightVector", &TaskActuationEqualityPythonVisitor::setWeightVector,
.def("setWeightVector",
&TaskActuationEqualityPythonVisitor::setWeightVector,
bp::arg("weights"))
.def("getWeightVector",
&TaskActuationEqualityPythonVisitor::getWeightVector);
}
.def("getReference", &TaskActuationEqualityPythonVisitor::getReference)
.def("setReference", &TaskActuationEqualityPythonVisitor::setReference)
static std::string name(TaskAucEq &self) {
std::string name = self.name();
return name;
}
static math::ConstraintEquality compute(TaskAucEq &self, const double t,
const Eigen::VectorXd &q,
const Eigen::VectorXd &v,
pinocchio::Data &data) {
self.compute(t, q, v, data);
math::ConstraintEquality cons(self.getConstraint().name(),
self.getConstraint().matrix(),
self.getConstraint().vector());
return cons;
}
static math::ConstraintEquality compute(TaskAucEq& self, const double t,
const Eigen::VectorXd& q,
const Eigen::VectorXd& v,
pinocchio::Data& data) {
self.compute(t, q, v, data);
math::ConstraintEquality cons(self.getConstraint().name(),
self.getConstraint().matrix(),
self.getConstraint().vector());
return cons;
}
static math::ConstraintEquality getConstraint(const TaskAucEq &self) {
math::ConstraintEquality cons(self.getConstraint().name(),
self.getConstraint().matrix(),
self.getConstraint().vector());
return cons;
}
static math::ConstraintEquality getConstraint(const TaskAucEq& self) {
math::ConstraintEquality cons(self.getConstraint().name(),
self.getConstraint().matrix(),
self.getConstraint().vector());
return cons;
}
//// getter and setter of reference
static void setReference(TaskAucEq& self,
const Eigen::VectorXd& ref) {
self.setReference(ref);
}
static void setReference(TaskAucEq &self, const Eigen::VectorXd &ref) {
self.setReference(ref);
}
static const Eigen::VectorXd& getReference(const TaskAucEq& self) {
return self.getReference();
}
static const Eigen::VectorXd &getReference(const TaskAucEq &self) {
return self.getReference();
}
static void setWeightVector(TaskAucEq& self,
const Eigen::VectorXd& ref) {
self.setReference(ref);
}
// getter and setter of weight
static const Eigen::VectorXd& getWeightVector(const TaskAucEq& self) {
return self.getWeightVector();
}
static void setWeightVector(TaskAucEq &self, const Eigen::VectorXd &ref) {
self.setReference(ref);
}
static const Eigen::VectorXd &getWeightVector(const TaskAucEq &self) {
return self.getWeightVector();
}
// getter and setter of mask
static const Eigen::VectorXd &getmask(const TaskAucEq &self) {
return self.mask();
}
static void setmask(TaskAucEq &self, const Eigen::VectorXd mask) {
return self.mask(mask);
}
static void expose(const std::string& class_name) {
std::string doc = "TaskActuationEqualityPythonVisitor info.";
bp::class_<TaskAucEq>(class_name.c_str(), doc.c_str(), bp::no_init)
.def(TaskActuationEqualityPythonVisitor<TaskAucEq>());
bp::register_ptr_to_python<boost::shared_ptr<math::ConstraintBase> >();
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment