orwell 0.0.0
CartesianImpedanceController.hpp
1/*
2 Copyright (c) Tobias Löw
3 Written by Tobias Löw <https://tobiloew.ch>
4
5 This file is part of orwell.
6
7 gafro is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 3 as
9 published by the Free Software Foundation.
10
11 gafro is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with gafro. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <orwell/torque/TorqueController.hpp>
23
24namespace orwell
25{
26
34 template <int dof, class Reference>
36 {
37 public:
45 CartesianImpedanceController(const sackmesser::Interface::Ptr &interface, const std::string &name);
46
52
59
60 protected:
67 void setPositionError(const Eigen::Vector<double, 6> &position_error);
68
75 void setVelocityError(const Eigen::Vector<double, 6> &velocity_error);
76
83 void setAccelerationError(const Eigen::Vector<double, 6> &acceleration_error);
84
92 Eigen::Vector<double, 6> limitWrench(const Eigen::Vector<double, 6> &wrench);
93
98 virtual void computeStateError() = 0;
99
100 private:
106 Eigen::Vector<double, 6> getDesiredWrench();
107
108 private:
113 struct Configuration : public sackmesser::Configuration
114 {
119 bool load(const std::string &ns, const std::shared_ptr<sackmesser::Configurations> &server);
120
123 Eigen::Matrix<double, 6, 6> stiffness_;
124
127 Eigen::Matrix<double, 6, 6> damping_;
128
131 Eigen::Matrix<double, 6, 6> inertia_;
132
135 Eigen::Vector<double, 6> wrench_limits_;
136 } config_;
137
139 Eigen::Vector<double, 6> position_error_;
140
142 Eigen::Vector<double, 6> velocity_error_;
143
145 Eigen::Vector<double, 6> acceleration_error_;
146 };
147
148} // namespace orwell
149
150#include <orwell/torque/CartesianImpedanceController.hxx>
base class for an impedance controller derived from TorqueController
void setVelocityError(const Eigen::Vector< double, 6 > &velocity_error)
set the value of velocity_error_
void setAccelerationError(const Eigen::Vector< double, 6 > &acceleration_error)
set the value of acceleration_error_
void setPositionError(const Eigen::Vector< double, 6 > &position_error)
set the value of position_error_
CartesianImpedanceController(const sackmesser::Interface::Ptr &interface, const std::string &name)
loads configuration parameters
Eigen::Vector< double, 6 > limitWrench(const Eigen::Vector< double, 6 > &wrench)
limit the end-effector wrench to the given wrench_limit_
virtual void computeStateError()=0
computes the state error for the impedance control law
RobotState< dof >::Vector computeCommand()
implements the impedance control law
base implementation of a Controller tracking a given Reference
Eigen::Vector< double, dof > Vector
typedef