tsid 1.9.0
Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio
Loading...
Searching...
No Matches
task-two-frames-equality.hpp
Go to the documentation of this file.
1//
2// Copyright (c) 2023 MIPT
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_frames_hpp__
19#define __tsid_python_task_frames_hpp__
20
22
28namespace tsid {
29namespace python {
30namespace bp = boost::python;
31
32template <typename TaskFrames>
34 : public boost::python::def_visitor<
35 TaskTwoFramesEqualityPythonVisitor<TaskFrames> > {
36 template <class PyClass>
37
38 void visit(PyClass& cl) const {
39 cl.def(bp::init<std::string, robots::RobotWrapper&, std::string,
40 std::string>((bp::arg("name"), bp::arg("robot"),
41 bp::arg("framename1"), bp::arg("framename2")),
42 "Default Constructor"))
43 .add_property("dim", &TaskFrames::dim, "return dimension size")
44 .add_property(
45 "getDesiredAcceleration",
46 bp::make_function(
48 bp::return_value_policy<bp::copy_const_reference>()),
49 "Return Acc_desired")
50 .def("getAcceleration",
52 bp::arg("dv"))
53 .add_property("position_error",
54 bp::make_function(
56 bp::return_value_policy<bp::copy_const_reference>()))
57 .add_property("velocity_error",
58 bp::make_function(
60 bp::return_value_policy<bp::copy_const_reference>()))
61 .add_property("Kp",
62 bp::make_function(
64 bp::return_value_policy<bp::copy_const_reference>()))
65 .add_property("Kd",
66 bp::make_function(
68 bp::return_value_policy<bp::copy_const_reference>()))
69 .def("setKp", &TaskTwoFramesEqualityPythonVisitor::setKp, bp::arg("Kp"))
70 .def("setKd", &TaskTwoFramesEqualityPythonVisitor::setKd, bp::arg("Kd"))
71 .add_property("mask",
72 bp::make_function(
74 bp::return_value_policy<bp::copy_const_reference>()),
75 "Return mask")
77 bp::arg("mask"))
79 bp::args("t", "q", "v", "data"))
80 .def("getConstraint",
82 .add_property("frame_id1", &TaskFrames::frame_id1, "frame id 1 return")
83 .add_property("frame_id2", &TaskFrames::frame_id2, "frame id 2 return")
84 .add_property("name", &TaskTwoFramesEqualityPythonVisitor::name);
85 }
86 static std::string name(TaskFrames& self) {
87 std::string name = self.name();
88 return name;
89 }
90 static math::ConstraintEquality compute(TaskFrames& self, const double t,
91 const Eigen::VectorXd& q,
92 const Eigen::VectorXd& v,
93 pinocchio::Data& data) {
94 self.compute(t, q, v, data);
95 math::ConstraintEquality cons(self.getConstraint().name(),
96 self.getConstraint().matrix(),
97 self.getConstraint().vector());
98 return cons;
99 }
100 static math::ConstraintEquality getConstraint(const TaskFrames& self) {
101 math::ConstraintEquality cons(self.getConstraint().name(),
102 self.getConstraint().matrix(),
103 self.getConstraint().vector());
104 return cons;
105 }
106 static const Eigen::VectorXd& getDesiredAcceleration(const TaskFrames& self) {
107 return self.getDesiredAcceleration();
108 }
109 static Eigen::VectorXd getAcceleration(TaskFrames& self,
110 const Eigen::VectorXd dv) {
111 return self.getAcceleration(dv);
112 }
113 static const Eigen::VectorXd& position_error(const TaskFrames& self) {
114 return self.position_error();
115 }
116 static const Eigen::VectorXd& velocity_error(const TaskFrames& self) {
117 return self.velocity_error();
118 }
119 static const Eigen::VectorXd& Kp(TaskFrames& self) { return self.Kp(); }
120 static const Eigen::VectorXd& Kd(TaskFrames& self) { return self.Kd(); }
121 static void setKp(TaskFrames& self, const ::Eigen::VectorXd Kp) {
122 return self.Kp(Kp);
123 }
124 static void setKd(TaskFrames& self, const ::Eigen::VectorXd Kv) {
125 return self.Kd(Kv);
126 }
127 static void getMask(TaskFrames& self) { self.getMask(); }
128 static void setMask(TaskFrames& self, const ::Eigen::VectorXd mask) {
129 self.setMask(mask);
130 }
131 static Eigen::VectorXd frame_id1(TaskFrames& self) {
132 return self.frame_id1();
133 }
134 static Eigen::VectorXd frame_id2(TaskFrames& self) {
135 return self.frame_id2();
136 }
137
138 static void expose(const std::string& class_name) {
139 std::string doc = "TaskFrames info.";
140 bp::class_<TaskFrames>(class_name.c_str(), doc.c_str(), bp::no_init)
142
143 // bp::register_ptr_to_python< boost::shared_ptr<math::ConstraintBase> >();
144 }
145};
146} // namespace python
147} // namespace tsid
148
149#endif // ifndef __tsid_python_task_frames_hpp__
Definition constraint-equality.hpp:13
Wrapper for a robot based on pinocchio.
Definition robot-wrapper.hpp:37
Definition constraint-bound.hpp:26
Definition constraint-bound.hpp:25
Definition task-two-frames-equality.hpp:35
static Eigen::VectorXd frame_id1(TaskFrames &self)
Definition task-two-frames-equality.hpp:131
static Eigen::VectorXd frame_id2(TaskFrames &self)
Definition task-two-frames-equality.hpp:134
static const Eigen::VectorXd & Kd(TaskFrames &self)
Definition task-two-frames-equality.hpp:120
static math::ConstraintEquality compute(TaskFrames &self, const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, pinocchio::Data &data)
Definition task-two-frames-equality.hpp:90
static const Eigen::VectorXd & velocity_error(const TaskFrames &self)
Definition task-two-frames-equality.hpp:116
static void setMask(TaskFrames &self, const ::Eigen::VectorXd mask)
Definition task-two-frames-equality.hpp:128
void visit(PyClass &cl) const
Definition task-two-frames-equality.hpp:38
static Eigen::VectorXd getAcceleration(TaskFrames &self, const Eigen::VectorXd dv)
Definition task-two-frames-equality.hpp:109
static void getMask(TaskFrames &self)
Definition task-two-frames-equality.hpp:127
static math::ConstraintEquality getConstraint(const TaskFrames &self)
Definition task-two-frames-equality.hpp:100
static const Eigen::VectorXd & Kp(TaskFrames &self)
Definition task-two-frames-equality.hpp:119
static void expose(const std::string &class_name)
Definition task-two-frames-equality.hpp:138
static void setKd(TaskFrames &self, const ::Eigen::VectorXd Kv)
Definition task-two-frames-equality.hpp:124
static const Eigen::VectorXd & position_error(const TaskFrames &self)
Definition task-two-frames-equality.hpp:113
static std::string name(TaskFrames &self)
Definition task-two-frames-equality.hpp:86
static void setKp(TaskFrames &self, const ::Eigen::VectorXd Kp)
Definition task-two-frames-equality.hpp:121
static const Eigen::VectorXd & getDesiredAcceleration(const TaskFrames &self)
Definition task-two-frames-equality.hpp:106