GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
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_se3_hpp__ |
||
19 |
#define __tsid_python_task_se3_hpp__ |
||
20 |
|||
21 |
#include "tsid/bindings/python/fwd.hpp" |
||
22 |
|||
23 |
#include "tsid/tasks/task-se3-equality.hpp" |
||
24 |
#include "tsid/robots/robot-wrapper.hpp" |
||
25 |
#include "tsid/trajectories/trajectory-base.hpp" |
||
26 |
#include "tsid/math/constraint-equality.hpp" |
||
27 |
#include "tsid/math/constraint-base.hpp" |
||
28 |
namespace tsid { |
||
29 |
namespace python { |
||
30 |
namespace bp = boost::python; |
||
31 |
|||
32 |
template <typename TaskSE3> |
||
33 |
struct TaskSE3EqualityPythonVisitor |
||
34 |
: public boost::python::def_visitor< |
||
35 |
TaskSE3EqualityPythonVisitor<TaskSE3> > { |
||
36 |
template <class PyClass> |
||
37 |
|||
38 |
7 |
void visit(PyClass& cl) const { |
|
39 |
14 |
cl.def(bp::init<std::string, robots::RobotWrapper&, std::string>( |
|
40 |
(bp::arg("name"), bp::arg("robot"), bp::arg("framename")), |
||
41 |
"Default Constructor")) |
||
42 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
14 |
.add_property("dim", &TaskSE3::dim, "return dimension size") |
43 |
14 |
.def("setReference", &TaskSE3EqualityPythonVisitor::setReference, |
|
44 |
bp::arg("ref")) |
||
45 |
✓✗✓✗ ✓✗ |
14 |
.add_property("getDesiredAcceleration", |
46 |
bp::make_function( |
||
47 |
&TaskSE3EqualityPythonVisitor::getDesiredAcceleration, |
||
48 |
bp::return_value_policy<bp::copy_const_reference>()), |
||
49 |
"Return Acc_desired") |
||
50 |
✓✗✓✗ |
14 |
.def("getAcceleration", &TaskSE3EqualityPythonVisitor::getAcceleration, |
51 |
bp::arg("dv")) |
||
52 |
✓✗✓✗ |
14 |
.add_property("position_error", |
53 |
bp::make_function( |
||
54 |
&TaskSE3EqualityPythonVisitor::position_error, |
||
55 |
bp::return_value_policy<bp::copy_const_reference>())) |
||
56 |
✓✗✓✗ |
14 |
.add_property("velocity_error", |
57 |
bp::make_function( |
||
58 |
&TaskSE3EqualityPythonVisitor::velocity_error, |
||
59 |
bp::return_value_policy<bp::copy_const_reference>())) |
||
60 |
✓✗✓✗ |
14 |
.add_property("position", |
61 |
bp::make_function( |
||
62 |
&TaskSE3EqualityPythonVisitor::position, |
||
63 |
bp::return_value_policy<bp::copy_const_reference>())) |
||
64 |
✓✗✓✗ |
14 |
.add_property("velocity", |
65 |
bp::make_function( |
||
66 |
&TaskSE3EqualityPythonVisitor::velocity, |
||
67 |
bp::return_value_policy<bp::copy_const_reference>())) |
||
68 |
✓✗✓✗ |
14 |
.add_property("position_ref", |
69 |
bp::make_function( |
||
70 |
&TaskSE3EqualityPythonVisitor::position_ref, |
||
71 |
bp::return_value_policy<bp::copy_const_reference>())) |
||
72 |
✓✗✓✗ |
14 |
.add_property("velocity_ref", |
73 |
bp::make_function( |
||
74 |
&TaskSE3EqualityPythonVisitor::velocity_ref, |
||
75 |
bp::return_value_policy<bp::copy_const_reference>())) |
||
76 |
✓✗✓✗ |
14 |
.add_property("Kp", |
77 |
bp::make_function( |
||
78 |
&TaskSE3EqualityPythonVisitor::Kp, |
||
79 |
bp::return_value_policy<bp::copy_const_reference>())) |
||
80 |
✓✗✓✗ |
14 |
.add_property("Kd", |
81 |
bp::make_function( |
||
82 |
&TaskSE3EqualityPythonVisitor::Kd, |
||
83 |
bp::return_value_policy<bp::copy_const_reference>())) |
||
84 |
✓✗✓✗ |
14 |
.def("setKp", &TaskSE3EqualityPythonVisitor::setKp, bp::arg("Kp")) |
85 |
✓✗✓✗ |
14 |
.def("setKd", &TaskSE3EqualityPythonVisitor::setKd, bp::arg("Kd")) |
86 |
✓✗✓✗ |
14 |
.def("useLocalFrame", &TaskSE3EqualityPythonVisitor::useLocalFrame, |
87 |
bp::arg("local_frame")) |
||
88 |
✓✗✓✗ |
14 |
.add_property("mask", |
89 |
bp::make_function( |
||
90 |
&TaskSE3EqualityPythonVisitor::getMask, |
||
91 |
bp::return_value_policy<bp::copy_const_reference>()), |
||
92 |
"Return mask") |
||
93 |
✓✗✓✗ |
14 |
.def("setMask", &TaskSE3EqualityPythonVisitor::setMask, bp::arg("mask")) |
94 |
✓✗✓✗ |
14 |
.def("compute", &TaskSE3EqualityPythonVisitor::compute, |
95 |
bp::args("t", "q", "v", "data")) |
||
96 |
✓✗✓✗ |
14 |
.def("getConstraint", &TaskSE3EqualityPythonVisitor::getConstraint) |
97 |
✓✗ | 7 |
.add_property("frame_id", &TaskSE3::frame_id, "frame id return") |
98 |
✓✗✓✗ |
7 |
.add_property("name", &TaskSE3EqualityPythonVisitor::name); |
99 |
7 |
} |
|
100 |
static std::string name(TaskSE3& self) { |
||
101 |
std::string name = self.name(); |
||
102 |
return name; |
||
103 |
} |
||
104 |
1000 |
static math::ConstraintEquality compute(TaskSE3& self, const double t, |
|
105 |
const Eigen::VectorXd& q, |
||
106 |
const Eigen::VectorXd& v, |
||
107 |
pinocchio::Data& data) { |
||
108 |
✓✗✓✗ |
1000 |
self.compute(t, q, v, data); |
109 |
✓✗✓✗ ✓✗✓✗ |
3000 |
math::ConstraintEquality cons(self.getConstraint().name(), |
110 |
✓✗✓✗ |
1000 |
self.getConstraint().matrix(), |
111 |
1000 |
self.getConstraint().vector()); |
|
112 |
1000 |
return cons; |
|
113 |
} |
||
114 |
static math::ConstraintEquality getConstraint(const TaskSE3& self) { |
||
115 |
math::ConstraintEquality cons(self.getConstraint().name(), |
||
116 |
self.getConstraint().matrix(), |
||
117 |
self.getConstraint().vector()); |
||
118 |
return cons; |
||
119 |
} |
||
120 |
1001 |
static void setReference(TaskSE3& self, trajectories::TrajectorySample& ref) { |
|
121 |
1001 |
self.setReference(ref); |
|
122 |
1001 |
} |
|
123 |
static const Eigen::VectorXd& getDesiredAcceleration(const TaskSE3& self) { |
||
124 |
return self.getDesiredAcceleration(); |
||
125 |
} |
||
126 |
static Eigen::VectorXd getAcceleration(TaskSE3& self, |
||
127 |
const Eigen::VectorXd dv) { |
||
128 |
return self.getAcceleration(dv); |
||
129 |
} |
||
130 |
1000 |
static const Eigen::VectorXd& position_error(const TaskSE3& self) { |
|
131 |
1000 |
return self.position_error(); |
|
132 |
} |
||
133 |
10 |
static const Eigen::VectorXd& velocity_error(const TaskSE3& self) { |
|
134 |
10 |
return self.velocity_error(); |
|
135 |
} |
||
136 |
static const Eigen::VectorXd& position(const TaskSE3& self) { |
||
137 |
return self.position(); |
||
138 |
} |
||
139 |
static const Eigen::VectorXd& velocity(const TaskSE3& self) { |
||
140 |
return self.velocity(); |
||
141 |
} |
||
142 |
static const Eigen::VectorXd& position_ref(const TaskSE3& self) { |
||
143 |
return self.position_ref(); |
||
144 |
} |
||
145 |
static const Eigen::VectorXd& velocity_ref(const TaskSE3& self) { |
||
146 |
return self.velocity_ref(); |
||
147 |
} |
||
148 |
1 |
static const Eigen::VectorXd& Kp(TaskSE3& self) { return self.Kp(); } |
|
149 |
1 |
static const Eigen::VectorXd& Kd(TaskSE3& self) { return self.Kd(); } |
|
150 |
2 |
static void setKp(TaskSE3& self, const ::Eigen::VectorXd Kp) { |
|
151 |
✓✗ | 2 |
return self.Kp(Kp); |
152 |
} |
||
153 |
2 |
static void setKd(TaskSE3& self, const ::Eigen::VectorXd Kv) { |
|
154 |
✓✗ | 2 |
return self.Kd(Kv); |
155 |
} |
||
156 |
static void useLocalFrame(TaskSE3& self, const bool local_frame) { |
||
157 |
self.useLocalFrame(local_frame); |
||
158 |
} |
||
159 |
static void getMask(TaskSE3& self) { self.getMask(); } |
||
160 |
static void setMask(TaskSE3& self, const ::Eigen::VectorXd mask) { |
||
161 |
self.setMask(mask); |
||
162 |
} |
||
163 |
static Eigen::VectorXd frame_id(TaskSE3& self) { return self.frame_id(); } |
||
164 |
7 |
static void expose(const std::string& class_name) { |
|
165 |
✓✗ | 7 |
std::string doc = "TaskSE3 info."; |
166 |
✓✗✓✗ |
7 |
bp::class_<TaskSE3>(class_name.c_str(), doc.c_str(), bp::no_init) |
167 |
.def(TaskSE3EqualityPythonVisitor<TaskSE3>()); |
||
168 |
|||
169 |
// bp::register_ptr_to_python< boost::shared_ptr<math::ConstraintBase> >(); |
||
170 |
7 |
} |
|
171 |
}; |
||
172 |
} // namespace python |
||
173 |
} // namespace tsid |
||
174 |
|||
175 |
#endif // ifndef __tsid_python_task_se3_hpp__ |
Generated by: GCOVR (Version 4.2) |