tsid  1.8.0
Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio
task-actuation-equality.hpp
Go to the documentation of this file.
1 /*
2  * Author: Ram Charan Teja Thota
3  * Date: August 1, 2024
4  *
5  * Description:
6  * this file contain boost python binding for task acutation equality
7  */
8 //
9 // Copyright (c) 2018 CNRS
10 //
11 // This file is part of tsid
12 // tsid is free software: you can redistribute it
13 // and/or modify it under the terms of the GNU Lesser General Public
14 // License as published by the Free Software Foundation, either version
15 // 3 of the License, or (at your option) any later version.
16 // tsid is distributed in the hope that it will be
17 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
18 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 // General Lesser Public License for more details. You should have
20 // received a copy of the GNU Lesser General Public License along with
21 // tsid If not, see
22 // <http://www.gnu.org/licenses/>.
23 //
24 
25 #ifndef __tsid_python_task_actuation_equality_hpp__
26 #define __tsid_python_task_actuation_equality_hpp__
27 
29 
35 
36 namespace tsid {
37 
38 namespace python {
39 namespace bp = boost::python;
40 
41 template <typename TaskAucEq>
43  : public boost::python::def_visitor<
44  TaskActuationEqualityPythonVisitor<TaskAucEq>> {
45  template <class PyClass>
46 
47  void visit(PyClass &cl) const {
48  cl.def(bp::init<std::string, robots::RobotWrapper &>(
49  (bp::arg("name"), bp::arg("robot")), "Default Constructor"))
50 
51  .add_property("dim", &TaskAucEq::dim, "return dimension size")
52 
54  bp::args("t", "q", "v", "data"))
55 
56  .def("getConstraint",
58 
59  .add_property("mask",
60  bp::make_function(
62  bp::return_value_policy<bp::copy_const_reference>()),
63  "Return mask")
64 
66  bp::arg("mask"))
67 
69  bp::arg("ref"))
71  bp::return_value_policy<bp::copy_const_reference>())
72 
73  .def("setWeightVector",
75  bp::arg("weights"))
76  .def("getWeightVector",
78  bp::return_value_policy<bp::copy_const_reference>());
79  }
80 
81  static std::string name(TaskAucEq &self) {
82  std::string name = self.name();
83  return name;
84  }
85 
86  static math::ConstraintEquality compute(TaskAucEq &self, const double t,
87  const Eigen::VectorXd &q,
88  const Eigen::VectorXd &v,
89  pinocchio::Data &data) {
90  self.compute(t, q, v, data);
92  self.getConstraint().matrix(),
93  self.getConstraint().vector());
94  return cons;
95  }
96 
97  static math::ConstraintEquality getConstraint(const TaskAucEq &self) {
99  self.getConstraint().matrix(),
100  self.getConstraint().vector());
101  return cons;
102  }
103 
105  static void setReference(TaskAucEq &self, const Eigen::VectorXd &ref) {
106  self.setReference(ref);
107  }
108 
109  static const Eigen::VectorXd &getReference(const TaskAucEq &self) {
110  return self.getReference();
111  }
112 
113  // getter and setter of weight
114  static void setWeightVector(TaskAucEq &self, const Eigen::VectorXd &weights) {
115  self.setWeightVector(weights);
116  }
117 
118  static const Eigen::VectorXd &getWeightVector(const TaskAucEq &self) {
119  return self.getWeightVector();
120  }
121 
122  // getter and setter of mask
123  static const Eigen::VectorXd &getmask(const TaskAucEq &self) {
124  return self.mask();
125  }
126 
127  static void setmask(TaskAucEq &self, const Eigen::VectorXd mask) {
128  return self.mask(mask);
129  }
130 
131  static void expose(const std::string &class_name) {
132  std::string doc = "TaskActuationEqualityPythonVisitor info.";
133  bp::class_<TaskAucEq>(class_name.c_str(), doc.c_str(), bp::no_init)
135 
136  bp::register_ptr_to_python<boost::shared_ptr<math::ConstraintBase>>();
137  }
138 };
139 
140 } // namespace python
141 } // namespace tsid
142 
143 #endif // ifndef __tsid_python_task_actuation_equality_hpp__
Definition: constraint-equality.hpp:26
pinocchio::Data Data
Definition: inverse-dynamics-formulation-acc-force.cpp:30
Definition: constraint-bound.hpp:25
Definition: task-actuation-equality.hpp:44
static void setWeightVector(TaskAucEq &self, const Eigen::VectorXd &weights)
Definition: task-actuation-equality.hpp:114
static math::ConstraintEquality compute(TaskAucEq &self, const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, pinocchio::Data &data)
Definition: task-actuation-equality.hpp:86
static const Eigen::VectorXd & getmask(const TaskAucEq &self)
Definition: task-actuation-equality.hpp:123
static void setmask(TaskAucEq &self, const Eigen::VectorXd mask)
Definition: task-actuation-equality.hpp:127
static void setReference(TaskAucEq &self, const Eigen::VectorXd &ref)
Definition: task-actuation-equality.hpp:105
static const Eigen::VectorXd & getReference(const TaskAucEq &self)
Definition: task-actuation-equality.hpp:109
static const Eigen::VectorXd & getWeightVector(const TaskAucEq &self)
Definition: task-actuation-equality.hpp:118
static math::ConstraintEquality getConstraint(const TaskAucEq &self)
Definition: task-actuation-equality.hpp:97
static std::string name(TaskAucEq &self)
Definition: task-actuation-equality.hpp:81
void visit(PyClass &cl) const
Definition: task-actuation-equality.hpp:47
static void expose(const std::string &class_name)
Definition: task-actuation-equality.hpp:131