bindings/python/tasks/task-com-equality.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_com_hpp__
19 #define __tsid_python_task_com_hpp__
20 
22 
28 namespace tsid {
29 namespace python {
30 namespace bp = boost::python;
31 
32 template <typename TaskCOM>
34  : public boost::python::def_visitor<
35  TaskCOMEqualityPythonVisitor<TaskCOM> > {
36  template <class PyClass>
37 
38  void visit(PyClass& cl) const {
39  cl.def(bp::init<std::string, robots::RobotWrapper&>(
40  (bp::arg("name"), bp::arg("robot")), "Default Constructor"))
41  .add_property("dim", &TaskCOM::dim, "return dimension size")
42  .def("setReference", &TaskCOMEqualityPythonVisitor::setReference,
43  bp::arg("ref"))
44  .add_property("getDesiredAcceleration",
45  bp::make_function(
47  bp::return_value_policy<bp::copy_const_reference>()),
48  "Return Acc_desired")
49  .def("getAcceleration", &TaskCOMEqualityPythonVisitor::getAcceleration,
50  bp::arg("dv"))
51  .add_property("position_error",
52  bp::make_function(
54  bp::return_value_policy<bp::copy_const_reference>()))
55  .add_property("velocity_error",
56  bp::make_function(
58  bp::return_value_policy<bp::copy_const_reference>()))
59  .add_property("position",
60  bp::make_function(
62  bp::return_value_policy<bp::copy_const_reference>()))
63  .add_property("velocity",
64  bp::make_function(
66  bp::return_value_policy<bp::copy_const_reference>()))
67  .add_property("position_ref",
68  bp::make_function(
70  bp::return_value_policy<bp::copy_const_reference>()))
71  .add_property("velocity_ref",
72  bp::make_function(
74  bp::return_value_policy<bp::copy_const_reference>()))
75  .add_property("Kp",
76  bp::make_function(
78  bp::return_value_policy<bp::copy_const_reference>()))
79  .add_property("Kd",
80  bp::make_function(
82  bp::return_value_policy<bp::copy_const_reference>()))
83  .def("setKp", &TaskCOMEqualityPythonVisitor::setKp, bp::arg("Kp"))
84  .def("setKd", &TaskCOMEqualityPythonVisitor::setKd, bp::arg("Kd"))
86  bp::args("t", "q", "v", "data"))
87  .def("getConstraint", &TaskCOMEqualityPythonVisitor::getConstraint)
88  .add_property("name", &TaskCOMEqualityPythonVisitor::name)
89  .add_property("mask",
90  bp::make_function(
92  bp::return_value_policy<bp::copy_const_reference>()),
93  "Return mask")
95  bp::arg("mask"));
96  }
97  static std::string name(TaskCOM& self) {
98  std::string name = self.name();
99  return name;
100  }
101  static math::ConstraintEquality compute(TaskCOM& self, const double t,
102  const Eigen::VectorXd& q,
103  const Eigen::VectorXd& v,
105  self.compute(t, q, v, data);
107  self.getConstraint().matrix(),
108  self.getConstraint().vector());
109  return cons;
110  }
111  static math::ConstraintEquality getConstraint(const TaskCOM& self) {
113  self.getConstraint().matrix(),
114  self.getConstraint().vector());
115  return cons;
116  }
117  static void setReference(TaskCOM& self,
118  const trajectories::TrajectorySample& ref) {
119  self.setReference(ref);
120  }
121  static const Eigen::VectorXd& getDesiredAcceleration(const TaskCOM& self) {
122  return self.getDesiredAcceleration();
123  }
124  static Eigen::VectorXd getAcceleration(TaskCOM& self,
125  const Eigen::VectorXd dv) {
126  return self.getAcceleration(dv);
127  }
128  static const Eigen::VectorXd& position_error(const TaskCOM& self) {
129  return self.position_error();
130  }
131  static const Eigen::VectorXd& velocity_error(const TaskCOM& self) {
132  return self.velocity_error();
133  }
134  static const Eigen::VectorXd& position(const TaskCOM& self) {
135  return self.position();
136  }
137  static const Eigen::VectorXd& velocity(const TaskCOM& self) {
138  return self.velocity();
139  }
140  static const Eigen::VectorXd& position_ref(const TaskCOM& self) {
141  return self.position_ref();
142  }
143  static const Eigen::VectorXd& velocity_ref(const TaskCOM& self) {
144  return self.velocity_ref();
145  }
146  static const Eigen::Vector3d& Kp(TaskCOM& self) { return self.Kp(); }
147  static const Eigen::Vector3d& Kd(TaskCOM& self) { return self.Kd(); }
148  static void setKp(TaskCOM& self, const ::Eigen::VectorXd Kp) {
149  return self.Kp(Kp);
150  }
151  static void setKd(TaskCOM& self, const ::Eigen::VectorXd Kv) {
152  return self.Kd(Kv);
153  }
154  static const Eigen::VectorXd& getmask(const TaskCOM& self) {
155  return self.getMask();
156  }
157  static void setmask(TaskCOM& self, const Eigen::VectorXd mask) {
158  return self.setMask(mask);
159  }
160  static void expose(const std::string& class_name) {
161  std::string doc = "TaskCOMEqualityPythonVisitor info.";
162  bp::class_<TaskCOM>(class_name.c_str(), doc.c_str(), bp::no_init)
164 
165  bp::register_ptr_to_python<boost::shared_ptr<math::ConstraintBase> >();
166  }
167 };
168 } // namespace python
169 } // namespace tsid
170 
171 #endif // ifndef __tsid_python_task_com_hpp__
demo_quadruped.v
v
Definition: demo_quadruped.py:80
boost::python
tsid::python::TaskCOMEqualityPythonVisitor::Kd
static const Eigen::Vector3d & Kd(TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:147
class_name
str class_name(str s)
tsid::trajectories::TrajectorySample
Definition: trajectories/trajectory-base.hpp:33
pinocchio::DataTpl
tsid::python::TaskCOMEqualityPythonVisitor::getConstraint
static math::ConstraintEquality getConstraint(const TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:111
tsid::math::ConstraintEquality
Definition: math/constraint-equality.hpp:26
tsid::python::TaskCOMEqualityPythonVisitor::position
static const Eigen::VectorXd & position(const TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:134
tsid::python::TaskCOMEqualityPythonVisitor::velocity_ref
static const Eigen::VectorXd & velocity_ref(const TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:143
dv
dv
ref
list ref
setup.data
data
Definition: setup.in.py:48
tsid::python::TaskCOMEqualityPythonVisitor::setKd
static void setKd(TaskCOM &self, const ::Eigen::VectorXd Kv)
Definition: bindings/python/tasks/task-com-equality.hpp:151
task-com-equality.hpp
tsid::python::TaskCOMEqualityPythonVisitor::setmask
static void setmask(TaskCOM &self, const Eigen::VectorXd mask)
Definition: bindings/python/tasks/task-com-equality.hpp:157
constraint-equality.hpp
tsid::python::TaskCOMEqualityPythonVisitor::expose
static void expose(const std::string &class_name)
Definition: bindings/python/tasks/task-com-equality.hpp:160
tsid::python::TaskCOMEqualityPythonVisitor::setReference
static void setReference(TaskCOM &self, const trajectories::TrajectorySample &ref)
Definition: bindings/python/tasks/task-com-equality.hpp:117
trajectory-base.hpp
tsid::python::TaskCOMEqualityPythonVisitor::name
static std::string name(TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:97
demo_quadruped.q
q
Definition: demo_quadruped.py:74
tsid::python::TaskCOMEqualityPythonVisitor::getDesiredAcceleration
static const Eigen::VectorXd & getDesiredAcceleration(const TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:121
robot-wrapper.hpp
python
tsid::python::TaskCOMEqualityPythonVisitor::position_ref
static const Eigen::VectorXd & position_ref(const TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:140
tsid::python::TaskCOMEqualityPythonVisitor::velocity_error
static const Eigen::VectorXd & velocity_error(const TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:131
tsid::python::TaskCOMEqualityPythonVisitor
Definition: bindings/python/tasks/task-com-equality.hpp:33
tsid::python::TaskCOMEqualityPythonVisitor::velocity
static const Eigen::VectorXd & velocity(const TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:137
constraint-base.hpp
demo_quadruped.vector
vector
Definition: demo_quadruped.py:49
tsid::python::TaskCOMEqualityPythonVisitor::Kp
static const Eigen::Vector3d & Kp(TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:146
tsid::python::TaskCOMEqualityPythonVisitor::getmask
static const Eigen::VectorXd & getmask(const TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:154
tsid
Definition: bindings/python/constraint/constraint-bound.cpp:21
tsid::python::TaskCOMEqualityPythonVisitor::position_error
static const Eigen::VectorXd & position_error(const TaskCOM &self)
Definition: bindings/python/tasks/task-com-equality.hpp:128
cl
cl
tsid::python::TaskCOMEqualityPythonVisitor::compute
static math::ConstraintEquality compute(TaskCOM &self, const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, pinocchio::Data &data)
Definition: bindings/python/tasks/task-com-equality.hpp:101
fwd.hpp
t
Transform3f t
tsid::python::TaskCOMEqualityPythonVisitor::visit
void visit(PyClass &cl) const
Definition: bindings/python/tasks/task-com-equality.hpp:38
tsid::python::TaskCOMEqualityPythonVisitor::setKp
static void setKp(TaskCOM &self, const ::Eigen::VectorXd Kp)
Definition: bindings/python/tasks/task-com-equality.hpp:148
tsid::python::TaskCOMEqualityPythonVisitor::getAcceleration
static Eigen::VectorXd getAcceleration(TaskCOM &self, const Eigen::VectorXd dv)
Definition: bindings/python/tasks/task-com-equality.hpp:124


tsid
Author(s): Andrea Del Prete, Justin Carpentier
autogenerated on Thu Apr 3 2025 02:47:16