tsid 1.9.0
Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio
Loading...
Searching...
No Matches
task-joint-posture.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_hpp__
19#define __tsid_python_task_joint_hpp__
20
22
28namespace tsid {
29namespace python {
30namespace bp = boost::python;
31
32template <typename TaskJoint>
34 : public boost::python::def_visitor<
35 TaskJointPosturePythonVisitor<TaskJoint> > {
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", &TaskJoint::dim, "return dimension size")
43 bp::arg("ref"))
44 .add_property(
45 "getDesiredAcceleration",
46 bp::make_function(
48 bp::return_value_policy<bp::copy_const_reference>()),
49 "Return Acc_desired")
50 .add_property("mask",
51 bp::make_function(
53 bp::return_value_policy<bp::copy_const_reference>()),
54 "Return mask")
56 bp::arg("mask"))
58 bp::arg("dv"))
59 .add_property("position_error",
60 bp::make_function(
62 bp::return_value_policy<bp::copy_const_reference>()))
63 .add_property("velocity_error",
64 bp::make_function(
66 bp::return_value_policy<bp::copy_const_reference>()))
67 .add_property("position",
68 bp::make_function(
70 bp::return_value_policy<bp::copy_const_reference>()))
71 .add_property("velocity",
72 bp::make_function(
74 bp::return_value_policy<bp::copy_const_reference>()))
75 .add_property("position_ref",
76 bp::make_function(
78 bp::return_value_policy<bp::copy_const_reference>()))
79 .add_property("velocity_ref",
80 bp::make_function(
82 bp::return_value_policy<bp::copy_const_reference>()))
83 .add_property("Kp",
84 bp::make_function(
86 bp::return_value_policy<bp::copy_const_reference>()))
87 .add_property("Kd",
88 bp::make_function(
90 bp::return_value_policy<bp::copy_const_reference>()))
91 .def("setKp", &TaskJointPosturePythonVisitor::setKp, bp::arg("Kp"))
92 .def("setKd", &TaskJointPosturePythonVisitor::setKd, bp::arg("Kd"))
94 bp::args("t", "q", "v", "data"))
96 .add_property("name", &TaskJointPosturePythonVisitor::name);
97 }
98 static std::string name(TaskJoint& self) {
99 std::string name = self.name();
100 return name;
101 }
102 static math::ConstraintEquality compute(TaskJoint& self, const double t,
103 const Eigen::VectorXd& q,
104 const Eigen::VectorXd& v,
105 pinocchio::Data& data) {
106 self.compute(t, q, v, data);
107 math::ConstraintEquality cons(self.getConstraint().name(),
108 self.getConstraint().matrix(),
109 self.getConstraint().vector());
110 return cons;
111 }
112 static math::ConstraintEquality getConstraint(const TaskJoint& self) {
113 math::ConstraintEquality cons(self.getConstraint().name(),
114 self.getConstraint().matrix(),
115 self.getConstraint().vector());
116 return cons;
117 }
118 static void setReference(TaskJoint& self,
120 self.setReference(ref);
121 }
122 static const Eigen::VectorXd& getDesiredAcceleration(const TaskJoint& self) {
123 return self.getDesiredAcceleration();
124 }
125 static const Eigen::VectorXd& getmask(const TaskJoint& self) {
126 return self.getMask();
127 }
128 static void setmask(TaskJoint& self, const Eigen::VectorXd mask) {
129 return self.setMask(mask);
130 }
131 static Eigen::VectorXd getAcceleration(TaskJoint& self,
132 const Eigen::VectorXd dv) {
133 return self.getAcceleration(dv);
134 }
135 static const Eigen::VectorXd& position_error(const TaskJoint& self) {
136 return self.position_error();
137 }
138 static const Eigen::VectorXd& velocity_error(const TaskJoint& self) {
139 return self.velocity_error();
140 }
141 static const Eigen::VectorXd& position(const TaskJoint& self) {
142 return self.position();
143 }
144 static const Eigen::VectorXd& velocity(const TaskJoint& self) {
145 return self.velocity();
146 }
147 static const Eigen::VectorXd& position_ref(const TaskJoint& self) {
148 return self.position_ref();
149 }
150 static const Eigen::VectorXd& velocity_ref(const TaskJoint& self) {
151 return self.velocity_ref();
152 }
153 static const Eigen::VectorXd& Kp(TaskJoint& self) { return self.Kp(); }
154 static const Eigen::VectorXd& Kd(TaskJoint& self) { return self.Kd(); }
155 static void setKp(TaskJoint& self, const ::Eigen::VectorXd Kp) {
156 return self.Kp(Kp);
157 }
158 static void setKd(TaskJoint& self, const ::Eigen::VectorXd Kv) {
159 return self.Kd(Kv);
160 }
161 static void expose(const std::string& class_name) {
162 std::string doc = "TaskJoint info.";
163 bp::class_<TaskJoint>(class_name.c_str(), doc.c_str(), bp::no_init)
165
166 // bp::register_ptr_to_python< boost::shared_ptr<math::ConstraintBase> >();
167 }
168};
169} // namespace python
170} // namespace tsid
171
172#endif // ifndef __tsid_python_task_joint_hpp__
Definition constraint-equality.hpp:13
Definition trajectory-base.hpp:33
Definition constraint-bound.hpp:26
Definition constraint-bound.hpp:25
Definition task-joint-posture.hpp:35
static Eigen::VectorXd getAcceleration(TaskJoint &self, const Eigen::VectorXd dv)
Definition task-joint-posture.hpp:131
static const Eigen::VectorXd & velocity_ref(const TaskJoint &self)
Definition task-joint-posture.hpp:150
static void setReference(TaskJoint &self, const trajectories::TrajectorySample &ref)
Definition task-joint-posture.hpp:118
static const Eigen::VectorXd & velocity_error(const TaskJoint &self)
Definition task-joint-posture.hpp:138
static const Eigen::VectorXd & position_ref(const TaskJoint &self)
Definition task-joint-posture.hpp:147
static const Eigen::VectorXd & Kd(TaskJoint &self)
Definition task-joint-posture.hpp:154
static void setKp(TaskJoint &self, const ::Eigen::VectorXd Kp)
Definition task-joint-posture.hpp:155
static math::ConstraintEquality compute(TaskJoint &self, const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, pinocchio::Data &data)
Definition task-joint-posture.hpp:102
static void expose(const std::string &class_name)
Definition task-joint-posture.hpp:161
static const Eigen::VectorXd & Kp(TaskJoint &self)
Definition task-joint-posture.hpp:153
static const Eigen::VectorXd & getDesiredAcceleration(const TaskJoint &self)
Definition task-joint-posture.hpp:122
static void setmask(TaskJoint &self, const Eigen::VectorXd mask)
Definition task-joint-posture.hpp:128
static const Eigen::VectorXd & getmask(const TaskJoint &self)
Definition task-joint-posture.hpp:125
static const Eigen::VectorXd & velocity(const TaskJoint &self)
Definition task-joint-posture.hpp:144
static void setKd(TaskJoint &self, const ::Eigen::VectorXd Kv)
Definition task-joint-posture.hpp:158
static const Eigen::VectorXd & position(const TaskJoint &self)
Definition task-joint-posture.hpp:141
static math::ConstraintEquality getConstraint(const TaskJoint &self)
Definition task-joint-posture.hpp:112
static std::string name(TaskJoint &self)
Definition task-joint-posture.hpp:98
static const Eigen::VectorXd & position_error(const TaskJoint &self)
Definition task-joint-posture.hpp:135
void visit(PyClass &cl) const
Definition task-joint-posture.hpp:38